Creating a Token by Node API

Tokens on Radix

Creating your own token on Radix is easy. Token creation is a built-in feature of the Radix network, and requires only a single transaction using the Radix Node API.

A token creation transaction is no more complicated than one to perform a simple transfer of tokens, as described in Making Transactions. The only difference is that you use a special transaction type and must specify the parameters of the token you want to create, such as its name and supply.

This page describes the types of tokens you can create, the parameters you can specify, and how to use these tokens after created.

Radix Tokens vs. Smart Contract-based Tokens

If you’re familiar with creating tokens on Ethereum or other smart contract blockchains, Radix’s approach is very different. Because Radix is designed as a platform for decentralized finance, secure creation and management of tokenized assets is a core feature. Therefore Radix’s design makes tokens a global feature of the ledger, rather than requiring developers to deploy nearly-duplicate smart contracts each time they want token-like functionality.

For example, on Ethereum the native ETH token is a special, with all other tokens implemented simply smart contracts that seek to follow a common interface standard (ERC-20 and similar). Developers must interact with ETH and ERC-20 tokens differently. On Radix, because tokens are a core feature of the platform, the network’s native token XRD is implemented and transacted in exactly the same way as user-created tokens. The only thing special about XRD is that it is was created at genesis and is the only token that may be used to pay transaction fees or staked to validators.

The built-in token functionality described on this page is available on the current Olympia mainnet. This functionality is defined in the network’s application layer: Radix Engine v1. Later versions of the network will implement Radix Engine v2, which will include full smart contract functionality that will retain, and greatly extend, this core concept of tokens as global resources.

For more on Radix’s plans for Radix Engine v2, see this page on our Knowledgebase

Token Types and Features

Radix’s Olympia mainnet implements two simple types of token:

Fixed tokens

A token with fixed supply specified at creation. No minting/burning is possible.

Mutable tokens

A token with mutable supply whose creator is able to mint/burn tokens.

Fixed tokens have a supply that cannot ever be affected by anyone, including its creator, and so can provide confidence to holders in some cases. Mutable tokens are more flexible, but require trust in the creator to only mint or burn tokens appropriately.

Making a Create Token Transaction

Both types of token may be created using a simple transaction. This transaction is created using exactly the same API process described on Making Transactions. The only difference is that the construction.build_transaction method call must include an action of type that is either CreationFixedSupplyToken or CreateMutableSupplyToken.

The two types of token creation action also use a set of similar, but slightly different, data fields to describe the token:

Fixed token action data

This type immediately issues the fixed supply of tokens, and so a recipient to address must be specified.

type

CreateFixedSupplyToken

to

The Radix address that will receive the new fixed supply of tokens

publicKeyOfSigner

The public key of the Radix address you are using to create the transaction

symbol

Like btc or xrd, recommended to be 3-8 characters

name

Like Bitcoin or Radix

description

A brief description of the nature of the token and its use (max 255 characters)

iconUrl

A URL of a token icon page, recommended to be a 32x32 pixel PNG image

tokenUrl

A URL to a page providing more information about the token

supply

The total fixed number of tokens to be created and that will ever exist, specified in sub-unit quantities of 1x10^18 subunits per "whole" token. eg: A supply of 1000 tokens would be specified as 1000000000000000000000

Mutable token action data

This type allows the creator to mint and burn tokens freely and so no immediate supply is specified.

type

CreateMutableSupplyToken

publicKeyOfSigner

The public key of the Radix address you are using to create the transaction

symbol

Like btc or xrd, recommended to be 3-8 characters

name

Like Bitcoin or Radix

description

A brief description of the nature of the token and its use (max 255 characters)

iconUrl

A URL of a token icon page, recommended to be a 32x32 pixel PNG image

tokenUrl

A URL to a page providing more information about the token

Example token creation transaction

The API call to build the token creation transaction would look something like this:

  • Fixed token

  • Mutable token

curl -d '{
  "method": "construction.build_transaction",
  "params": {
    "actions": [
      {
        "type": "CreateFixedSupplyToken",
        "to": "rdx1qthu8yn06k75dnwpkysyl8smtwn0v4xy29auzjlcrw7vgduxvnwnst6derj",
        "publicKeyOfSigner": "02df4f2f252fbd6c432aae8d0e5e4d62746fbc781bd4fbcb200522a9e4437e31f9",
        "symbol": "gum",
        "name": "Bubblegum",
        "description": "With this token, you will never be all out of bubblegum.",
        "iconUrl": "https://www.roddysbubblegum.io/icon-gum-32x32.png",
        "tokenUrl": "https://www.roddysbubblegum.io/about-gum/",
        "supply": "1000000000000000000000"
      }
    ],
    "feePayer": "rdx1qspl7mgjqwgwqyjvy2tj8swe8a4lr6mxqdhwmn60cujl6a85mqh69eg37p9ph"
  },
  "id": 0
}' -H "Content-Type: application/json" -X POST "https://mainnet.radixdlt.com/construction" | python -m json.tool
curl -d '{
  "method": "construction.build_transaction",
  "params": {
    "actions": [
      {
        "type": "CreateMutableSupplyToken",
        "publicKeyOfSigner": "02df4f2f252fbd6c432aae8d0e5e4d62746fbc781bd4fbcb200522a9e4437e31f9",
        "symbol": "gum",
        "name": "Bubblegum",
        "description": "With this token, you will never be all out of bubblegum.",
        "iconUrl": "https://www.roddysbubblegum.io/icon-gum-32x32.png",
        "tokenUrl": "https://www.roddysbubblegum.io/about-gum/"
      }
    ],
    "feePayer": "rdx1qspl7mgjqwgwqyjvy2tj8swe8a4lr6mxqdhwmn60cujl6a85mqh69eg37p9ph"
  },
  "id": 0
}' -H "Content-Type: application/json" -X POST "https://mainnet.radixdlt.com/construction" | python -m json.tool

This should build the transaction; now you just need to sign, finalize, and submit it. See Making Transactions to see how.

Minting and Burning

If you have created a mutable supply token, the address that created the token has the exclusive ability to mint or burn these tokens. Doing either is also done by a simple transaction, this time of action type MintTokens or BurnTokens. Here is what a build step of this might look like.

  • Mint tokens

  • Burn tokens

curl -d '{
  "method": "construction.build_transaction",
  "params": {
    "actions": [
      {
        "type": "MintTokens",
        "to": "rdx1qthu8yn06k75dnwpkysyl8smtwn0v4xy29auzjlcrw7vgduxvnwnst6derj",
        "rri": "gum_rrqwlcemvnlfze69q2ca0k6dvcxfcx6lgtxz7a2sp6mgcqrvfw6c"
        "amount": "1000000000000000000000"
      }
    ],
    "feePayer": "rdx1qspl7mgjqwgwqyjvy2tj8swe8a4lr6mxqdhwmn60cujl6a85mqh69eg37p9ph"
  },
  "id": 0
}' -H "Content-Type: application/json" -X POST "https://mainnet.radixdlt.com/construction" | python -m json.tool
curl -d '{
  "method": "construction.build_transaction",
  "params": {
    "actions": [
      {
        "type": "BurnTokens",
        "from": "rdx1qspl7mgjqwgwqyjvy2tj8swe8a4lr6mxqdhwmn60cujl6a85mqh69eg37p9ph",
        "rri": "gum_rrqwlcemvnlfze69q2ca0k6dvcxfcx6lgtxz7a2sp6mgcqrvfw6c"
        "amount": "1000000000000000000"
      }
    ],
    "feePayer": "rdx1qspl7mgjqwgwqyjvy2tj8swe8a4lr6mxqdhwmn60cujl6a85mqh69eg37p9ph"
  },
  "id": 0
}' -H "Content-Type: application/json" -X POST "https://mainnet.radixdlt.com/construction" | python -m json.tool

As before, this should build the transaction; now you just need to sign, finalize, and submit it. See Making Transactions to see how.