Deploy Smart Contracts on Ropsten Testnet through Ethereum Remix

Step-by-step guide to deploy your smart contract from the local blockchain — Ganache to Ropsten Test Net using the browser based IDE — Remix


Context:

If you have read this tutorial you would know that the we used a local blockchain network called Ganache and used the truffle framework to deploy the smart contracts within a local test environment. This tutorial is the next step in understanding the different ets environments available to us. This post will guide you to deploy the same on ethereum remix IDE (IDE — Integrated Development Environment) on the Ropsten test net.


Things we would be using

Code

Metamask

Remix

Ropsten Test Network

You don’t have to pay real ether to interact with the ethereum blockchain but you can get a feel of the real flow from an end-user’s perspective.


All right, let’s begin.

Stage 1: Setup the Environment

Copy the election.sol (smart contract) and paste it into the remix IDE.


To deploy the contract, we need an account and with some ether on the Rospten test net.

  • Meta mask!
  • Select Rospten Test net
  • Create an Account
  • Copy Account Address
see, we have 0 ether
  • Request Free ether from here or here. Paste the copied account address in text box and click on send me 1 test ether.
  • Ogle at your free ether :P


So now, we have the contract pasted in remix IDE, we have connected meta mask to the ropsten testnet with an account that has some ether.


Stage 2: Deploy the contract

  • click on Run. Select Injected Web 3 Ropsten under environment and the account in Metamask is shown here under Account with balance ether as well.

  • Change the name of the contract to anything you like
  • Click on create -> confirm transaction
  • Click on Metamask extension!
  • Click on the contract deployment — it should open up the etherscan page to look at our transaction details.
  • HODL

congrats, you have successfully created a smart contract!

Stage 3: Interact with the contract


  • Pull / Access data from contract — free — shaded “blue”

If you add 1 (candidate ID) near the candidates field ..you should get the details of candidate ID 1. And 2 would give you the second candidate details.

remember pulling data is free on ethereum blockchain
  • Vote / add data to the chain!

Now that we know who is whom. Let’s try and Vote.

notice the 1 next to vote
IDE shows my transaction is pending
after few seconds, the Metamask extension shows me the transaction details. If I click on it..it should take me to ether scan.

Transaction successful!

If i copy my address from metamask and paste it into etherscan I can see all the transactions within etherscan

The Green INs are the ethers that have come to me from the faucets.

The Orange OUTs are my spends. I have created the contract thrice and wrote on it once.

If I click on the first line item the vote transaction, this is what we see in etherscan.


As you can see, the function vote was called.


That’s it guys, this is the easiest way to deploy your smart contract from a local blockchain environment (Ganache) to the Ropsten test net using the Ethereum Remix IDE.