Skip to main content

Creating a Token

The process for creating a token differs slightly from chain to chain. Below, you can find instructions for creating a token on Neutron, Injective, Sei, and Terra.

Once you've created your token, create a pool and seed liquidity!

Neutron

Overview

The tokenfactory module allows any account to create a new token with the name factory/{creator address}/{subdenom}. Because tokens are namespaced by creator address, this allows token minting to be permissionless, due to not needing to resolve name collisions. A single account can create multiple denoms, by providing a unique subdenom for each created denom. Once a denom is created, the original creator is given "admin" privileges over the asset. This allows them to:

  • Mint their denom to any account
  • Burn their denom from any account
  • Create a transfer of their denom between any two accounts
  • Change the admin In the future, more admin capabilities may be added. Admins can choose to share admin privileges with other accounts using the authz module. The ChangeAdmin functionality, allows changing the master admin account, or even setting it to "", meaning no account has admin privileges of the asset.

Messages

CreateDenom

Creates a denom of factory/{creator address}/{subdenom} given the denom creator address and the subdenom. Subdenoms can contain [a-zA-Z0-9./].


_4
message MsgCreateDenom {
_4
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
_4
string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ];
_4
}

State Modifications:

  • Fund community pool with the denom creation fee from the creator address, set in Params
  • Set DenomMetaData via bank keeper
  • Set AuthorityMetadata for the given denom to store the admin for the created denom factory/{creator address}/{subdenom}. Admin is automatically set as the Msg sender
  • Add denom to the CreatorPrefixStore, where a state of denoms created per creator is kept

Mint

Minting of a specific denom is only allowed for the creator of the denom registered during CreateDenom


_7
message MsgMint {
_7
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
_7
cosmos.base.v1beta1.Coin amount = 2 [
_7
(gogoproto.moretags) = "yaml:\"amount\"",
_7
(gogoproto.nullable) = false
_7
];
_7
}

State Modifications:

  • Safety check the following
    • Check that the denom minting is created via tokenfactory module
    • Check that the sender of the message is the admin of the denom
  • Mint designated amount of tokens for the denom via bank module

Burn

Burning of a specific denom is only allowed for the creator of the denom registered during CreateDenom


_7
message MsgBurn {
_7
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
_7
cosmos.base.v1beta1.Coin amount = 2 [
_7
(gogoproto.moretags) = "yaml:\"amount\"",
_7
(gogoproto.nullable) = false
_7
];
_7
}

  • Saftey check the following
    • Check that the denom minting is created via tokenfactory module
    • Check that the sender of the message is the admin of the denom
  • Burn designated amount of tokens for the denom via bank module

Injective

Download injectived

Download the injectived binary here.

Create a key


_1
injectived keys add gov

NOTE

The commands below refer to testnet. In order to use mainnet, make the following changes to all commands:

injective-888 > injective-1

https://testnet.tm.injective.network:443 > http://tm.injective.network:443

Create a tokenfactory denom


_1
injectived tx tokenfactory create-denom ak --from=gov --chain-id=injective-888 --node=https://testnet.tm.injective.network:443 --gas-prices=500000000inj --gas 1000000

NOTE
  1. In order to create a tokenfactory denom, you must pay 10 INJ.
  2. Tokens are namespaced by the creator address to be permissionless and avoid name collision. In the example above, the subdenom is ak but the denom naming will be factory/{creator address}/{subdenom}.

Submit token metadata

By submitting the token metadata, your token will be visible on Injective dApps.


_4
injectived tx tokenfactory set-denom-metadata "My Token Description" 'factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak' AKK AKCoin AK '[
_4
{"denom":"factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak","exponent":0,"aliases":[]},
_4
{"denom":"AKK","exponent":6,"aliases":[]}
_4
]' --from=gov --chain-id=injective-888 --node=https://testnet.tm.injective.network:443 --gas-prices=500000000inj --gas 1000000

NOTE

This command expects the following arguments:


_1
injectived tx tokenfactory set-denom-metadata [description] [base] [display] [name] [symbol] [denom-unit (json)]

Mint tokens


_1
injectived tx tokenfactory mint 1000000factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak --from=gov --chain-id=injective-888 --node=https://testnet.tm.injective.network:443 --gas-prices=500000000inj --gas 1000000

NOTE

This command will mint 1 token, assuming your token has 6 decimals. Normally, ERC-20 tokens have 18 decimals and native Cosmos tokens have 6 decimals.

Burn tokens


_1
injectived tx tokenfactory burn 1000000factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak --from=gov --chain-id=injective-888 --node=https://testnet.tm.injective.network:443 --gas-prices=500000000inj --gas 1000000

NOTE

This command will burn 1 token.

Change admin


_1
injectived tx tokenfactory change-admin factory/inj17vytdwqczqz72j65saukplrktd4gyfme5agf6c/ak NEW_ADDRESS --from=gov --chain-id=injective-888 --node=https://testnet.tm.injective.network:443 --gas-prices=500000000inj --gas 1000000

NOTE

This command will change the admin address, the new admin can mint, burn or change token metadata.

Sei

Overview

The tokenfactory module allows any account to create a new token with the name factory/${CREATOR_ADDRESS}/${SUBDENOM} in a permissionless fashion.

For more details on how to interact with tokenfactory module via wasm please reference the sei-cosmwasm package and its associated Tokenfactory bindings.

See this tutorial for an example sdk.Coin creation using the tokenfactory module.

Creating a Denom


_1
seid tx tokenfactory create-denom $SUBDENOM --from $ACCOUNT --chain-id $CHAIN_ID

This will create a new coin of the form factory/${CREATOR_ADDRESS}/${SUBDENOM}

Minting

NOTE: Minting is only possible from the creator address account


_1
seid tx tokenfactory mint $AMOUNT --from $ACCOUNT --chain-id $CHAIN_ID

$AMOUNT for example includes 100sei

Once minted, consider a bank send to send the tokens to another address

Burning

NOTE: Burning is only possible from the creator address account


_1
seid tx tokenfactory burn $AMOUNT --from $ACCOUNT --chain-id $CHAIN_ID

Terra

Terra uses a CW20 token factory. This allows any Cosmos SDK address (including a contract) to mint a new fungible token. To learn how to create a new CW20 token, visit here.