主网 RPC 接口
信息
最新的 RPC 实现参见 Mixin 的源码。
发送 RPC 请求
Mixin 主网节点会公开一个用于 RPC 的端口,您可以使用它来与 Mixin 主网节点进行交互。
默认的RPC端口为服务端口+1000。例如,如果公共端口为8001
,则RPC端口为9001
。
RPC Base
RPC 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 方法
getinfo
params:
[]
return: the information of current node
dumpgraphhead
params:
[]
return: the graph head of current node
sendrawtransaction
params:
[
the hex format of transaction:string
]
return:
{
"hash": the hash of the transcation
}
gettransaction
params:
[
the hash of the transaction:string
]
return:
{
the transaction
}
getcachetransaction
params:
[
the hash of the transaction:string
]
return:
{
the transaction
}
getutxo
params:
[
the hash of the utxo:string,
the index:string formed uint64
]
return:
{
the utxo
}
getsnapshot
params:
[
the hash of the snapshot:string,
]
return:
{
the snapshot
}
listsnapshots
params:
[
offset:string formed uint64,
count:string formed uint64,
sig:string formed bool,
tx:string formed bool,
]
return:
{
snapshots: [ the snapshot ... ],
}
listmintworks
params:
[
offset:string formed uint64,
]
return:
{
node_hash_id: work,
...
}
listmintdistributions
params:
[
offset:string formed uint64,
count:string formed uint64,
tx:string formed bool,
]
return:
{
mints: [ the mint ... ],
}
listallnodes
params:
[
threshold:string formed uint64,
state:string formed bool,
]
return:
{
nodes: [ the node ... ],
}
getroundbynumber
params:
[
node:string formed uint64,
number:string formed uint64,
]
return:
{
"node": node,
"hash": hash,
"start": start,
"end": end,
"number": number,
"references": references,
"snapshots": snapshots,
}
getroundbyhash
params:
[
round_hash:string,
]
return:
{
"node": node,
"hash": hash,
"start": start,
"end": end,
"number": number,
"references": references,
"snapshots": snapshots,
}
getroundlink
params:
[
from:string,
to:string,
]
return:
{
"link": link,
}