Create Native Tokens
The stardust update allows you to create your own native tokens Native tokens are minted by a so-called Foundry. The Foundry allows you to specify a max supply once and change the circulating supply.
You can also specify some custom metadata in the foundry output or follow a standard like IRC30. To create a Foundry you need an Alias Output which owns it. This Alias Output only needs to be generated once and can own multiple foundries.
Online Faucet
You can request test funds from the Shimmer Testnet Faucet.
Example Code
- Rust
- Typescript (Node.js)
- Python
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Check the account's balance for an
Alias Output
it can use to create the native tokens. If the account doesn't have any, it will create one.
- Define the
CreateNativeTokenParams
.
- Create the native token using the
Account.create_native_token()
function.
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Check the account's balance for an
Alias Output
it can use to create the native tokens. If the account doesn't have any, it will create one.
- Define
Irc30Metadata
and theCreateNativeTokenParams
.
- Prepare the transaction that will create the native token using the
Account.prepareCreateNativeToken()
function and send the prepared transaction using theAccount.send()
function.
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Check the account's balance for an
Alias Output
it can use to create the native tokens. If the account doesn't have any, it will create one.
- Define the
CreateNativeTokenParams
.
- Prepare the transaction that will create the native token using the
Account.prepare_create_native_token()
function and send the prepared transaction using theAccount.send()
function.
Full Example Code
- Rust
- Typescript (Node.js)
- Python
sdk/examples/how_tos/native_tokens/create.rs
loading...
bindings/nodejs/examples/how_tos/native_tokens/create.ts
loading...
bindings/python/examples/how_tos/native_tokens/create.py
loading...
Expected Output
Transaction sent: 0x3e7fe86a2b01a7006fe037249be51852d298d32df69507140d3b41c1a6d7fb90
Block included: https://explorer.shimmer.network/testnet/block/0xca4f8150014bc548214be6b02bed3b7d43041adef8838965815a367f73c7272d
Account synced
Preparing transaction to create native token...
Transaction sent: 0xcfc5ffae0c7be8cfb7c334d6f6bb39a2ddff612c9a9048c88e3d9158f7cc4832
Block included: https://explorer.shimmer.network/testnet/block/0x558c0dcede60609bbb641e9f1d9a7802b48a3c3d5827328a054385140d447436
Created token: 0x089dc1b964591b15819ef1912fab48c001fed4558b37766dfa5daa512495d5b25a0100000000
Account synced