Mint Native Tokens
You can use a node running the stardust update to mint
native tokens.
To do so, you will only need to add some funds to your account, define
the native token's options and call the Account.mint_native_token(native_token_options, options)
function.
Online Faucet
You can request test funds from the Shimmer Testnet Faucet.
Code Example
The following example will:
- Create an account manager.
- Get Alice's which was created in the first guide.
- Create the
NativeTokenOptions
. - Mint the native token by calling the
Account.mint_native_token(native_token_options, options)
function.
- Rust
- Nodejs
- Python
- Java
Dotenv
This example uses dotenv, which is not safe for use in production environments.
wallet/examples/09_mint_native_token.rs
loading...
Run the example by running the following command:
cargo run --example mint_native_token --release
wallet/bindings/nodejs/examples/22-mint-native-tokens.js
loading...
You can run the example by running the following command from the wallet/bindings/nodejs/examples/
folder:
node 22-mint-native-tokens.js
wallet/bindings/python/examples/7-mint-native-tokens.py
loading...
You can run the example by running the following command from the binding/python/examples
folder:
python3 7-mint-native-tokens.py
wallet/bindings/java/examples/src/MintNativeToken.java
loading...
Expected Output
- Rust
- Nodejs
- Python
- Java
Transaction: 0xaa9737fb4007e8b0f4c181d6923b0e3547ae178c23c25233985bb22f61c84de7
Block sent: http://localhost:14265/api/core/v2/blocks/0x807dbdde107008dcc9acae29a0e32c261590bef13e5f5d8d3bb60949e633abd8
Transaction ID: 0x4cd9cca67165b3ae5160e5b3bad5a677d93140e3692c378ed5c661160e37ce09
Synced:{
'baseCoin':{
'total':'3302230302',
'available':'3302230302'
},
'requiredStorageDeposit':'910310000',
'nativeTokens':[
{
'tokenId':'0x08b83d49922e341d2cb45159707cfafdc9dc8fdb9d119543480dbaa5773eed8c4a0100000000',
'total':'0x64',
'available':'0x64'
}
],
'nfts':[
'0x17f97185f80fa56eab974de6b7bbb80fa812d4e8e37090d166a0a41da129cebc',
'0xdc8be91d779aac048aa9001ab99ecf12cf62a4701185a95f6206a1a201bfbe7c',
'0x1e808b7c6e603aaeb5f718881a74fedae72981ac7d5f0294eb561cad0e653566',
'0x3f0e11e9d9f48a57d0fba43d7d1158ee673cb8055f80a5ce45ad174c962c0d8a',
'0x77133189021f50d8d66e0678e553af9f46a832a24239653d3555edb8dc859e1f',
'0xceae643ff7c112a3adce8f55f7953ba0707ade21256a7a09068c0b47f7c62c5b',
'0x1b670afba8d59a445cbaf167f1fda05879362e3ea034f5c4a0979fbeb5a3964b'
],
'aliases':[
'0xa5526c4a15558b709340822edf00cb348d8606a27e2e59b00432a0afe8afb74d',
'0xf9c702ffe50c35d331b2df02295c2cc6d92f883530ff231bd76d1f6a72cb1d95',
'0x97eb7a447cd62e1c373ff8188ba422f5c1b0687707d38e10e8366a1c20d33fea'
],
'foundries':[
],
'potentiallyLockedOutputs':{
'0x850c1e43dff1a28a42d71edc6d4ad0b9f251c03993f9b0684a34f645514ffe270000':False
}
}
Sent transaction:{
'tokenId':'0x08a5526c4a15558b709340822edf00cb348d8606a27e2e59b00432a0afe8afb74d0100000000',
'transaction':{
'payload':{
'type':6,
'essence':{
'type':1,
'networkId':'1856588631910923207',
'inputs':[
{
'type':0,
'transactionId':'0x8defcb4d5bc2dd45ca616b01d87399eef5bde2bfb4d9f33695a0cab78cb731f0',
'transactionOutputIndex':0
},
{
'type':0,
'transactionId':'0x0220b5247654d05529f40b3d8cdb7ca6f89627038f47a68aa578b9e675ddc937',
'transactionOutputIndex':29
},
{
'type':0,
'transactionId':'0x0220b5247654d05529f40b3d8cdb7ca6f89627038f47a68aa578b9e675ddc937',
'transactionOutputIndex':30
},
{
'type':0,
'transactionId':'0x0220b5247654d05529f40b3d8cdb7ca6f89627038f47a68aa578b9e675ddc937',
'transactionOutputIndex':31
}
],
'inputsCommitment':'0xeefde614b74d871154856ad4a8a53214492ee8859a3faef4cafa92afe36f12c5',
'outputs':[
{
'type':4,
'amount':'50300',
'aliasId':'0xa5526c4a15558b709340822edf00cb348d8606a27e2e59b00432a0afe8afb74d',
'stateIndex':1,
'stateMetadata':'0x',
'foundryCounter':1,
'unlockConditions':[
{
'type':4,
'address':{
'type':0,
'pubKeyHash':'0x8297ac4149c80cca8225e5f2da36df89a93cd2998d7f6d488c97250a881e65af'
}
},
{
'type':5,
'address':{
'type':0,
'pubKeyHash':'0x8297ac4149c80cca8225e5f2da36df89a93cd2998d7f6d488c97250a881e65af'
}
}
]
},
{
'type':5,
'amount':'53200',
'serialNumber':1,
'tokenScheme':{
'type':0,
'mintedTokens':'0x3e8',
'meltedTokens':'0x0',
'maximumSupply':'0x3e8'
},
'unlockConditions':[
{
'type':6,
'address':{
'type':8,
'aliasId':'0xa5526c4a15558b709340822edf00cb348d8606a27e2e59b00432a0afe8afb74d'
}
}
],
'immutableFeatures':[
{
'type':2,
'data':'0xab'
}
]
},
{
'type':3,
'amount':'98600',
'nativeTokens':[
{
'id':'0x08a5526c4a15558b709340822edf00cb348d8606a27e2e59b00432a0afe8afb74d0100000000',
'amount':'0x3e8'
}
],
'unlockConditions':[
{
'type':0,
'address':{
'type':0,
'pubKeyHash':'0x8297ac4149c80cca8225e5f2da36df89a93cd2998d7f6d488c97250a881e65af'
}
}
]
}
]
},
'unlocks':[
{
'type':0,
'signature':{
'type':0,
'publicKey':'0xe62838fda7e8b77bf80e49967f0f089ae2a7230547d5231649732952f6336fae',
'signature':'0x47578dd3a390483d4de390f5f6ccc7af5838a9b0fb1ba0c519948c0d8638b4c0b86d0676f5fa616d5fdae53fec0fdacef72248a92ac388d8a20134528949380c'
}
},
{
'type':1,
'reference':0
},
{
'type':1,
'reference':0
},
{
'type':1,
'reference':0
}
]
},
'blockId':'0x50e0b55c5e618e3cb214a774c9574522e5b30118bebdef6cbb23c9cffeb2b347',
'inclusionState':'Pending',
'timestamp':'1665917714656',
'transactionId':'0x9d1e61384fc78777c8db475a3d6eaec6465c136dc3ce586ee46a9453aa3dfdc4',
'networkId':'1856588631910923207',
'incoming':False,
'note':None
}
}
{
"tokenId": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0800000000",
"transaction": {
"payload": {
"type": 6,
"essence": {
"type": 1,
"networkId": "1856588631910923207",
"inputs": [
{
"type": 0,
"transactionId": "0x5cf6c0b12f8799cda57e0579a18fcba76722db9bb9b5d10e459489d391b1937a",
"transactionOutputIndex": 0
},
{
"type": 0,
"transactionId": "0x5cf6c0b12f8799cda57e0579a18fcba76722db9bb9b5d10e459489d391b1937a",
"transactionOutputIndex": 2
}
],
"inputsCommitment": "0xd4f7b69a209e311e525e488c41a6b77ecc895f90ffdd1832ba31556f453fdd18",
"outputs": [
{
"type": 4,
"amount": "50300",
"aliasId": "0x429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef",
"stateIndex": 13,
"stateMetadata": "0x",
"foundriesCounter": 0,
"unlockConditions": [
{
"type": 4,
"address": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
}
},
{
"type": 5,
"address": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
}
}
]
},
{
"type": 5,
"amount": "52800",
"serialNumber": 8,
"tokenScheme": {
"type": 0,
"mintedTokens": "0x20",
"meltedTokens": "0x0",
"maximumSupply": "0x45"
},
"unlockConditions": [
{
"type": 6,
"address": {
"type": 8,
"aliasId": "0x429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef"
}
}
]
},
{
"type": 3,
"amount": "2096320100",
"nativeTokens": [
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0100000000",
"amount": "0x3233"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0200000000",
"amount": "0x3233"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0400000000",
"amount": "0x17"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0600000000",
"amount": "0x20"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0700000000",
"amount": "0x20"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0800000000",
"amount": "0x20"
}
],
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
}
}
]
}
]
},
"unlocks": [
{
"type": 0,
"signature": {
"type": 0,
"publicKey": "0xde3152ce9d67415b9c5a042ea01caccc3f73ff1c0c77036874cb8badf9798d56",
"signature": "0x3c86bda5fd4e4f871a14920f7e630ec0cb8cbe7ccec03637441916b443a44c01ddc927459b6d20613025bd2a9e7f5afafd9cf1b2dbc979b128c6459de26da905"
}
},
{
"type": 1,
"reference": 0
}
]
},
"blockId": "0xccde79f09a527c755f8cc78132543e58e1a100b19efc2a2ab5acc6525cd660f2",
"inclusionState": "Pending",
"timestamp": "1664896472744",
"transactionId": "0xf323167737a556fcfcfa9da0248fc39aa344c275484a6f224769d2379ca49352",
"networkId": "1856588631910923207",
"incoming": false
}
}