How to migrate Ethereum token to XinFin Network?

Vishrut Srivastava
Yodaplus
Published in
4 min readJan 14, 2022

My goal in this tutorial is to lead you through the stages of setting up your XinFin Network account and walking you through the process of migrating your account to XinFin. I will also be helping you release your first token on the XinFin network using a simple Ethereum ERC-20 smart contract. The XDC Network is similarly EVM compatible, meaning it can perform all of the operations of the Ethereum network. However, XDPoS consensus offers benefits such as near-zero gas prices, 2000 TPS, and a 99 per cent reduction in energy consumption as compared to Ethereum’s PoW-based network.

The token will be a regular XRC20 token with all of the basic features and the ability to be used as a general base for more complex applications than just transferring funds.

Before we get started, there are a few things you’ll need to put together your own token.

  • XinFin Address (Apothem Network)
  • Your preferred text editor (such as Sublime Text or Atom)
  • Solidity Contract (Any Ethereum ERC-20 or EVM compatible contract can also be useful)
  • XinFin’s e-mail address

We’ll issue the token on the Apothem test network for this lesson, so you don’t have to spend real XDC. The Apothem Test network will be used. To get started, go to XDCPay and sign up for an account, being sure to select the Apothem network.

Text Editor

One of the following text editors can be downloaded as per preference:

  • VS Code
  • Sublime Text
  • Atom

Contract

We’ll be employing the smart contract that BokkyPooBah, the famed Ethereum unicorn rider, assisted us in creating.

https://github.com/bitfwdcommunity/Issue-your-own-ERC20-token/blob/master/contracts/erc20_tutorial.sol

This code will be modified for your personal token.

In simple terms, here’s what you’ll have to do:

  • Download XDCPay
  • Choose Apothem Network
  • Make a copy of the address
  • Get 1000 test XDC by going to the faucet.

Let’s get this party started:

  • In your Text Editor, open the contract you downloaded.
  • Look at the comment section on Lines 3–15. Despite the fact that this is a comment section, it will be useful to you in the future. 0Fucks was the first for me:). When you don’t care about someone, you send them 0Fucks.
  • Change Line 4 to your Smart Contract’s title.
  • Line 6 is to be changed to the XinFin address you created in XDCPay.
  • Change the Symbol on Line 7 to the name of your coin (Keep it short)
  • Line 8 should be changed to the name of your token.
  • Change “FucksToken” to (YourTokenName) on Line 102.
  • Line 115 should be treated similarly.
  • Change the symbol name on Line 116 to match the ones you changed in the comment section.
  • Same for Line 117.
  • Line 120’s Address should match the one you generated in XDCPay.
  • Change Line 121 in the same way.

You can leave the decimals and total supply on Lines 118 and 119 alone, but I’ll explain it only for clarity’s sake. There are a few things to consider when it comes to total supply. The first is that 18 decimals is the standard (and maximum), implying that a coin can be divided into 18 parts.

The second is that, if you wish to issue 100 tokens, you must enter 100 in the total supply section, followed by the number of decimals you select.

For example, if I want to issue 100 tokens, I’ll put 100000000000000000000; and so it goes.

After that, we’re done with the code editing. That was a breeze. Now we’re going to do something fun.

Visit https://remix.xinfin.network/

Create a new file called erc-20.sol in your browser and paste the code you just updated! If something red appears, there is a problem with the code. It’s fine if there’s a yellow warning; let’s just hope for the best.

Now Choose the Token you’re making and compile it under Compile -> Details. The path is Compile -> Details -> Choose The Token.

After generating the contract, choose injected web3 as the environment, choose the contract and click deploy.

After you’ve deployed the token, you’ll receive a popup from XDCPay asking you to accept it and execute transactions.

Check if the transaction went through by clicking on the transaction tx or going to https://explorer.apothem.network. If it didn’t work, try again and figure out what went wrong.

This is a sample image of what you should see if everything goes well.

Now all you have to do is add the contract address to XDCPay, along with the token symbol and decimal value.

You will be able to see the XRC-20 tokens on your XDCPay address after inputting the contract details.

Now we’ll check this contract. To do so, click on the contract address and then pick verify and publish.

Enter the Contract name, choose the compiler version, paste the smart contract, and then click Submit.

Let’s hope, fingers crossed, that we have finally verified our contract.

Final Points to Consider:

You have now created your very own Cryptocurrency Token. This is the simplest method I’ve found for making a token. However, this is only the token creation procedure; you may use XinFin Network to deploy any ERC-20 token or contract.

You’ve just acquired some Blockchain talents, and I hope this has piqued your interest in this fascinating field. But keep in mind that great power comes with great responsibility. I sincerely hope you put your thoughts to good use.

Various channels, such as Slack, Twitter, and Discord, provide technical community support.

Further Readings:

https://medium.com/yodaplus/how-to-implement-semi-fungible-token-in-xdc-network-xrc1155-73b1973dfc8f

https://medium.com/yodaplus/how-to-implement-xrc721-in-xdc-network-d9a2166a0ed9

--

--