Use Custom Token

Introduction

In this guide, we will walk through the process of creating a custom token. A custom token can be used for any use-case but we will be adding and using it with the Raiden Network. In order to deploy the Custom Token, you will need to:

Get Goerli Testnet ETH (GÖETH)

Goerli is the name of the testnet on Ethereum where we will be deploying our token. To pay for the on-chain transactions you’ll first need to get some Goerli ETH (GÖETH) on your Ethereum account.

Since we will be using the Goerli testnet you’ll have to switch from “Main Ethereum Network” to “Goerli Test Network” in your MetaMask by selecting it from the top right dropdown.

After switching to the Goerli testnet you can go ahead and acquire some Goerli testnet ETH. One option to do so is to follow these steps:

  1. Visit app.mycrypto.com

  2. When asked how to access your assets, choose MetaMask and connect your account

  3. On the Dashboard, go to Tools -> Use Testnet Faucet

  4. Choose your account from the list and Request Access

You will see a success message showing the corresponding transaction on the Goerli testnet.

You can verify that 0.01 GÖETH was actually received by opening MetaMask and see if your Goerli Test Network shows a balance of total 0.01 GÖETH.

Import Custom Token

The Raiden Network supports transactions of ERC20 compliant tokens. Any smart contract that implements the ERC20 interface can be used with Raiden.

Importing the custom token Solidity code is done via the Remix Ethereum IDE (Ethereum’s integrated development environment). You can read more about ERC20 tokens in this GitHub repo.

../_images/remix_gist_import.png
  1. Start off by getting the Solidity code for an ERC20 token from this GitHub gist.

  2. Enter the URL for the Remix Ethereum IDE in your browser.

  3. Under “Environments” click “Solidity”.

  4. Under “File” choose to import from “Gist”.

  5. In the pop-up that appears enter the ID, a779c0277f2fc5c935e2b2f62e49da49, of the gist you just viewed.

If the import was successful you should be able to open the imported code from the file explorer on the left hand side menu.

Compile Imported Token Code

Before a token can be deployed the imported token code has to be compiled into Ethereum Virtual Machine Code.

Click on the icon underneath the “FILE EXPLORER” in the left hand side menu to view the “SOLIDITY COMPILER”.

../_images/remix_compile2.png

In the compiler you need to:

  1. Select “0.5.4+commit…” from the “Compiler” dropdown.

  2. Click on “Compile CustomErc20Token.sol”.

This will compile the token code and once the compiling step is done you’re ready to deploy your custom token.

Deploy Custom Token

In this step, we will be setting all parameters and finally deploy the custom token to the Goerli testnet.

Navigate to “DEPLOY & RUN TRANSACTIONS” in the left hand side menu.

../_images/remix_deploy.png
  1. Select “Injected Web3” from the “Environment” dropdown. This will open up MetaMask.

  2. Connect with MetaMask when prompted.

  3. Click on the arrow next to the orange “Deploy” button to expand the configure parameters.

  4. Use the following parameter values:

    • initial_supply = 10000

    • decimal_units = 0

    • token_name = MyToken

    • token_symbol = TKN

  5. Click the “transact” button.

  6. Confirm the transaction from MetaMask when prompted.

In the Remix Ethereum IDE terminal you should now see an output similar to the picture below. Congratulations, you have now successfully deployed a token to Ethereum!

../_images/remix_deploy3.png

You can copy the transaction-hash and insert it in the seach-bar at “https://goerli.etherscan.io” to inspect all details of the transaction you just sent.

All you need to do to start using your token is to download and install Raiden and register your token in Raiden, either in the Web Interface or by using the API.