Step 1: Create a wallet with MetaMask
i. Install MetaMask Extension in your Chrome browser and enable it.
[This serves as an Ethereum browser and a wallet. It enables you to manage smart contracts and dApps on the web. That way, you don’t need to download the Ethereum blockchain.]
ii. Next, you create a wallet and set your password
iii. Now confirm that the “Main Ethereum Network” at the top right corner of the page is checked.
Step 2: Choose a test network
This is where you select a network with which you will test your smart contract. Select from any of these options:
- Ropsten Test Network
- Kovan Test Network
- Rinkeby Test Network
- Goerli Test Network
Step 3: Send dummy Ethers to your wallet
You can’t test your smart contract without ethers hence the need to get some dummy ethers into your MetaMask wallet:
i. Click on Buy
ii. Then select “Get Ether” from the Test Faucet option
iii. It opens you to another page. Select “request 1 ether” and complete the form that will pop up.
iv. The dummy ether is sent to your account automatically
You are now ready to write your smart contract
Step 4: Use editor remix to write the smart contract in Solidity
i. Open Remix Browser (https://remix.ethereum.org)
ii. Click on the plus icon on the top left side to create a .sol extension file.
iii. A field will be opened where you are to input the codes for your smart contract.
iv. When you are done with the codes, select a compiler from the left menu to compile the solidity Ethereum smart contract code.
Here is a sample for an ERC20 token:
Step 5: Deploy your contract
Click on the deploy button at the right-hand side of the Remix window.
Then wait for the process to complete. You will find the address of your smart contract at the right-hand side of remix window.
Step 6: Test Your Ethereum Smart Contract
Go to the right side of the remix window and run all the actions you included in your contract like transfer, total supply, etc.
Step 7: Make It Go Live
i. Go to MetaMask and turn on the main ethereum network
ii. Now, add some real ethers.
iii. Then repeat the previous steps to deploy your smart contract again.
iv. After it has deployed successfully, visit http://www.etherscan.io and search for your smart contract address.
v. When your smart contract appears, click on “verify contract” to verify it.
vi. You will then be provided with a code for the smart contract
vii. Copy the code and paste it on Etherscan.
viii. Next, you select the same compiler version you selected at remix.
ix. Then check “optimization” to Yes, if you selected it at remix; otherwise, check ‘No’.
x. Lastly, click verify.
Congratulations, your Ethereum smart contract is live!
Note: The steps above are relevant if the smart contract you are developing is centered on an ERC20 token. If you are looking to do something different like a blockchain marketplace, the steps will vary.
Next, I listed some tools you may find useful as you write your ethereum smart contract.
Check it out!