Ethereum has given birth to new decentralized apps in the blockchain space. Ethereum was created by Vitalik Buterin’s, a programmer. A point to note is that Ethereum’s success credit goes to the implementation of smart contracts.
The Ethereum blockchain allows you to:
Create cryptos that are compatible with Ethereum blockchain wallets.
Develop virtual entities that enable voting.
Build dApps.
Fundraise.
What is a Smart contract?
This refers to a business logic according to which all transactions on a blockchain take place. A smart contract aims to fulfil common contractual conditions. Smart contracts are deployed to the decentralized database for a fee proportional to the containing code’s storage size.
Creating and Deploying Ethereum smart contracts
Installation Requirements
Metamask chrome extension acts as an Ethereum and wallet. Metamask allows you to interact with smart contracts and decentralized apps on the web. You do not need to download the blockchain or install any software.
Steps to develop a smart contract
Create a Metamask wallet
Enable Metamask in your chrome browser. You then set up your wallet.
Choose a test network
The following test networks are available in your Metamask wallet. They are for testing only, and their ethers have no real value:
Robsten Test Network
Kovan Test Network
Rinkeby Test Network
Goerli Test Network
Add some dummy ethers to your wallet.
The dummy ethers are for testing the smart contract. Click on ‘Deposit’ and ‘Get Ether’ Click ‘Request 1 Ether from faucet’ and 1 ETH will be added to your wallet. You can add as much ETH as you want into the test network.
As soon as the dummy ETH is added to your wallet, you can write smart contracts on the Remix Browser IDE in Solidity.
Write the smart contract in Solidity
Use Remix Browser IDE to write the Solidity code. It is the best as it comes with a handful of features and provides a great development experience. Remix is used for writing small-sized contracts.
Create a .sol extension file
Open the Remix browser and click on ‘+’ on the top left.
Deploy the contract
Press the deploy button at the right-hand side of the Remix window. After the transaction is complete, the smart contract address will be visible on the right-hand side. To check the tokens in your wallet, click add tokens, ether the address, and click ok.
Testing an Ethereum smart contract
Run everything like transfer, totalSupply, and balanceOf.
Try transferring tokens to other ETH wallets.
Get totalSupply through the totalSupply method
Deploying Ethereum smart contracts
Make your smart contract live
Add real ETH
Again, deploy your smart contract, as mentioned above.
Visit http://www.etherscan.io and search for your smart contract address, then select it.
Verify your smart contract
Copy your smart contract code and paste it on Etherscan. Select the name compiler version that you selected on Remix to compile your code.
If you had selected optimization at Remix, check ‘yes’ on optimization. Otherwise, check ‘no’.
Click on verify
Originally published on https://decentralised.africa/