Transaction Metadata

For making a transaction with metadata, the transaction body should contain metadata. Transaction metadata must be a json object with top level integer key label. The fees for the transaction will be calculated based on the size of the metadata.

Sending ADA with metadata

The following example attaches metadata to the transaction that sends ADA to an address. The metadata consists of two information labeled to two keys.

{
"outputs": [
{
"address": "addr_test1qqmwpnc72ts9a7fw2trmc2syfy7khtjgrw9vh2cja3psp4lee858y3kj7qmn3pvfdtfgqjmj99nnypx2eysgx3wpafds78dunz",
"value": "3A"
}
],
"metadata": {
"0": {
"library": "Kuber",
"version": "2.0.0"
},
"1": "Send 5Ada to same address to create collateral"
}
}

View Resulting transaction


Minting an NFT with metadata

Similary, you can use the Kuber Playground Syntax to attach metadata to a minting transaction. Note When output is not provided while minting a token, the token will be sent to the same address that is used to mint the token.

{
"mint": [
{
"script": {
"type": "sig",
"keyHash": "8c4aca5edeef06f398e3ae885c9f449e02664d232aeb0f3860b269e4"
},
"amount": {
"test1": 1,
"test2": 2
}
}
],
"metadata": {
"721": {
"981a76013c22440ad5a7202d811f3a9eddd6e9bfa48523de5acfec53": {
"test1": {
"name": "Test1 NFT",
"image": "https://bit.ly/3xpjbJ9",
"artist": "Eternal",
"mediaType": "image/jpeg"
}
}
},
"20": {
"981a76013c22440ad5a7202d811f3a9eddd6e9bfa48523de5acfec53": {
"test2": {
"name": "Test2 Fungible Token",
"image": "https://bit.ly/3xpjbJ9",
"artist": "Eternal",
"mediaType": "image/jpeg"
}
}
}
}
}

View Resulting transaction


© 2023 Kuberide. All Rights Reserved.

Built withfrom 🇳🇵