api_wallet - UCHAIN-WORLD/uchain-fullnode GitHub Wiki
title: wallet api
API List
-
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"
}
-
Generate a new wallet from this wallet.createwallet
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method": "createwallet", "params": ["test", "123456"], "id":7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "addresses" : [ "URe3qtpCyrp2192gVj5FVJ7wWrEC7uS2Ye" ], "mnemonic" : "twice decrease couple boat sail diet banner friend person install hospital more load body sock bread embrace muffin man sauce build grunt embark mistake", "name" : "test" } }
- JS Parameters
-
List a brief information of the wallet.checkwalletinfo
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"checkwalletinfo", "params":["test", "123456", "mistake"], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "address_count" : 1, "mnemonic" : "twice decrease couple boat sail diet banner friend person install hospital more load body sock bread embrace muffin man sauce build grunt embark mistake", "name" : "test" } }
-
deletewalletdeletewallet
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"deletewallet", "params":["test", "123456", "mistake"], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "name" : "test", "status" : "removed successfully" } }
-
importwallet using mnemonic wordimportwallet
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"importwallet", "params":["replace loud gym claim final general emotion leisure kingdom solid essence wedding walnut old surge sell bachelor brother adult creek wine unfold arrow roof ",{"walletname":"test1","password":"123456"}], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "addresses" : [ "UVgjjVHYn9XF72dXW2mdYEFWHA1qNziyNb" ], "mnemonic" : "replace loud gym claim final general emotion leisure kingdom solid essence wedding walnut old surge sell bachelor brother adult creek wine unfold arrow roof", "name" : "test1" } }
- JS Parameters
-
changepass
change password of your specified wallet
-
JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"changepass", "params":["test1","123456",{"password":"456789"}], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "name" : "test1", "status" : "changed successfully" } }
-
addaddress
Generate new address for this wallet.
-
JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"addaddress", "params":["yang","123456"], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : [ "UUdyjQe9d5gp8QV4PgTbM6VhewwDUKKx9x" ] }
-
validate addressvalidateaddress
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"validateaddress", "params":["Ud9wuztAThNroNnTRR7TFR8AiEMbWcJM48"], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "address_type" : "p2kh(main-net)", "is_valid" : true, "message" : "valid address", "testnet" : false } }
- JS Parameters
-
List available addresses of this wallet.showaddresses
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"showaddresses", "params":["test1", "456789"], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : [ "UVgjjVHYn9XF72dXW2mdYEFWHA1qNziyNb" ] }
-
export wallet as fileexportkeyfile
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"exportkeyfile", "params":["test1", "456789", "roof","D:\\tmp\\"], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : "D:\\tmp\\uc_keystore_test1.json" }
- JS Parameters
-
import wallet from fileimportkeyfile
- JS Parameters
{ method: 'POST', url: 'http://127.0.0.1:8707/rpc/v3', headers: { 'Content-Type': 'application/json' }, body: { "jsonrpc": "3.0", "method":"importkeyfile", "params":["test1", "456789", "D:\\tmp\\uc_keystore_test1.json"], "id": 7 }, json: true };
- Response
{ "id" : 7, "jsonrpc" : "3.0", "result" : { "addresses" : [ "UVgjjVHYn9XF72dXW2mdYEFWHA1qNziyNb" ], "name" : "test1" } }
- JS Parameters