QTUM 102: Build your own QRC20 Token
Last week we did a small intro on how to switch onto the QTUM Testnet. It is now time to get to the crunchy part, so we will be guiding you step by step on how to build your own QTUM based QRC20 token.
We recommend you use the QTUM testnet first, unless you are fine with spending real QTUM.
For this guide we are using MAC OS X and Qtum Core version mainnet-ignition-v0.15.1 (64-bit)
Step 1: Define your Parameters
To start, let’s create a fixed supply & burnable QRC20 Token. Fixed supply means that the amount of tokens created will be fixed at creation of the token smart contract. Burnable means the tokens can be destroyed/burned by the creator.
The basic parameters for our QRC20 Token will be as follows:
- Token Symbol: BIG
- Token Name: BigCoin
- Decimal: 0
- Total Supply: 1000000
Feel free to change the above parameters to your linking, but keep those in the back of your mind, we will be using them soon enough.
Note: 0 decimal place means the smallest denomination of your token is 1, you cannot transact with 0.5 or 0.01
Step 2: Launch the QTUM Core Wallet
If you followed through last week’s guide, you should already have a QTUM address, if not check step 3 of QTUM 101 on how to create an address on the QTUM Core Wallet.
If you already have your QTUM address:
- Go to: Smart Contracts Tab
- Select: Create Option
Now, this is where people usually get stuck, close the window and walk away. Hold on tight and we will breeze through this technical hurdle.
To build the QRC20 Token 2 things are needed:
- A Bytecode
- An Interface ABI
These 2 items are derived from the original source code of your QRC20 contract which we teach you how to cook.
Step 3: Borrow the Kitchen from Ethereum
- Install Metamask as a chrome extension.
- Switch to the Ropsten Test Net.
- Claim some Ropsten Test Ether from the Ropsten Faucet (use your metamask address).
- Open Remix and set the compiler to version 0.4.19+commitc4cbbb05
- Make sure that remix is pointed to your metamask wallet and you are on Ropsten.
Note: The version that you set on the compiler needs to match the version on the source code.
Step 4: Let’s get Cooking
Our kitchen is set up, now let’s make the cookie dough.
- Open this github repository, copy the code and paste it in Remix.
string public constant symbol = “BIG”;
//this is the token symbol, change to liking//
string public constant name = “BigCoin”;
//this is the token name, change to liking//
uint8 public constant decimals = 0;
//this is the number of decimal place for the token, change to liking//
uint256 _totalSupply = 1000000;
//this is the total supply of token to be created, change to liking//
uint256 _totalBurned = 0;
- Remember the basic parameters from step 1, feel like making 1 billion Beauty coins, go ahead, and replace the parameters in bold directly in remix.
Step 5: Into the Oven
Back to Remix its now time to cook that cookie dough into delicious bytecode and Interface ABI.
- Deploy the code.
- Go to Compile and open the detail section.
- Get the Bytecode, copy only the object part, this is the part.
- Get Interface ABI, this is the part.
Step 6: Get that QRC20
Now that you have your bytecode and Interface ABI ready, paste them inside the QTUM Core Wallet, and click create contract and Voila!
Now to view your beautiful new QRC20 Tokens:
- Go to: QRC Tokens Tab
- Select: Add the newly created Contract Address
- Add: your QTUM address that created the contract.
Here you go, 1 million BigCoins!
If you have any other questions feel free to contact us on any of the channels below or by email at email@example.com