before you deploy you contract into the Mainnet, you should test it, failling to do so, it is very expensive, so you need a solution to test your contract before deploying it. Ropsten is the perfect network to do it, being of th three biggest Test networks, it is fast, due to the use proof of authority instead of Ethereum Proof of work and it is easy to earn Ether. It this tutorial We are going to a contract in Ropsten Network.
required Tools
in order to deploy a contract you are going to need the following tools:
Before deploying a contract into the test Network we should make sure that the contract has no errors. Once it is deployed the only way to change is to deploy the contract again. This take time and Ether, so you should test your contract before deploying. If you want to know about testing your contract you should read this article about testing your contract.
In this tutorial i am going to use my contract from the previous post, my own ERC20 token Gtoken.
Getting Ether on the test network
Before deploying your contract you need Gas. One of the main differences between test networks is how you get Ether, neither of them you use real Ethereum, and you can get it for free. In order to get some Ether go to the Ropsten Network faucet page, http://faucet.ropsten.be:3001/ and request 1 Ether. Now you have 1 Ether on your account.
Truffle
Once you have the Ether and the contract ready, the next step is to install truffle. If you are testing you contract you should already have it installed, if not, Truffle is pretty easy to install, just follow the Installment on the Github page.
Ethereum node
The last thing missing is the Ethereum node. In order to deploy a contract, you need to be connected to the Blockchain. I am going to use the public node Infura public node. Infura is very easy to use, just login into their and and you will recieve a key. You need that token to connect to the network.
If you do not use a public network, you can use a private local node. Geth or Tmux are the best options.
Deployment
Once you have all the tools installed it is time for the deployment. Just to make things clear I am going to list all the steps you need:
Register in Infura.
Set your mnemonic and infura key.
Use truffle to deploy the contract and all the dependencies.
Use EtherScan to confirm that your contract was successfully deployed.
Use truffle to deploy the contract and all the dependencies.
To deploy a contract using truffle should not be a problem. Just use the command:
truffle deploy --network ropsten --reset
Use EtherScan to confirm that your contract was successfully deployed.