Skip to main content

Mint tokens

Minting tokens.

Parameters

  • x-wallet-id: Wallet identifier.
  • token: UID of the token to mint.
  • amount: The amount of tokens to mint. It must be an integer with the value in cents, i.e., 123 means 1.23.

Optional Parameters

  • address: Destination address of minted tokens. If not informed, the next available wallet address is used.
  • change_address: Optional address to send the change amount.

Request

curl -X POST -H "X-Wallet-Id: default-wallet" -H "Content-type: application/json" \
--data '{"token": "008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904", "address": "WVLqNPWmX1t2y1LcGCXF1etCV9TLZnPfw4", "amount": 50}' \
http://localhost:8000/wallet/mint-tokens

Note that if the token to be minted has been created from the /wallet/create-token endpoint, the UID is taken from the hash property of its respective response. The next JSON is a summarized view of the response obtained from such an endpoint after creating the Test Coin token; the hash property value is being used to mint tokens via /wallet/mint-tokens.

{
"success":true,
"inputs":[+],
"outputs":[+],
"version":2,
"weight":8.000001,
"nonce":93,
"timestamp":1659462507,
"parents":[
"0000000058d6c4ad93fa66dcfb8cc297c091f90023b8ef79e5850294f8f3b4ee",
"00e24901f37100ae3794c5838b18bb3946f3b863174e5421ed6c1081b783e045"
],
"hash":"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904",
"_dataToSignCache":null,
"name":"Test Coin",
"symbol":"TSC"
}

Response

The data attribute value has been replaced by the "+" symbol to make the JSON easier to visualize.

{
"success":true,
"inputs":[
{
"hash":"00733efee7c7e9551b0bf440c5f95bf7dbcf3aec814f49a14a593385c0ab9df9",
"index":1,
"data":{
"type":"Buffer",
"data":[+]
},
"tx_id":"00733efee7c7e9551b0bf440c5f95bf7dbcf3aec814f49a14a593385c0ab9df9"
},
{
"hash":"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904",
"index":1,
"data":{
"type":"Buffer",
"data":[+]
},
"tx_id":"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904"
}
],
"outputs":[
{
"value":52,
"script":{
"type":"Buffer",
"data":[+]
},
"tokenData":0,
"decodedScript":null,
"token_data":0
},
{
"value":50,
"script":{
"type":"Buffer",
"data":[+]
},
"tokenData":1,
"decodedScript":null,
"token_data":1
},
{
"value":1,
"script":{
"type":"Buffer",
"data":[+]
},
"tokenData":129,
"decodedScript":null,
"token_data":129
}
],
"version":1,
"weight":8.000001,
"nonce":528,
"timestamp":1659462833,
"parents":[
"0058bab684a6c37df960af46941d78fa89ea5213f4fa3c9cb672c28f6ca7645d",
"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904"
],
"tokens":[
"008a62793ccd07bd21c7d9b2c20f718d1545911130e74da2c78b932f5fec6904"
],
"hash":"005833c313262544d996fc9c8634454dbd56eb2a11d3a9e17e34fa0f58cdc4fc",
"_dataToSignCache":null
}