Compiling and deploying your smart contract
You can compile your solidity smart contract with the help of the solc
compiler and deploy it using the geth JavaScript console. In this recipe, we will focus on compiling and deploying the contract from your decentralized application using solc.js
and web3.js
.
Getting ready
Make sure that you have web3.js available in your application to run these scripts. You will also need to install solc.js
in order to compile your contract. You can install solc.js
using npm
:
npm install solc --save
Every transaction has to mine before you can see the result of the execution. In the Ethereum main or test networks, there are other miners to take care of this. If you are using a private network, you can start and stop the mining process from the web3 JavaScript console using the following commands:
miner.start() // starts mining miner.stop() // Stops mining
How to do it...
These steps are used to compile and deploy smart contracts:
- Consider the following contract as...