This article will teach you how to deploy your ERC20 token on to the Ethereum Rinkeby TestNet but in order to understand this article, You first need to understand what are smart contracts? What are ERC20 Tokens? What is Ethereum ? What is metamask ?. If you understand all this then you are at the right place. Otherwise you have to start from scratch by starting from here.

If you followed the blog and created your ERC20 Token successfully and tested it using metamask and ganache. You want to put your currency somewhere live and should i be able to show it to people and even transfer some using there testnet address then you need to deploy your tokens to a testnet. We will be using the Rinkeby testnet for this.

Syncing the Node:

The first you need to have is Ethereum Geth. You need to connect and get synced to the Ethereum Rinkeby Testnet.

You can start your machine by typing in this command.

$ geth --rinkeby --rpc --rpcapi="personal,eth,network,web3,net" --ipcpath "~/Library/Ethereum/geth.ipc"

After it starts importing new blocks. leave this terminal running as it is and in another terminal write this command to get connected to the Rinkeby network.

$ geth attach

There might be some cases where you need to define the IPC path in order to get attached to the Rinkeby network. There is a lot you can do after you are connected to the Rinkeby network.

Before doing anything you need to let your ethereum rinkeby network get synced. To check its status type

$ eth.syncing

This will return the current syncing status of your node syncing to the rinkeby network. It will show you the highest block, Synced blocks, Known states and pulled states. After the rinkeby network has synced itself your eth.sync command will give you a “false” status.

Creating The New Account:

The second step is to create an account on the Ethereum Rinkeby network on which you will deploy and run you smart contracts for the ERC20 Token. To create a new contract go to the terminal and type

$ geth account --rinkeby new

You will be assigned an account address and will be asked for your paraphrase which should be a strong password not just random 12345.

Getting Ether in your Account

In order to deploy any smart contracts on the rinkeby network or the main ethereum network you need to have some ether in your account. To get ether in Rinkeby Testnet goto https://faucet.rinkeby.io/ Follow the on screen instructions and post your social media link along with your address for the account that you just created in the rinkeby testnet and click the give me ether button. You will start receiving some ether’s in your account.

go back to the geth attached terminal and type

$ eth.accounts[0]

This is your account that you had created you can match the address. Then to check if you got some ethers type

$ eth.getBalance(eth.accounts[0])

If your faucet was successful you will see a non zero value here. This represents your ether in “WEI” which is a small unit of Ether.

Configuring the Network Profile:

Now that you have ether and your node is synced . You need to deploy your contracts on to the rinkeby network. by using truffle we have to migrate and deploy our contracts on to the network but this time instead of ganache we will do it on the rinkeby network so we have to change the configuration file of our ERC20 Token.

rinkeby : {
host: "localhost",
port: "8545",
network_id: "4",
gass: "4700000"
}

add this network configuration to the truffle.js file of your ERC20 Token.

Migrating using Truffle:

Now that we have the configured our code , the node is synced, the accounts are created and ether has been deposited now its time to deploy our smart contracts on to the rinkeby network.

The first step to do this is to unlock your account in the geth attach terminal by typing.

$ personal.unlockAccount(eth.accounts[0], null, 1200)

This command requires three parameters that account , its passphrase and the time you need to open this account for. We provided the account , then we provided null which means that you will enter your password later and now write it here in the open format and the last are the seconds that for how long we want this account opened.

After this go the default terminal and type a command to migrate your smart contracts onto the Rinkeby network using the account you just unlocked.

$ truffle migrate --reset --compile-all --network rinkeby

give it a few minutes and you are done. All of your smart contracts are deployed on to the rinkeby network.

In your console output you will get all the address of your deployed contracts, which you can search these contracts on the Rinkeby Network.

Rikeby on Etherscan:

Once your token is deployed you will be given a token address in the truffle output screen.

copy that address and search it on the Rinkeby network

You will be able to see your tokens like this.

This shows that your token has been successfully deployed on the Rinkeby test net.

If you want to create or deploy your own ERC20 tokens than contact your blockchain development company.

Tags: , , , ,