Skip to main content

Create and mint a token

Create a fixed token#

A fixed token is a token where you can't mint more tokens after creation.

To create a fixed token use the following request:

Create a fixed token
{       "jsonrpc": "2.0",    "method":"account.submit_transaction_single_step",    "params": {        "actions": [             {            "type": "CreateFixedSupplyToken",            "symbol": "<symbol>",            "name": "<name>",            "description": "<description>",            "to": "<to address>",            "iconUrl":"<iconUrl>",            "tokenUrl":"<url>",            "supply":"<supply>",            "publicKeyOfSigner": "<your public key>",            }        ]      }, "id": 1}

where:
<symbol> symbol is the token you want to create in lower case. For example: ams
<name> is the name of the token you are creating. For example Amsterdam token
<description> is the description of the token. For example: token for visitors in Amsterdam
<to address> is the address where the minted tokens will be send to. For example: tdx1qspspt3pdggje2sx9n6qg29skscyac7rahyez3qsd7s26c4h3sfpqpqtw55e5
<iconUrl> is the address to the icon of the token. For example: https://stakesafe.net/icons/icon-ams-32x32.png
<url> is the address to the URL of the website of the token. For example: https://stake.amsterdam
<supply> is the amount of tokens to mint. For example 100 tokens is 100000000000000000000
<your public key> is the public key of your node which was returned to you at creation of your keys. For example: 0392f29097f581ba20b1edf75eb2b2655021b026a9b4c22c39647fc4c25b53ef38

Symbol in lower case

This request is only accepted when the symbol is written in lower cases

You should receive an output like this:

{    "result": {        "txID": "a589e416d41481b80fdd456546c2df9d9dcfb17d0ecb3c2cba0f6f78939fd81f"    },    "id": 1,    "jsonrpc": "2.0"}

Find the RRI ID of your token#

Now that you have created your own token you want to know the unique RRI ID to use the token. Since you have all the supply now in your wallet just query the token balance of your node to see the RRI ID.

This can be done using an archive node with the method account.get_balances. You can also send an account.get_info request to your own node:

Get account info to find RRI ID
{        "jsonrpc": "2.0",    "method": "account.get_info",    "id": 1}

You should receive an output like this:

{    "result": {        "address": "tdx1qspspt3pdggje2sx9n6qg29skscyac7rahyez3qsd7s26c4h3sfpqpqtw55e5",        "balance": {            "stakes": [                {                    "delegate": "tv1qwv5utj3mp5qfahadjzvughnm90qurwlqltm9wpjcfcme2krtd3z76daz7r",                    "amount": "18637783694287100669061"                }            ],            "tokens": [                {                    "amount": "842716000000000000000",                    "rri": "xrd_tr1qyf0x76s"                },                {                    "amount": "41977559806666000000000000000000",                    "rri": "ams_tr1qwlcemvnlfze69q2ca0k6dvcxfcx6lgtxz7a2sp6mgcqrvfw6c"                },                {                    "amount": "41977559816230357200000000000000",                    "rri": "ssf_tr1qd7t22najadprhjhfms74r0gzlg7t5as7tn8r4fc3reqk98afs"                }             ],            "preparedStakes": []        }    },    "id": 1,    "jsonrpc": "2.0"}

In this output we see three tokens in this wallet: ams, ssf and xrd token. The RRI ID for the ams token is in this example ams_tr1qwlcemvnlfze69q2ca0k6dvcxfcx6lgtxz7a2sp6mgcqrvfw6c. With the RRI ID you can start using your token, for example make a transfer to another wallet.

Create a mutable token#

A mutable token is a token where you can mint more tokens for later.

Hard to find RRI ID

At this moment this creates the new token on the network but the RRI ID is not returned after creation to you. To find your RRI ID you need to dig in the source code or the ledger.

To create a mutable token use the following request:

Create a mutable token
{"jsonrpc": "2.0",    "method":"account.submit_transaction_single_step",    "params": {        "actions": [             {            "type": "CreateMutableSupplyToken",            "symbol": "<symbol>",            "name": "<name>",            "description": "<description>",            "from": "<owner address>",            "iconUrl":"<iconUrl>",            "tokenUrl":"<url>",            "publicKeyOfSigner": "<your public key>",            }        ]      }, "id": 1}

where:
<symbol> symbol is the token you want to create. For example: ams
<name> is the name of the token you are creating. For example Amsterdam token
<description> is the description of the token. For example: token for visitors in Amsterdam
<owner address> is the address of the owner of the token. For example: tdx1qspspt3pdggje2sx9n6qg29skscyac7rahyez3qsd7s26c4h3sfpqpqtw55e5
<iconUrl> is the address to the icon of the token. For example: https://stakesafe.net/icons/icon-ams-32x32.png
<url> is the address to the URL of the website of the token. For example: https://stake.amsterdam
<your public key> is the public key of your node which was returned to you at creation of your keys. For example: 0392f29097f581ba20b1edf75eb2b2655021b026a9b4c22c39647fc4c25b53ef38

You should receive an output like this:

{    "result": {        "transaction_identifier": "35a8fd6a956569d6835dd235baa0d3f94c699cd449d5c6f8e5065fff7aab5308",        "transaction": "03000395b67a4753e488ee48d6fc9c9277af66e57361c30e30f6350ad20572746d303401020395b67a4753e488ee48d6fc9c9277af66e57361c30e30f6350ad20103143e0f8cdeb6c1f3a2a4824439517b20ba72f79058036e3034e9873f68bf5efc0f526f7474657264616d20746f6b656e0f526f7474657264616d20746f6b656e1b68747470733a2f2f7777772e7374616b652e616d7374657264616d2e68747470733a2f2f7374616b65736166652e6e65742f69636f6e732f69636f6e2d616d732d33327833322e706e670004768168b10f6f5d65ed2bc969d5ea93792795ce6a497fc7a14fe8cecfdcde748a000000050103010403143e0f8cdeb6c1f3a2a4824439517b20ba72f79058036e3034e9873f68bf5efc00000000000000000000000000000000000000000000000d8aabe080bc9400000007014e04477d74d62b251046f15a7becab028ced970653c8dd4c3d955f8f0c520eb65a1cbd744ed53b650ae374b3d1075c255dc7f660d9e76741a9713fcf85285c66"    }}

Minting a token#

If you have created your mutable token and you know your RRI ID you can start minting your tokens.

To mint tokens use the following request:

Mint tokens
{"jsonrpc": "2.0",    "method":"account.submit_transaction_single_step",    "params": {        "actions": [             {            "type": "MintTokens",            "to": "<to address>",            "amount": "<amount>",            "rri": "<token id>",            "publicKeyOfSigner": "<your public key>",            }        ]      }, "id": 1}

where:

<to address> is the address where the minted tokens will be send to. For example: tdx1qspspt3pdggje2sx9n6qg29skscyac7rahyez3qsd7s26c4h3sfpqpqtw55e5
<amount> is the amount of new tokens to mint. For example 100 tokens is 100000000000000000000
<token id> this is the RRI ID of your token
<amount> the amount to mint.
<your public key> is the public key of your node which was returned to you at creation of your keys. For example: 0392f29097f581ba20b1edf75eb2b2655021b026a9b4c22c39647fc4c25b53ef38

Burning tokens#

Another "feature" of your wallet is to burn tokens.

warning

This will burn tokens from your wallet so be careful ;)

To burn tokens use the following request:

Burn tokens
{"jsonrpc": "2.0",    "method":"account.submit_transaction_single_step",    "params": {        "actions": [             {            "type": "BurnTokens",            "from": "<from address>",            "amount": "<amount>",            "rri": "<token id>",            }        ]      }, "id": 1}

<amount>: is the amount of tokens to burn. For example 1 tokens is 1000000000000000000
<from address>: is the address of your node. For example: tdx1qspspt3pdggje2sx9n6qg29skscyac7rahyez3qsd7s26c4h3sfpqpqtw55e5
<token id> this is the RRI ID of your token For example: ams_tr1qwlcemvnlfze69q2ca0k6dvcxfcx6lgtxz7a2sp6mgcqrvfw6c