How to deploy tokens on Kadena

Thanos
KadenaCoin
Published in
4 min readAug 29, 2020

Deploying contracts on Kadena is simpler than it looks

With this method you will need Chainweaver installed

First step is to make a token contract, you can skip this step by using a premade contract like this one

Preparations

I will be using testnet for this but the process is exactly the same on mainnet

Make sure you have some coins to pay for the gas, you can easily CPU mine on testnet

Open up the contracts tab on Chainweaver and create yourself a keyset
If you do not understand what keysets are you should familiarize yourself with them first

Once you have a keyset you can copy paste the contract on the left, make sure to edit the keyset in the code to match yours (Line 1 twice and line 41)

Deployment

Switch to testnet if you haven’t already, then click deploy

Fill the inputs as you would for a normal transaction but set the maximum gas used to 3000. Deploying contracts use more gas than a transaction

Sign with the key controlling the account in the Sign tab
The preview should show something like this

Submit and wait, if you have done this correctly you will receive this message

In the module explorer you can now see our token is deployed!

You might want to deploy your contract on 1 or multiple chains depending on your goals. Simply repeat the deployment process for every chain

Initialization

This particular token needs to be initialized to create the initial supply, this can only happen once

Click view on our newly launched token, here you can see all the functions available to the contract

What we want is to initialize it, so we will call the initialization command by clicking the Call button next to Initialize. Fill the data as usual, you need to use the same keyset you used to deploy it or it will fail

On the Sign tab, you need to add a capability to the transaction. In this case we need the GOVERNANCE cap which allows the creator to do certain calls like updating the contract and initializing it
(free.token-example.GOVERNANCE)

If it went well, you should see this

If not, you probably had an error with your keyset or didn’t add the capability correctly. You need to change free.example-token to whatever you named your module

Checking balance of the ROOT account

in the module explorer again, with your token selected, call the get balance function. Our contract uses ROOT as the initial holder

You do not need to select gas payers or anything as we are not sending anything, the preview tab will show us the answer

Conclusion

Once its deployed, you can look at our commits here to see how we modified the transfer page and the balance page to work on our token

The rest works exactly like Kadena transfer, transfer-create, get-balance, create-account, rotate

If you need any help come see us in the Anedak discord

Shill

This exact contract is currently deployed on mainnet
If you want to own a part of history with the first token on the Kadena network, come get a piece

The sale is ongoing until September 15 2020

We completely integrated gas stations for both regular and cross-chain transfer, never waste KDA to pay for your token gas!

Links

Online Wallet: https://anedak.com/transfer https://anedak.com/balance
Explorer: https://explorer.chainweb.com/mainnet
Ann: https://bitcointalk.org/index.php?topic=5270145
Website: https://anedak.com/
Github: https://github.com/Thanos420NoScope/Anedak
Telegram: https://t.me/Anedak_Token
Discord: https://discord.gg/6uy5QDf

--

--