api_token - UCHAIN-WORLD/uchain-fullnode GitHub Wiki
title: token
-
help
show command usage.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method": "{COMMAND}", "params": [ "test", "123456"], "id": 7 }, json: true };
-
Response (Example for shutdown)
{ "id": 7, "jsonrpc": "3.0", "result": "\nUsage: uc-cli shutdown [-h] [ADMINNAME] [ADMINAUTH] \n\n Info: stop ucd. \n\n Options (named):\n\n-h [--help] Get a description and instructions for this command.\n\n Arguments (positional):\n\n ADMINNAME admin name. \n ADMINAUTH admin password/authorization. \n"
}
-
createtoken
create token.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method": "createtoken", "params": [ "yang", "123456", { "issuer":"[email protected]", "symbol":"bala", "volume":"10000" }], "id": 7 }, json: true };
-
Response
{ "id": 7, "jsonrpc": "3.0", "result": { "address" : "", "decimal_number" : 0, "description" : "", "is_secondaryissue" : false, "issuer" : "[email protected]", "maximum_supply" : 10000, "secondaryissue_threshold" : 0, "status" : "unissued", "symbol" : "BALA" } }
-
deletetoken
delete token.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method": "deletetoken", "params": [ "yang", "123456", {"symbol":"bala"}], "id": 7 }, json: true };
-
Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "status" : "deleted successfully", "symbol" : "BALA" } }
-
registertoken
Broadcast the token whole network.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method": "registertoken", "params": [ "yang", "123456","bala"], "id": 7 }, json: true };
-
Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "hash" : "19bc96f1e5ce3b69d0d97542ce4a355daafa186e75ab2749d04d7b5bd8e3b714", "inputs" : [ { "address" : "UkRYvsnfJkwSTAUCcZnqCK8sE1ZYJP6so7", "previous_output" : { "hash" : "32bca25c8c3b69fae98d25d6570b5f6671e01a9806f3bbb3f7e3ea9823d46b40", "index" : 1 }, "script" : "[ 3045022100a7f4b8558b32e00cdac92c4bf380aa4852965be363e4f7e17543677ee6d45d3902203bd3c252a18de9f8f43b4546f6f580b5ea1c00738d4a27eaf837eed02a14866401 ] [ 0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d ]", "sequence" : 4294967295 }, { "address" : "UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx", "previous_output" : { "hash" : "addc571765ee76b32eacf1c8e412b6e0eba1f302bcb16974bcadf250a547916b", "index" : 2 }, "script" : "[ 30450221009fbf933b50c170286deb470da86c51bf7a9084a3035e68f7a20cc2eceac1622502203ee3ed41a915ab3c77645aabecdf3de21dacb136b0c701899469cd34bcdc244001 ] [ 027c99068f735e53064682b9ef1f548a00191b5ffb2fd9b9c8f32cde97793a0ed4 ]", "sequence" : 4294967295 } ], "lock_time" : "0", "outputs" : [ { "address" : "UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx", "asset" : { "address" : "UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx", "decimal_number" : 0, "description" : "", "is_secondaryissue" : false, "issuer" : "[email protected]", "quantity" : 10000, "secondaryissue_threshold" : 0, "symbol" : "BALA", "to_uid" : "[email protected]", "type" : "token-issue" }, "index" : 0, "locked_height_range" : 0, "script" : "dup hash160 [ 078910a58cea508623e2be9b38beb6e7d576e880 ] equalverify checksig", "value" : 0 }, { "address" : "UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx", "asset" : { "address" : "UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx", "cert" : "domain", "owner" : "[email protected]", "symbol" : "BALA", "to_uid" : "[email protected]", "type" : "token-cert" }, "index" : 1, "locked_height_range" : 0, "script" : "dup hash160 [ 078910a58cea508623e2be9b38beb6e7d576e880 ] equalverify checksig", "value" : 0 }, { "address" : "UNKAn2fsG5CPeP4s9mxTvJKSjmqqdwu3Tq", "asset" : { "type" : "ucn" }, "index" : 2, "locked_height_range" : 0, "script" : "dup hash160 [ 039f445e123efa6e43a55fbb274e631646875a6a ] equalverify checksig", "value" : 800000000000 }, { "address" : "UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx", "asset" : { "type" : "ucn" }, "index" : 3, "locked_height_range" : 0, "script" : "dup hash160 [ 078910a58cea508623e2be9b38beb6e7d576e880 ] equalverify checksig", "value" : 80999017999200000 } ], "version" : "4" } }
-
sendtokento
send token to someone.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "id":7, "jsonrpc": "3.0", "method":"sendtokento", "params":[ "yang", "123456", "USa9SKiMHZ3TRcodvJi6oGVgS65iy47Hh4", "BLOCK", 100 ] }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "hash" : "2a8e2a4132f2519da3d6bb26a3833c2f6f081b5ddb18247c781d585b821b90a8", "inputs" : [ { "address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", "previous_output" : { "hash" : "d3708c58132c0627288bb4f94d7984b745b9cf00c00b7b8b92ab2792de7463c1", "index" : 0 }, "script" : "[ 30450221009343f4f9ebe0c860f625bec0ad4044f79dc426cfb35fb36a7a17952b7bcfd8d20220021d41f64122825f1d2c92eb08866d99a46246155ea1072741b0783db03c86fd01 ] [ 03bec77692da62f861065c04d09de5b217c14be033453a9235a1c67853cccf3ea9 ]", "sequence" : 4294967295 }, { "address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", "previous_output" : { "hash" : "1d51c51c4b0ef79855b7aa0d79a8dfad2996b00c927a8ccc41d59e43c443c21f", "index" : 1 }, "script" : "[ 30440220371062c0adad7a2a2a2059786b7629116f53a14cb34e97760e519dfa8ae3e9ae02204113fb77fafd36d2be2ea4769604ec1acc34dfbb1686838ba282fa0a4346819001 ] [ 03bec77692da62f861065c04d09de5b217c14be033453a9235a1c67853cccf3ea9 ]", "sequence" : 4294967295 } ], "lock_time" : "0", "outputs" : [ { "address" : "USa9SKiMHZ3TRcodvJi6oGVgS65iy47Hh4", "asset" : { "quantity" : 100, "symbol" : "BLOCK", "type" : "token-transfer" }, "index" : 0, "locked_height_range" : 0, "script" : "dup hash160 [ 3254e428b11bf9c23a227c3148148fa868ff3e9d ] equalverify checksig", "value" : 0 }, { "address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", "asset" : { "type" : "ucn" }, "index" : 1, "locked_height_range" : 0, "script" : "dup hash160 [ e65032659d90b0c770f649a385949001f6a4ddfd ] equalverify checksig", "value" : 81999979998929990 }, { "address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", "asset" : { "quantity" : 7539, "symbol" : "BLOCK", "type" : "token-transfer" }, "index" : 2, "locked_height_range" : 0, "script" : "dup hash160 [ e65032659d90b0c770f649a385949001f6a4ddfd ] equalverify checksig", "value" : 0 } ], "version" : "4" } }
- JS Parameters
-
sendtokenfrom
send token to someone from specific address.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"sendtokenfrom", "params":[ "snake02", "123456", "UcuW7wVu198Nuzok8eeMDUNEZQoGqQRRz5", "USa9SKiMHZ3TRcodvJi6oGVgS65iy47Hh4", "BLOCK", "5" ], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "hash" : "fbc32557334266bf5fcfcb9a02b06487923a6791477803d8c3b3a0b8ac39bc18", "inputs" : [ { "address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", "previous_output" : { "hash" : "1362c7e68badbed8837d5ae6b9022c92df4ba50b06aae488582e0ca6475aad94", "index" : 1 }, "script" : "[ 304402202b831fdf179125a934822eb83aad0485e6cb038941f76fe9a089c5488a5ae67f0220603620b84ccf4877c070ab527e7a092084b9693f4b1716a58cd3580ffc272a7c01 ] [ 03bec77692da62f861065c04d09de5b217c14be033453a9235a1c67853cccf3ea9 ]", "sequence" : 4294967295 }, { "address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", "previous_output" : { "hash" : "2a8e2a4132f2519da3d6bb26a3833c2f6f081b5ddb18247c781d585b821b90a8", "index" : 2 }, "script" : "[ 3044022056062d1b0f6e5ea0c4e3edee90aa82c34024932afb8b84928fc86d1078cd1bdf022048ba36074dfe682a572084cd8c8cc0544bc3f7b1d9f2481c7669e88f174c743e01 ] [ 03bec77692da62f861065c04d09de5b217c14be033453a9235a1c67853cccf3ea9 ]", "sequence" : 4294967295 } ], "lock_time" : "0", "outputs" : [ { "address" : "USa9SKiMHZ3TRcodvJi6oGVgS65iy47Hh4", "asset" : { "quantity" : 100, "symbol" : "BLOCK", "type" : "token-transfer" }, "index" : 0, "locked_height_range" : 0, "script" : "dup hash160 [ 3254e428b11bf9c23a227c3148148fa868ff3e9d ] equalverify checksig", "value" : 0 }, { "address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", "asset" : { "type" : "ucn" }, "index" : 1, "locked_height_range" : 0, "script" : "dup hash160 [ e65032659d90b0c770f649a385949001f6a4ddfd ] equalverify checksig", "value" : 19999920000 }, { "address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", "asset" : { "quantity" : 7439, "symbol" : "BLOCK", "type" : "token-transfer" }, "index" : 2, "locked_height_range" : 0, "script" : "dup hash160 [ e65032659d90b0c770f649a385949001f6a4ddfd ] equalverify checksig", "value" : 0 } ], "version" : "4" } }
-
showtokens
list tokens details.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "id": 7 , "jsonrpc": 3.0, "method":"showtokens", "params":[ "snake02", "123456" ] }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : [ { "decimal_number" : 1, "description" : "BLOCK token is issued by blackhole,just for name not to use", "issuer" : "BLACKHOLE", "locked_quantity" : 0, "quantity" : 11376, "secondaryissue_threshold" : 0, "status" : "unspent", "symbol" : "BLOCK" }, { "decimal_number" : 1, "description" : "Vote token is issued by blackhole,just for name not to use", "issuer" : "BLACKHOLE", "locked_quantity" : 0, "quantity" : 37, "secondaryissue_threshold" : 0, "status" : "unspent", "symbol" : "VOTE" } ] }
- JS Parameters
-
showtoken
Show existed tokens details from UC blockchain.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "id": 7 , "jsonrpc": 3.0, "method":"showtoken", "params":[ "BLOCK" ] }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : [ { "address" : "1111111111111111111114oLvT2", "decimal_number" : 1, "description" : "BLOCK token is issued by blackhole,just for name not to use", "is_secondaryissue" : false, "issuer" : "BLACKHOLE", "maximum_supply" : 1, "secondaryissue_threshold" : 0, "status" : "issued", "symbol" : "BLOCK" } ] }
***
- JS Parameters
-
showwallettoken
show wallet token.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "id": 7 , "jsonrpc": 3.0, "method":"showwallettoken", "params":[ "snake02", "123456" ] }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : [ { "address" : "UcuW7wVu198Nuzok8eeMDUNEZQoGqQRRz5", "decimal_number" : 1, "description" : "BLOCK token is issued by blackhole,just for name not to use", "issuer" : "BLACKHOLE", "locked_quantity" : 0, "quantity" : 11376, "secondaryissue_threshold" : 0, "status" : "unspent", "symbol" : "BLOCK" }, { "address" : "UcuW7wVu198Nuzok8eeMDUNEZQoGqQRRz5", "decimal_number" : 1, "description" : "Vote token is issued by blackhole,just for name not to use", "issuer" : "BLACKHOLE", "locked_quantity" : 0, "quantity" : 37, "secondaryissue_threshold" : 0, "status" : "unspent", "symbol" : "VOTE" } ] }
-
showaddresstoken
show address token.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "id": 7 , "jsonrpc": 3.0, "method":"showaddresstoken", "params":[ "UcuW7wVu198Nuzok8eeMDUNEZQoGqQRRz5" ] }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : [ { "address" : "UcuW7wVu198Nuzok8eeMDUNEZQoGqQRRz5", "decimal_number" : 1, "description" : "BLOCK token is issued by blackhole,just for name not to use", "issuer" : "BLACKHOLE", "locked_quantity" : 0, "quantity" : 11376, "secondaryissue_threshold" : 0, "status" : "unspent", "symbol" : "BLOCK" }, { "address" : "UcuW7wVu198Nuzok8eeMDUNEZQoGqQRRz5", "decimal_number" : 1, "description" : "Vote token is issued by blackhole,just for name not to use", "issuer" : "BLACKHOLE", "locked_quantity" : 0, "quantity" : 37, "secondaryissue_threshold" : 0, "status" : "unspent", "symbol" : "VOTE" } ] }
-
destroy
destroy token to blackhole address 1111111111111111111114oLvT2.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "id": 7 , "jsonrpc": 3.0, "method":"destroy", "params":[ "snake02", "123456", "BLOCK", "10" ] }, json: true };
- Response { "error" : { "code" : 5012, "message" : "Cannot send 'BLOCK' token in this way.Please use sendtokenfrom command." }, "id" : 7, "jsonrpc" : "3.0" }
***
-
vote
vote to a miner's addresss, then lock some ucn for about 48h.1 ucn can get 20 votes.
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "id": 7 , "jsonrpc": 3.0, "method":"vote", "params":[ "yang", "123456", "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", { "receivers":["UbkBgDeQHHJyGBuT7txepqCiJbpJ3JSYZD:1","USa9SKiMHZ3TRcodvJi6oGVgS65iy47Hh4:1"] } ] }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "hash" : "33ed7d121aebd29aad2ef236c706b4beaabd4a7c746fe283406277e29737cb14", "inputs" : [ { "address" : "UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx", "previous_output" : { "hash" : "e2d489118d6aca7e179aef6760333b087ca553d5d787a69a3deb9c1a4e0b380d", "index" : 1 }, "script" : "[ 3044022030a2830f361b0a54b71d5cb437cf3f70db693995940dd6c59d0ead1b5b30be0f02207e17c77b9ba30cc67519ff156240f7d43ea75010c6b5e412653513f31e4045f901 ] [ 027c99068f735e53064682b9ef1f548a00191b5ffb2fd9b9c8f32cde97793a0ed4 ]", "sequence" : 4294967295 } ], "lock_time" : "0", "outputs" : [ { "address" : "UbkBgDeQHHJyGBuT7txepqCiJbpJ3JSYZD", "asset" : { "quantity" : 10000, "symbol" : "VOTE", "type" : "token-transfer" }, "index" : 0, "locked_height_range" : 0, "script" : "dup hash160 [ 96f40d6b7ae306763ac42788fee3cb4f2f598286 ] equalverify checksig", "value" : 0 }, { "address" : "USa9SKiMHZ3TRcodvJi6oGVgS65iy47Hh4", "asset" : { "quantity" : 40000, "symbol" : "VOTE", "type" : "token-transfer" }, "index" : 1, "locked_height_range" : 0, "script" : "dup hash160 [ 3254e428b11bf9c23a227c3148148fa868ff3e9d ] equalverify checksig", "value" : 0 }, { "address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq", "asset" : { "type" : "ucn" }, "index" : 2, "locked_height_range" : 345600, "script" : "[ 004605 ] numequalverify dup hash160 [ e65032659d90b0c770f649a385949001f6a4ddfd ] equalverify checksig", "value" : 250000000000 }, { "address" : "UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx", "asset" : { "type" : "ucn" }, "index" : 3, "locked_height_range" : 0, "script" : "dup hash160 [ 078910a58cea508623e2be9b38beb6e7d576e880 ] equalverify checksig", "value" : 81999747075010000 } ], "version" : "4" } }
-
show vote amount of uid from a START_HEIGHT to a END_HEIGHT.showvote
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method": "showvote", "params": [ "[email protected]", "0", "100"], "id": 7 }, json: true };
* Response
{
"id" : 7,
"jsonrpc" : "3.0",
"result" :
[
{
"address" : "UfEUeYUPL8pNW7g8taDQKbHjuawSwFJXiX",
"decimal_number" : 1,
"description" : "'VOTE' token is issued by blackhole.Users can use it to vote.",
"issuer" : "BLACKHOLE",
"locked_quantity" : 0,
"quantity" : 10000,
"secondaryissue_threshold" : 0,
"status" : "unspent",
"symbol" : "VOTE"
}
]
}