Mint NFTs
Online Faucet
You can request test funds from the Shimmer Testnet Faucet.
You can use a node running the stardust update to mint
non-fungible tokens (NFTs).
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_nfts(nft_options, options)
function.
Iota.js
You can also find this guide in the native iota.js library
Code Example
The following example will:
- Create an account manager.
- Get Alice's which was created in the first guide.
- Create the
NftOptions
. - Mint the NFT by calling the
Account.mint_nfts(nft_options, options)
function.
- Rust
- Nodejs
- Python
- Java
Dotenv
This example uses dotenv, which is not safe for use in production environments.
wallet/examples/10_mint_nft.rs
loading...
Run the example by running the following command:
cargo run --example mint_nft --release
wallet/bindings/nodejs/examples/25-mint-nft.js
loading...
You can run the example by running the following command from the wallet/bindings/nodejs/examples/
folder:
node 25-mint-nft.js
wallet/bindings/python/examples/8-mint-nft.py
loading...
You can run the example by running the following command from the binding/python/examples
folder:
python3 8-mint-nft.py
wallet/bindings/java/examples/src/MintNft.java
loading...
Expected Output
- Rust
- Nodejs
- Python
- Java
Transaction: 0x0ba6e5d164f4c5ba0e16d9ba42852fa9fa19989956632444fe3ef0bf9d12737c
Block sent: http://localhost:14265/api/core/v2/blocks/0x7d9e46cd59119c6b00f2affd88fe497276b5f6f97874e2ca42e4dae9651d1be2
Transaction: 0xf99a245889f942084b6d9d216c61f2dcb42b6b14fb595bdc92322e87caaa6bbc
Block sent: http://localhost:14265/api/core/v2/blocks/0xce3b0f453f935288356bbfdc43f217b29e3a0ff1f7f08459d08e091c941da4b4
{
payload: {
type: 6,
essence: {
type: 1,
networkId: '1856588631910923207',
inputs: [Array],
inputsCommitment: '0x086739a754bd6e9bd74f6242aaa354a46ee3615ad74a33caab84f0b0621e4885',
outputs: [Array]
},
unlocks: [ [Object] ]
},
blockId: '0xabe9f275b86ce75dbe64a6868b13eb27d362f27a968f361b888ac9f2423eb7ca',
inclusionState: 'Pending',
timestamp: '1663000060038',
transactionId: '0x2db9d3348abc98b59e8a8f68c3f6243300facc47fd2e005fd28878f295316fe9',
networkId: '1856588631910923207',
incoming: false,
note: null
}
Check your block on http://localhost:14265/api/core/v2/blocks/0xabe9f275b86ce75dbe64a6868b13eb27d362f27a968f361b888ac9f2423eb7ca
Synced:{
'baseCoin':{
'total':'3302125202',
'available':'3302125202'
},
'requiredStorageDeposit':'910154600',
'nativeTokens':[
{
'tokenId':'0x08b83d49922e341d2cb45159707cfafdc9dc8fdb9d119543480dbaa5773eed8c4a0100000000',
'total':'0x64',
'available':'0x64'
},
{
'tokenId':'0x08a5526c4a15558b709340822edf00cb348d8606a27e2e59b00432a0afe8afb74d0100000000',
'total':'0x3de',
'available':'0x3de'
}
],
'nfts':[
'0xceae643ff7c112a3adce8f55f7953ba0707ade21256a7a09068c0b47f7c62c5b',
'0x1b670afba8d59a445cbaf167f1fda05879362e3ea034f5c4a0979fbeb5a3964b',
'0x1e808b7c6e603aaeb5f718881a74fedae72981ac7d5f0294eb561cad0e653566',
'0x3f0e11e9d9f48a57d0fba43d7d1158ee673cb8055f80a5ce45ad174c962c0d8a',
'0xdc8be91d779aac048aa9001ab99ecf12cf62a4701185a95f6206a1a201bfbe7c',
'0x77133189021f50d8d66e0678e553af9f46a832a24239653d3555edb8dc859e1f'
],
'aliases':[
'0xf9c702ffe50c35d331b2df02295c2cc6d92f883530ff231bd76d1f6a72cb1d95',
'0xa5526c4a15558b709340822edf00cb348d8606a27e2e59b00432a0afe8afb74d',
'0x96717e6d19c13b1c5b120d60b23217f541b5b779e51212e01d72e7fa1f7090cf',
'0x97eb7a447cd62e1c373ff8188ba422f5c1b0687707d38e10e8366a1c20d33fea'
],
'foundries':[
'0x08a5526c4a15558b709340822edf00cb348d8606a27e2e59b00432a0afe8afb74d0100000000'
],
'potentiallyLockedOutputs':{
'0x850c1e43dff1a28a42d71edc6d4ad0b9f251c03993f9b0684a34f645514ffe270000':False,
'0x9a5869b61b29f17326e04b6161d9cd169687e79476c556bd0c3cbbc3648d4ff60000':False
}
}
Sent transaction:{
'payload':{
'type':6,
'essence':{
'type':1,
'networkId':'1856588631910923207',
'inputs':[
{
'type':0,
'transactionId':'0x0220b5247654d05529f40b3d8cdb7ca6f89627038f47a68aa578b9e675ddc937',
'transactionOutputIndex':33
},
{
'type':0,
'transactionId':'0x0220b5247654d05529f40b3d8cdb7ca6f89627038f47a68aa578b9e675ddc937',
'transactionOutputIndex':34
}
],
'inputsCommitment':'0x0bfe4956fc30fae1ebba021e99506bf38df9ba8297d569185bb3779219ad7bb9',
'outputs':[
{
'type':6,
'amount':'48900',
'nftId':'0x0000000000000000000000000000000000000000000000000000000000000000',
'unlockConditions':[
{
'type':0,
'address':{
'type':0,
'pubKeyHash':'0x8297ac4149c80cca8225e5f2da36df89a93cd2998d7f6d488c97250a881e65af'
}
}
],
'immutableFeatures':[
{
'type':2,
'data':'0x736f6d6520696d6d757461626c65206e6674206d65746164617461'
}
]
},
{
'type':3,
'amount':'52300',
'unlockConditions':[
{
'type':0,
'address':{
'type':0,
'pubKeyHash':'0x8297ac4149c80cca8225e5f2da36df89a93cd2998d7f6d488c97250a881e65af'
}
}
]
}
]
},
'unlocks':[
{
'type':0,
'signature':{
'type':0,
'publicKey':'0xe62838fda7e8b77bf80e49967f0f089ae2a7230547d5231649732952f6336fae',
'signature':'0x6abc61aafa97c377ed739043c724d7336d2f6aef37962b14b21a3173b2ca48e683aee0c86326d4ae3542465237fbf4d90917fbbed0704362e176dbbc6eb3560f'
}
},
{
'type':1,
'reference':0
}
]
},
'blockId':'0x3209a72083c0b3cd5e19106cda5155f7387b54667aa81b225ab4a467b9ccd175',
'inclusionState':'Pending',
'timestamp':'1665918633606',
'transactionId':'0x25ddb61de4422f1df52286647517e5e1db8b1a7925ce3323bbf4533bbd3a7487',
'networkId':'1856588631910923207',
'incoming':False,
'note':None
}
{
"payload": {
"type": 6,
"essence": {
"type": 1,
"networkId": "1856588631910923207",
"inputs": [
{
"type": 0,
"transactionId": "0xa022ebf66347c966f9b74660b7e65ecf561497a002339d057d91e7390e73fcd6",
"transactionOutputIndex": 2
}
],
"inputsCommitment": "0xce87842bfde0a55f96b968f28888c1bf1259b9039498e1060fd8e12015f630a6",
"outputs": [
{
"type": 6,
"amount": "52000",
"nftId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
}
}
],
"features": [
{
"type": 2,
"data": "0x5368696d6d65722e20546f6b656e697a652045766572797468696e672e2048656c6c6f2066726f6d20746865204a6176612062696e64696e672e"
}
]
},
{
"type": 3,
"amount": "2096582500",
"nativeTokens": [
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0100000000",
"amount": "0x3233"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0200000000",
"amount": "0x3233"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0300000000",
"amount": "0x17"
},
{
"id": "0x08429fe5864378ce70699fc2d22bb144cb86a3c4833d136e3b95c5dadfd6ba0cef0400000000",
"amount": "0x17"
}
],
"unlockConditions": [
{
"type": 0,
"address": {
"type": 0,
"pubKeyHash": "0x4cfde0600797ae07d19d67d78910e70950bfdaf716f0035e9a30b97828aaf6a2"
}
}
]
}
]
},
"unlocks": [
{
"type": 0,
"signature": {
"type": 0,
"publicKey": "0xde3152ce9d67415b9c5a042ea01caccc3f73ff1c0c77036874cb8badf9798d56",
"signature": "0x836935b75006582e64d985e346d14ed081aaaa76f6a517cb7528824f87853c1c993fdeb53405c62196539c2cf195c3568571d97b3f57a42f3922b07b98ae3506"
}
}
]
},
"blockId": "0xc7d0dedd9e491fabd826365dfb51d5a675b5db61d6891fa024d27f59ba0ba4c2",
"inclusionState": "Pending",
"timestamp": "1664306373802",
"transactionId": "0x87f0eeca7a4fd8706a4f57c5b440c2a1d190254a967e1e678d3e132c9dd44e14",
"networkId": "1856588631910923207",
"incoming": false
}