主网 RPC 接口
info
最新的 RPC 实现参见 Mixin 的源码。
#
发送 RPC 请求Mixin 主网节点会公开一个用于 RPC 的端口,您可以使用它来与 Mixin 主网节点进行交互。
默认的RPC端口为服务端口+1000。例如,如果公共端口为8001
,则RPC端口为9001
。
#
RPC BaseRPC API Base 由 http://<node_host>:<rpc_port>/
构成。 例如,http://127.0.0.1:9001/
。
#
请求体参数 | 类型 | 描述 |
---|---|---|
method | String | 支持的 PRC 方法,请参阅下面的部分 |
params | Array | PRC 方法的参数 |
#
例子curl -X POST -H "Content-Type: application/json" \ -d '{"method":"getinfo","params":[],"id":1}' http://127.0.0.1:9001
#
RPC 方法#
getinfoparams:
[]
return: the information of current node
#
dumpgraphheadparams:
[]
return: the graph head of current node
#
sendrawtransactionparams:
[ the hex format of transaction:string]
return:
{ "hash": the hash of the transcation}
#
gettransactionparams:
[ the hash of the transaction:string]
return:
{ the transaction}
#
getcachetransactionparams:
[ the hash of the transaction:string]
return:
{ the transaction}
#
getutxoparams:
[ the hash of the utxo:string, the index:string formed uint64]
return:
{ the utxo}
#
getsnapshotparams:
[ the hash of the snapshot:string,]
return:
{ the snapshot}
#
listsnapshotsparams:
[ offset:string formed uint64, count:string formed uint64, sig:string formed bool, tx:string formed bool,]
return:
{ snapshots: [ the snapshot ... ],}
#
listmintworksparams:
[ offset:string formed uint64,]
return:
{ node_hash_id: work, ...}
#
listmintdistributionsparams:
[ offset:string formed uint64, count:string formed uint64, tx:string formed bool,]
return:
{ mints: [ the mint ... ],}
#
listallnodesparams:
[ threshold:string formed uint64, state:string formed bool,]
return:
{ nodes: [ the node ... ],}
#
getroundbynumberparams:
[ node:string formed uint64, number:string formed uint64,]
return:
{ "node": node, "hash": hash, "start": start, "end": end, "number": number, "references": references, "snapshots": snapshots,}
#
getroundbyhashparams:
[ round_hash:string,]
return:
{ "node": node, "hash": hash, "start": start, "end": end, "number": number, "references": references, "snapshots": snapshots,}
#
getroundlinkparams:
[ from:string, to:string,]
return:
{ "link": link,}