Smart Contract-Environmental Construction

Environment setup [Tools required for installation]
1. Install nodeJS

, install truffle scaffolding, and simulate the blockchain network environment of 'test'.

npm install -g ethereumjs-testrpc truffle


use
testrpc
command
to start a virtual test environment.
It will show ten accounts [Ethereum addresses] by default. Correspondingly, ten private keys are generated.
Among these ten wallets (addresses), each address will have 100 fake ethers by default.


The directory structure of the project file:

/contracts: The place where the original code of the smart contract is stored. There are already three sol files in it, and the developed demo.sol file is stored here.

/migrations: This is the function used by the Truffle framework to deploy smart contracts. During deployment, 2_deploy_contracts.js will be modified to deploy demo.sol.

/test: The test code for writing and testing smart contracts is placed here, supporting js and sol tests.

truffle.js: Truffle setup documentation.


Command to create a new HelloWorld contract Create the demo.sol file directly

in the contracts folder. You can also execute the
truffle create contract demo command in the project path to create demo.sol



Note that the IDE used in the tutorial I watched at the time was Atom.
https://atom.io/

Guess you like

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