用户账号相关 API
listaddr
查询当前钱包节点地址列表信息
Parameters
none
Returns
addr
地址
regid
地址对应的regid 主动发起交易后生成
tokens
币种列表,不限于 WICC、WUSD、WGRT 中的0种或多种
`free_amount` 币种对应的可自由操作金额,单位 `sawi`
`staked_amount` 币种对应的已抵押金额,单位 `sawi`
`frozen_amount` 币种对应的已冻结金额,单位 `sawi`
`voted_amount` 已投票的金额, 单位为`sawi`
haveminerkey
矿工标识 (可忽略)
Example
// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"listaddr","params":[]}' -H 'content-type:application/json;' http://127.0.0.1:6967
// Response
{
"result": [
{
"addr" : "wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4",
"regid" : "0-1",
"regid_mature" : true,
"received_votes" : 0,
"tokens" : {
"WICC" : {
"free_amount" : 20790000000000000,
"staked_amount" : 0,
"frozen_amount" : 0,
"voted_amount" : 210000000000000
}
},
"hasminerkey" : false
}
],
}
getnewaddr
创建新地址 ,可通过账户模型与地址 查看更详细的信息
Parameters
IsMiner
(bool, optional)
true : 将创建两组密钥对,一组用于交易签名,另一组用于收取矿工费用
false: 将创建一组密钥对,用于交易签名
Returns
addr
账户地址
minerpubkey
矿工pubkey,如果没有矿工pubkey,则为no
Example
// Request
curl -u Waykichain:admin -d '{"jsonrpc":"2.0","id":"curltext","method":"getnewaddr","params":[]}' -H 'content-type:application/json;' http://127.0.0.1:6967
// Response
{
"result": {
"addr": "weoPdSnVxqfcpnvBBphnBjEJ6ug8xS6Znr",
"minerpubkey": "null"
},
"error": null,
"id": "curltext"
}
getaccountinfo
获取普通账户或者合约账户地址详情 ,可通过账户模型与地址 查看更详细的信息
Parameters
address
普通账号/合约账号的地址/regid
Returns
address
地址
keyid
地址公钥两次sha之后得到的pubKeyHash
regid
地址对应的regid
regid_mature
regid成熟度,用于判断regid是否永久可用,
true : 成熟;
false :未成熟
owner_pubkey
地址对应的公钥,只有普通账户地址有
miner_pubkey
可忽略
tokens
币种余额列表,可能包含 WICC、WUSD、WGRT 中的0种或多种
`free_amount` 可自由操作的金额 , 单位为`sawi`
`staked_amount` 已抵押的金额, 单位为`sawi`
`frozen_amount` 已冻结的金额, 单位为`sawi`
`voted_amount` 已投票的金额, 单位为`sawi`
received_votes
已收到的投票数量
vote_list
已发出的投票列表
`candidate_uid` 被投票人的信息
`id_type` 被投票人的信息类型 ,"PubKey":公钥 ;"RegID": regid
`id` 被投票人公钥/regid
`voted_bcoins` 投票数量
cdp_list
稳定币相关 , cdp列表
`cdpid` cdp的唯一标识,目前每个地址仅限1个cdp
`regid` cdp创建者的regid
`last_height` 上一次操作cdp时的高度
`bcoin_symbol` 抵押所用的基础币种
`total_bcoin` 抵押的币数量,单位为`sawi`
`scoin_symbol` 贷出的币种
`total_scoin` 贷出的币种总额,单位为`sawi`
`collateral_ratio` 抵押率
perm
共十位二进制
`NULL_ACCOUNT_PERM` = 0, // no perm at all w/ the account, even for smart contract account
`PERM_SEND_COIN` = (1 << 0 ), //recv_coin is always allowed
`PERM_STAKE_COIN` = (1 << 1 ), //when input is negative, it means unstake
`PERM_SEND_VOTE` = (1 << 2 ), //send or revoke votes to others
`PERM_SEND_UTXO` = (1 << 3 ), //recv utox is always allowed
`PERM_CONTRACT` = (1 << 4 ), //perm of deploy|invoke contract
`PERM_PROPOSE` = (1 << 5 ), //DeGov propose
`PERM_MINE_BLOCK` = (1 << 6 ), //elected BP can mine blocks, mostly used to disable the perm when set zero
`PERM_FEED_PRICE` = (1 << 7 ), //Feed price, mostly used to disable the perm when set zero
`PERM_DEX` = (1 << 8 ), //freeze | unfreeze
`PERM_CDP` = (1 << 9), //pledge | unpledge
onchain
公钥是否提交到公链上
in_wallet
公钥是否在本地生成
pubkey_registered
公钥是否注册
Example
// Request
> coind getaccountinfo 0-1
// Response
{
"address" : "wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4",
"keyid" : "079b9296a00a2b655787fa90e66ec3cde4bf1c8c",
"regid" : "0-1",
"regid_mature" : true,
"owner_pubkey" : "036c5397f3227a1e209952829d249b7ad0f615e43b763ac15e3a6f52627a10df21",
"miner_pubkey" : "",
"perms" : "1111111111",
"tokens" : {
"WICC" : {
"free_amount" : 20790000000000000,
"staked_amount" : 0,
"frozen_amount" : 0,
"voted_amount" : 210000000000000,
"pledged_amount" : 0,
"total_amount" : 21000000000000000
}
},
"received_votes" : 0,
"vote_list" : [
{
"candidate_uid" : {
"id_type" : "PubKey",
"id" : "03ff9fb0c58b6097bc944592faee68fbdb2d1c5cd901f6eae9198bd8b31a1e6f5e"
},
"voted_bcoins" : 210000000000000
}
],
"onchain" : true,
"in_wallet" : false,
"pubkey_registered" : true,
"cdp_list" : [
]
}
//As json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method": "getaccountinfo", "params": ["WT52jPi8DhHUC85MPYK8y8Ajs8J7CshgaB"] }' -H 'Content-Type: application/json;' http://127.0.0.1:8332/
dumpprivkey
获取地址对应的私钥(WIF格式)
Parameters
addr
本钱包里普通账户地址
Returns
privatekey
私钥(WIF格式)
minerkey
矿工标识(可忽略)
Example
// Request
> coind dumpprivkey wVNb2zd9BsNqJBQgWY4By7C2M4U88AmvLt
// Response
{
"privkey" : "Y8CjaF7E9iWysHoLKaZW6W3L71tTHcxbPEHAV5QM2HTpQsznc6Uy",
"minerkey" : "null"
}
// As a json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method": "dumpprivkey", "params": ["address"] }' -H 'Content-Type: application/json;' http://127.0.0.1:8332/
importprivkey
将私钥(WIF格式)导入钱包
Parameters
privkey
普通账户地址私钥(WIF格式)
Returns
imported_key_address
普通账户地址
Example
// Request
> coind importprivkey Y8CjaF7E9iWysHoLKaZW6W3L71tTHcxbPEHAV5QM2HTpQsznc6Uy
// Response
{
"imported_key_address" : "wVNb2zd9BsNqJBQgWY4By7C2M4U88AmvLt"
}
// As a json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method": "importprivkey", "params": ["privkey"] }' -H 'Content-Type: application/json;' http://127.0.0.1:8332/
dropprivkey
将地址对应的私钥从钱包中移除,非销毁
Parameters
address
普通账号地址
Returns
info
私钥移除结果
Example
// Request
> coind dropprivkey wVNb2zd9BsNqJBQgWY4By7C2M4U88AmvLt
// Response
{
"info" : "privkey was dropped."
}
// As a json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method": "dropprivkey", "params": ["wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4"] }' -H 'Content-Type: application/json;' http://127.0.0.1:8332/
validateaddr
校验普通地址或者合约地址是否有效
Parameters
address
普通账户/合约账户的地址/regid
Returns
is_valid
`true`:有效的
`false` 无效的
addr
账户地址
Example
// Request
> coind validateaddr wVNb2zd9BsNqJBQgWY4By7C2M4U88AmvLt
// Response
{
"is_valid" : true,
"addr" : "wVNb2zd9BsNqJBQgWY4By7C2M4U88AmvLt"
}
// As json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method": "validateaddr", "params": ["wNw1Rr8cHPerXXGt6yxEkAPHDXmzMiQBn4"] }' -H 'Content-Type: application/json;' http://127.0.0.1:8332/