Ethereum Blockchain – Solidity Compiler

In this article, BiasTek will to illustrate step by step to compile the smart contract which will help the reader understand about solidity compiler in Ethereum Blcockchain

1. Environment preparation

Ubuntu 18.04

NodeJS – to run JavaScript scripts

npm – to install JavaScript libraries

2. Install Nodejs and npm

Add Node.js PPA

$ sudo apt-get install curl

$ curl -sL | sudo -E bash –

Install Node.js

$ sudo apt-get install nodejs

Check Node.js and NPM Version

$ node -v

Output: v13.13.0

$ npm -v

Output: 6.13.7

3. Installing Solidity Compiler

$ sudo add-apt-repository ppa:ethereum/ethereum

$ sudo apt-get update

$ sudo apt-get install solc

$ solc –version

Output: Version: 0.6.6+commit.6c089d02.Linux.g++

4. Compile Voter.sol

$ solc –combined-json=abi,bin,metadata –output-dir . Voter.sol

$ cat combined.json | jq

The output will show like below

$ cat combined.json | jq -r ‘.contracts.”Voter.sol:Voter”.abi’ | jq

The output will show with json format of voter.abi like below

Leave a Reply

Your email address will not be published. Required fields are marked *