install truffle
and ganache
Truffle use to compile, deploy Solidity source code
Ganache use to testing
npm install -g truffle
npm install -g ganache-cli
Initial truffle into a project folder
mkdir truffle-demo
truffle init
Config truffle-config.js as below
module.exports = {
networks: {
development: {
host: '127.0.0.1',
port: 8545,
network_id: '*' // match any netwrok id
}
}
};
Write a smart contract
truffle create contract HelloWorld
Write a migration, to deploy on blockchain
truffle create migration deploy_hello_world
truffle migrate
truffle compile
truffle create test HelloWorld
geneche-cli