How To Deploy Ethereum Smart Contract? — A Step By Step Guide!

How To Deploy Ethereum Smart Contract? — A Step By Step Guide!

Have you noticed the rise in the number of ethereum blockchain smart contracts?

Ever wondered how it all happens? I guess you have, else, you wouldn’t be reading this post.

Well, you can relax because you will find all the answers you seek in this post.

I explained smart contracts and how to deploy an ethereum smart contract.

Let’s begin!

Post Summary

  1. Brief Overview Of The Ethereum Blockchain
  2. What Is A Smart Contract?
  3. Why Is Smart Contract Important?
  4. Ethereum Smart Contract Explained
  5. How To Deploy Ethereum Smart Contract
  6. Relevant Tools For Deploying An Ethereum Smart Contract
  7. Conclusion

A click on any item above will reveal its details.

Enjoy your read!

1. Brief Overview Of The Ethereum Blockchain

Vitalik Buterin created Ethereum in late 2013. The goal was to grant users full control of their online content.

Also, it was designed to be a decentralized platform where developers can build apps.

The Ethereum blockchain produces arbitrary codes with which users can run programs on the platform. Little wonder why it is highly rated in the field of smart contracts.

On the ethereum blockchain, you can also achieve the following:

  • Create your cryptocurrencies
  • Develop virtual organizations
  • Build decentralized apps (dApps)

Click here to read our extensive review on Ethereum.

Moving on, we will learn about smart contracts and their relevance.

Keep reading!

2. What Is A Smart Contract?

Simply put, a smart contract is a kind of contract that does not need any human supervision to be executed.

Smart contracts are drafted on a blockchain. This is why it can be executed without any human supervision.

Usually, the terms of the agreement for a smart contract are written in codes and posted on the blockchain.

These codes conduct the execution of the contract. And though they can be traced, they are irreversible.

With smart contracts, anonymous individuals can carry out transactions easily and safely. There is absolutely no need for a central authority.

In summary, you can say that; a smart contract is a protocol on a blockchain that allows the execution of valid transactions without third parties.

Here is an example of how it works:

John sees the latest model of his android phone on an online phone shop (Sage Stores) and orders it.

The phone is worth $350, and John wants to be sure that it is the model he really wants before losing such an amount for it.

To ensure no one pulls a fast one on the other, John puts up the $350 in a smart contract with the condition that the money will be released:

  • To Sage Stores within 24hrs if the phone is the right model (the smart contract will be designed to detect whether the phone is the right model or not).
  • Back to John within 24hrs if the phone is not the right model, and it will be sent back to Sage stores.

You can see how convenient smart contracts can be, right?

In the next section, I explained why smart contracts are important.

Tag along!

3. Why Is Smart Contract Important?

Smart contracts are important because of the following reasons:
1. It removes the need for middlemen, thereby making the transaction less expensive
2. Smart contracts enable transactions to be completed faster, thereby saving you time
3. It does not require human supervision, and as such, it saves the stress of following up a transaction back to back.
4. Data stored on the blockchain cannot be lost or hacked. This makes smart contracts a safe option.
5. It also means that previous transactions can be traced.
6. Smart contracts provide an environment for a smooth exchange of customized valuable items.

Major platforms that can maximize smart contracts are:

  • Voting systems/commissions
  • Logistics companies
  • Insurance companies
  • Online shops

Now that you have understood the concept of smart contracts, let’s proceed to see how it is done on the Ethereum blockchain.

Read on!

4. Ethereum Smart Contract Explained

An Ethereum Smart Contract is a contract that is deployed on the ethereum blockchain.

As mentioned earlier, the Ethereum blockchain is a popular home for smarts contracts. Briefly in this section, I explained how it boils down.

Three things come to play here: Ethereum Virtual Machine, Gas, and Solidity.

Ethereum Virtual Machine (EVM)

This is the space on the Ethereum blockchain where smart contracts are built. You can think of it as a global supercomputer that runs all the smart contracts.

EVM is a simple state machine. This means that it operates with a programming language.

Gas

For a smart contract to be executed successfully, some computations must be done.

These computations make use of gas. The amount of gas required for a smart contract depends on the complexity of its computation.

Also, the transaction fees for smart contracts on the EVM are determined by the amount of gas used.

i.e., Transaction fee = Total gas used * gas price

Solidity

Remember we mentioned earlier that EVM operates with a programming language. Solidity is the programming language used on EVM.

It is similar to popular programming languages like C++, Python, and JavaScript. This makes it easy for developers to understand and use solidity.

Anyone with intentions of writing a Smart Contract on the Ethereum blockchain needs to have a good grasp of the Solidity programming language.

Next, we’ll see the practical steps involved in creating an Ethereum smart contract.

Keep reading!

5. How To Deploy Ethereum Smart Contract

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!

6. Relevant Tools For Deploying An Ethereum Smart Contract

7. Conclusion

We have now come to the end of our discussion on the Ethereum smart contract. I hope you learned a great deal.

So tell me, will you take the bold step to develop an ethereum smart contract? Or would you prefer to pay a developer to help you out?

Let me know your thoughts in the comments section right now.

Also, share this post with your friends by hitting those social media buttons below. Thank you!

Just so you know…

We can teach you how to trade cryptocurrencies profitably. Simply enroll for our Crypto Trading Mastery Course by visiting www.ctmastery.com. You can also join our Telegram community at https://t.me/ctmastery. See you there!

You may also like:

Originally published at https://www.nigeriabitcoincommunity.com on September 22, 2020.

Check out our new platform 👉 https://thecapital.io/

https://twitter.com/thecapital_io

https://medium.com/media/3b6b127891c5c8711ad105e61d6cc81f/href


How To Deploy Ethereum Smart Contract? — A Step By Step Guide! was originally published in The Capital on Medium, where people are continuing the conversation by highlighting and responding to this story.

Leave a Reply

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