Use Custom Token
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:
When asked how to access your assets, choose MetaMask and connect your account
On the Dashboard, go to Tools -> Use Testnet Faucet
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.
Start off by getting the Solidity code for an ERC20 token from this GitHub gist.
Enter the URL for the Remix Ethereum IDE in your browser.
Under “Environments” click “Solidity”.
Under “File” choose to import from “Gist”.
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”.
In the compiler you need to:
Select “0.5.4+commit…” from the “Compiler” dropdown.
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.
Select “Injected Web3” from the “Environment” dropdown. This will open up MetaMask.
Connect with MetaMask when prompted.
Click on the arrow next to the orange “Deploy” button to expand the configure parameters.
Use the following parameter values:
initial_supply = 10000
decimal_units = 0
token_name = MyToken
token_symbol = TKN
Click the “transact” button.
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!
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.