XION
DiscordGithub
  • Welcome to XION
  • XION'S Core
    • Concepts
      • Generalized Chain Abstraction
      • Intro to Account Abstraction
      • XION's Meta Accounts
      • Meta Accounts Design
      • Architecture & Tech Glossary
      • Use Cases
  • developers
    • XION Quick Start
      • Zero to App in 5 Minutes
        • Launch a User Map App on XION in 5 Minutes
        • React Native Mobile App on XION in 5 Minutes
    • Mobile App Development
      • Set up your XION Mobile Development Environment
      • Create Mobile App and Integrate Meta Account Authentication
      • Building a React Native Mobile App with Abstraxion (Xion.js)
    • Getting Started (Advanced)
      • Set Up Local Environment
        • Setting up your Local Smart Contract Development Environment for XION
          • Setting up your XION Smart Contract Development Environment on Windows (WSL2 + Ubuntu)
        • Set Up an Integrated Development Environment (IDE)
        • Interacting with Xion Chain using Xion Daemon
      • Your First Contract
        • Deploying Your First Smart Contract on XION
      • Gasless UX & Permission Grants
        • Enabling Gasless Transactions with Treasury Contracts
      • App Development
        • Account Abstraction with Gasless Transactions
        • Interact with XION via your Backend Service
    • Re-using Existing Contracts
      • Deployed Contracts on XION
      • Non-Fungible Tokens (NFTs)
      • Fungible Tokens
      • Marketplace
      • Multisig
      • Proxy Contracts
      • Membership Management
      • Governance
      • Valuts
      • SCV Audited Contracts
    • Web3 for Web2 Developers
      • Web2 vs Web3 App Architecture: A Comparison
      • Misconceptions and Misapplied Web2 Patterns
      • Recommended Architecture for Apps on XION
    • Building for Mainnet
      • Xion Testnet: Your Development Playground
      • Building with Audited & Battle-Tested Contracts
      • Community Engagement: Building Support for Your app
      • Deploying to Xion Mainnet
        • Smart Contract Audits: Process, Costs & Support
        • Governance Process to Deploying Smart Contracts to Mainnet
    • Learn & Build
      • Token Factory
        • Creating, Minting, and Interacting with a Token Factory Token
        • Building a React dApp to Interact with Token Factory Tokens
        • Integrating a Token Factory Token in a Smart Contract
      • Websockets
        • WebSockets with Xion: Real-Time Communication
      • Oracles
        • Creating a Smart Contract with Pyth Oracle Integration
      • Indexers: Optimized Data Retrieval
        • SubQuery
      • Use Cases
        • Building a Per-User Data Storage App
        • Build a TODO App using the Collection-Document Storage Smart Contract
      • Crossmint Integration
        • Crossmint Digital Collectibles Checkout via Credit Card
    • Reference and Resources
      • Requesting XION Testnet Tokens
      • Public Endpoints & Resources
      • Block Explorers
      • Governance
        • Deploying Smart Contracts to Mainnet
      • Developer Tools: Abstract
      • IBC Denoms on XION Networks
      • Frequently Asked Questions
      • XION Token Contract Addresses on EVM Chains
  • Nodes & Validators
    • Run a Node
      • System Specifications
      • Build the Xion Daemon
      • Download the Xion Daemon
      • Configure the Xion Daemon
        • app.toml
        • client.toml
        • config.toml
      • Join the XION Network
        • xion-testnet-1
      • Confirm node is running
    • Become a Validator
      • Initial Setup
      • Obtain a XION Wallet Address
      • Obtain Funds
        • Testnet
      • Create Validator
    • IBC Relayers and Tokens
  • Others
    • Resources
Powered by GitBook
On this page
  • Prerequisites
  • Creating a Token
  • Querying Token Data
  • Updating Token Metadata
  • Minting Tokens
  • Querying Token Balance
  • Sending Tokens to Another Address

Was this helpful?

Edit on GitHub
  1. developers
  2. Learn & Build
  3. Token Factory

Creating, Minting, and Interacting with a Token Factory Token

PreviousToken FactoryNextBuilding a React dApp to Interact with Token Factory Tokens

Last updated 11 days ago

Was this helpful?

The Token Factory module provides a simple framework for creating and managing custom native tokens. It allows users to create, mint, distribute and interact with their own tokens seamlessly. Each token is uniquely tied to its creator’s address and follows the standardized format factory/{creator address}/{subdenom}.

The module is particularly useful for developers and projects looking to issue chain-native assets without the complexity of deploying custom smart contracts. Regardless of the token’s intended use the Token Factory streamlines the entire lifecycle, ensuring a secure and scalable approach to token management on XION.

Prerequisites

Before proceeding, make sure you have the following:

  1. XION Daemon (xiond) Installed: Ensure that xiond is installed on your system. If not, follow the guide to set it up.

  2. An Active Account: Set up an account using xiond by following the guide. You will use this account to execute transactions.

  3. A Funded Account: You need an account with sufficient native XION tokens to cover transaction fees. You can obtain testnet tokens through the .

Creating a Token

Creating a new Token Factory token requires a 1000 XION fee (on both Testnet and Mainnet). This fee protects XION users by:

  • Reducing spam and malicious token creation.

  • Encouraging meaningful token projects, ensuring a higher-quality ecosystem.

To create a new token using the Token Factory module, you would execute the following command:

xiond tx tokenfactory create-denom <your-denom> --from <wallet-name> --chain-id <chain-id> --node <node> --gas auto --gas-adjustment <gas-adjustment> --gas-prices <gas-prices> 

Parameters:

  • <your-denom> – The unique token name (e.g., customtoken).

  • <wallet-name> – Your configured wallet name in xiond.

  • <chain-id> – The chain ID of the XION network.

  • <node> – The ID or address of the blockchain node you are connecting to.

  • --gas auto – Automatically estimates the gas required for the transaction.

  • <gas-adjustment> – Adjusts the estimated gas amount by 30% to account for possible variations in actual consumption.

  • <gas-prices> – The fee rate for gas in uxion (the smallest unit of XION).

Example:

xiond tx tokenfactory create-denom mytoken --from mywallet --chain-id xion-testnet-2 --node https://rpc.xion-testnet-2.burnt.com:443 --gas auto --gas-prices 0.025uxion

The following is an example of the initial output:

gas estimate: 2091194
auth_info:
  fee:
    amount:
    - amount: "52280"
      denom: uxion
    gas_limit: "2091194"
    granter: ""
    payer: ""
  signer_infos: []
  tip: null
body:
  extension_options: []
  memo: ""
  messages:
  - '@type': /osmosis.tokenfactory.v1beta1.MsgCreateDenom
    sender: xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r
    subdenom: emp
  non_critical_extension_options: []
  timeout_height: "0"
signatures: []
confirm transaction before signing and broadcasting [y/N]:

After typing y and pressing Enter, you may see the following output:

code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: ""
timestamp: ""
tx: null
txhash: 4AC13595B2E92DD5D9B27111E71B34D598E2C19EFE7865602C3110FDEA3676F3

Upon successful execution, a unique token will be created with a denomination formatted as:

factory/<creator-address>/mytoken

Querying Token Data

After creating a token, you may want to verify its metadata and check its initial state on the blockchain. This can be done using the denom-metadata query within the bank module, which retrieves essential details about the token, including its base denomination, display name, and symbol.

To query the token data, run the following command:

xiond query bank denom-metadata factory/<creator-address>/<denom> --node <rpc-endpoint>

Example:

xiond query bank denom-metadata factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp --node https://rpc.xion-testnet-2.burnt.com:443

Example Output:

metadata:
  base: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
  denom_units:
  - denom: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
  display: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
  name: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
  symbol: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp

Understanding the Output:

  • base – The full unique identifier of the token.

  • denom_units – The denomination structure for different decimal representations.

  • display – The default way the token is displayed in applications.

  • name – The registered name of the token.

  • symbol – The token’s ticker symbol (if set during metadata configuration).

Updating Token Metadata

Before minting new tokens, it is important to configure the token’s metadata to ensure frontends and apps can properly query and display token information and to set the required decimal precision to be used by the token.

Updatable Fields:

  • ticker-symbol – The short symbol representing the token (e.g., XION).

  • description – A brief description of the token.

  • exponent – The decimal precision used for display purposes.

To update the token metadata, run the following command:

xiond tx tokenfactory modify-metadata <denom> <ticker-symbol> <description> <exponent> --from <wallet-name> --chain-id <chain-id> --node <node> --gas auto --gas-adjustment <gas-adjustment> --gas-prices <gas-prices>

Example:

xiond tx tokenfactory modify-metadata factory/xion1xyz.../mytoken MYT "My custom token" 6 --from mywallet --chain-id xion-testnet-2 --node tcp://127.0.0.1:26657 --gas auto --gas-adjustment 1.7 --gas-prices 0.025uxion

This command updates the metadata for the mytoken token, setting:

  • Ticker Symbol → MYT

  • Description → "My custom token"

  • Exponent → 6 (indicating 6 decimal places for display)

The following is an example of the initial output:

gas estimate: 68088
auth_info:
  fee:
    amount:
    - amount: "1703"
      denom: uxion
    gas_limit: "68088"
    granter: ""
    payer: ""
  signer_infos: []
  tip: null
body:
  extension_options: []
  memo: ""
  messages:
  - '@type': /osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata
    metadata:
      base: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
      denom_units:
      - aliases:
        - EMP
        denom: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
        exponent: 0
      - aliases:
        - factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
        denom: EMP
        exponent: 6
      description: My custom token
      display: EMP
      name: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
      symbol: EMP
      uri: ""
      uri_hash: ""
    sender: xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r
  non_critical_extension_options: []
  timeout_height: "0"
signatures: []
confirm transaction before signing and broadcasting [y/N]: 

After typing y and pressing Enter, you may see the following output:

code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: ""
timestamp: ""
tx: null
txhash: 9583BEC1A62884395E466C190B1A5B3DE5EC152D0CE875BCBDE3DD333BB9E0C9

You can then query the metadata to see the updates:

xiond query bank denom-metadata factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp --node https://rpc.xion-testnet-2.burnt.com:443

Possible Output:

metadata:
  base: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
  denom_units:
  - aliases:
    - EMP
    denom: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
  - aliases:
    - factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
    denom: EMP
    exponent: 6
  description: My custom token
  display: EMP
  name: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
  symbol: EMP

Minting Tokens

After successfully creating your token, you will notice that no tokens have actually been minted. To establish or increase the token supply, you must explicitly mint new tokens. The minting process allows you to generate additional tokens under your control, which can then be used within your apps, or distributed to other accounts.

To mint tokens, execute the following command:

xiond tx tokenfactory mint <amount><denom> --from <wallet-name> --chain-id <chain-id> --node <node> --gas auto --gas-adjustment <gas-adjustment> --gas-prices <gas-prices>

Parameters:

  • <amount> – The quantity of tokens to mint.

  • <denom> – The full denomination (including factory/<creator-address>/<denom>).

  • <wallet-name> – Your configured wallet name.

  • <chain-id> – The chain ID of the XION network.

  • <node> – The ID or address of the blockchain node you are connecting to.

  • --gas auto – Automatically estimates the gas required for the transaction.

  • <gas-adjustment> – Adjusts the estimated gas amount by 30% to account for possible variations in actual consumption.

  • <gas-prices> – The fee rate for gas in uxion (the smallest unit of XION).

Example:

xiond tx tokenfactory mint 1000000000000factory/xion1xyz.../mytoken --from mywallet --chain-id xion-testnet-2 --node https://rpc.xion-testnet-2.burnt.com:443 --gas auto --gas-adjustment 1.5 --gas-prices 0.025uxion

The following is an example of the initial output:

gas estimate: 95267
auth_info:
  fee:
    amount:
    - amount: "2382"
      denom: uxion
    gas_limit: "95267"
    granter: ""
    payer: ""
  signer_infos: []
  tip: null
body:
  extension_options: []
  memo: ""
  messages:
  - '@type': /osmosis.tokenfactory.v1beta1.MsgMint
    amount:
      amount: "1000000000000"
      denom: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
    mintToAddress: ""
    sender: xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r
  non_critical_extension_options: []
  timeout_height: "0"
signatures: []
confirm transaction before signing and broadcasting [y/N]: 

After typing y and pressing Enter, you may see the following output:

code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: ""
timestamp: ""
tx: null
txhash: BDB5A322400076D14C831497407AF1026D6A3DD923EF1E36366C0ED0C3D5ECE1

If your exponent was set to 6, then 1000000000000 would mint 1 million mytoken tokens since the exponent determines how many decimal places the token uses.

Querying Token Balance

Once you have minted or received tokens, you may want to check your wallet’s balance to see the amount of native XION, custom tokens, and IBC-transferred assets you hold. The bank balance query allows you to retrieve a complete breakdown of all tokens associated with your address.

To check the token balances for an account execute:

xiond q bank balances <your-address> --node <node>

Example:

xiond q bank balances xion1xyz... --node https://rpc.xion-testnet-2.burnt.com:443

The following is an example of the output, with factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp as the custom token:

balances:
- amount: "1000000000000"
  denom: factory/xion1ka5gdcv4m7kfzxkllapqdflenwe0fv8ftm357r/emp
- amount: "201000000000"
  denom: ibc/57097251ED81A232CE3C9D899E7C8096D6D87EF84BA203E12E424AA4C9B57A64
- amount: "4903089571"
  denom: uxion
pagination:
  total: "3"

Sending Tokens to Another Address

Once you have minted tokens, you may want to transfer them to another wallet, whether for payments, rewards, or distribution to users. The bank send transaction allows you to send your custom tokens (or any other assets in your wallet) to another address on the XION blockchain.

To send tokens, use the following command:

xiond tx bank send <your-address> <recipient-address> <amount><denom> --node <node> --from <wallet-name> --chain-id <chain-id> --gas auto --gas-adjustment <gas-adjustment> --gas-prices <gas-prices>

Parameter Breakdown:

  • <your-address> – The sender’s wallet address.

  • <recipient-address> – The recipient’s wallet address.

  • <amount> – The number of tokens to send.

  • <denom> – The full token denomination, including the factory/{creator-address}/{denom} prefix.

  • <node> – The RPC node used to broadcast the transaction.

  • <wallet-name> – The name of your configured wallet in xiond.

  • <chain-id> – The XION network’s chain ID.

  • --gas auto – Enables automatic gas estimation.

  • <gas-adjustment> – Adjusts the estimated gas usage (e.g., 1.5 for 50% buffer).

  • <gas-prices> – Sets the gas fee rate in uxion.

Example: Sending 500 mytoken Tokens

xiond tx bank send xion1ka5... xion193h... 500factory/xion1ka5.../mytoken --node https://rpc.xion-testnet-2.burnt.com:443 --from mywallet --chain-id xion-testnet-2 --gas auto --gas-adjustment 1.5 --gas-prices 0.025uxion

What Happens?

  • This transfers 500 mytoken tokens from the sender (xion1ka5...) to the recipient (xion193h...).

  • The transaction is broadcasted to the network via the specified RPC node.

  • If successful, the recipient’s balance is updated, and the sender’s balance is reduced accordingly.

You have successfully created, updated, minted and transferred a token using the XION Token Factory module. With this foundation, you can now integrate your token into your smart contracts and app frontends seamlessly.

Setting up your Local Development Environment
Generate an account
XION testnet faucet