Getting Started with Truffle Development

1. Install nodejs

2. Install truffle: execute the command: npm install -g truffle

3. truffle init (project name can be added)

        

4. Windows needs to delete truffle.js in the root directory, otherwise the editor will automatically open the file

5. Add the contract file contract name .sol in the contracts folder, for example:

        

6. Add a deployment contract instance to the migrations folder

 

 

7. Enter cmd in the current directory address and press Enter, or open the command line first, and then jump to this directory

          

8. Execute truffle develop, which will generate ten test accounts

 

9. To compile the contract, use: compile

        

10. Add the test contract name.sol file to the test folder, for example:

changed to:

 

11. Run the test instance, use the command: test

 

 

12. To deploy the contract, use: migrate

 

13. Obtain and test the contract

 

 

14. Precautions: compiling and deploying contracts to executing contracts must be performed under the current user's condition, that is, the current command line cannot be closed, and must be recompiled and deployed after closing.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325121459&siteId=291194637