-
Notifications
You must be signed in to change notification settings - Fork 2
Super Node RPC CN
Victor Zhang edited this page Apr 18, 2019
·
29 revisions
curl --data '{"jsonrpc":"2.0", "id":1, "method":"getInfo", "params":[] }' http://127.0.0.1:6553
上面命令执行结果示例:
{"last_mci":63136,"last_stable_mci":63136,"count_unhandled":0}
其中:
- last_mci:当前节点最大的mci
- last_stable_mci:当前节点最大的稳定单元mci
- count_unhandled:当前节点待处理的单元数
curl --data '{"jsonrpc":"2.0", "id":1, "method":"getMyAddress", "params":[] }' http://127.0.0.1:6553
curl --data '{"jsonrpc":"2.0", "id":1, "method":"getBalance", "params":["4T7YVRUWMVAJIBSWCP35C7OGCX33SAYO"] }' http://127.0.0.1:6553
其中,params指定要查询的地址。此命令可以只能查询当前supernode地址的余额。 上面命令执行结果示例:
{"base":{"stable":27924300957,"pending":0}}
其中:
- stable:当前地址中的可用余额
- pending:当前地址中的未确认余额
curl --data '{"jsonrpc":"2.0", "id":1, "method":"sendToAddress", "params":["BVVJ2K7ENPZZ3VYZFWQWK7ISPCATFIW3", 1000000] }' http://127.0.0.1:6553
其中,params指定接收地址和转账金额。注意,金额数量的单位是note,1000000表示发送 1 RNG。
curl --data '{"jsonrpc":"2.0", "id":1, "method":"listTransactions", "params":[] }' http://127.0.0.1:6553
获取当前节点相关的交易信息,上面命令执行结果示例:
[{"action":"sent","amount":17751564,"addressTo":"A3TEKUPJMRKNKJBO2NOKLGKONMFWLR7P","confirmations":1,"unit":"b18RhLdpfR6ZFDtmcnmP96Dbyjmw8zJeds9U1zdg4BA=","fee":0,"time":"1554965692","level":72187,"mci":62847,"round_index":1503,"pow_type":3}]
返回所有相关交易信息的数组,每个交易的信息包括:
- action:交易类型,包括sent、received、moved、invalid等
- amount:金额
- addressTo:接受地址
- arrPayerAddresses:支付地址数组
- confirmations:是否确认(稳定)
- unit:单元id
- fee:手续费
- level:单元level
- mci:单元mci
- round_index:轮次号(普通单元为空)
- pow_type:单元类型(普通单元为空),1:挖矿单元、2:TrustME单元、3:Coinbase单元 传参示例:
- 根据地址查询所有相关交易信息
curl --data '{"jsonrpc":"2.0", "id":1, "method":"listTransactions", "params":["JNA6YWLKFQG7PFF6F32KTXBUAHRAFSET"] }' http://127.0.0.1:6553
- 获取当前钱包的所有相关交易信息
curl --data '{"jsonrpc":"2.0", "id":1, "method":"listTransactions", "params":{} }' http://127.0.0.1:6553
- 获取大于一个mci的所有相关交易信息
curl --data '{"jsonrpc":"2.0", "id":1, "method":"listTransactions", "params":{ "since_mci":62800 } }' http://127.0.0.1:6553
- 根据unit获取一笔交易信息
curl --data '{"jsonrpc":"2.0", "id":1, "method":"listTransactions", "params":{ "unit":"b18RhLdpfR6ZFDtmcnmP96Dbyjmw8zJeds9U1zdg4BA="} }' http://127.0.0.1:6553
curl --data '{"jsonrpc":"2.0", "id":1, "method":"checkAddress", "params":["BVVJ2K7ENPZZ3VYZFWQWK7ISPCATFIW3"] }' http://127.0.0.1:6553
其中,params指定要查询的地址。
curl --data '{"jsonrpc":"2.0", "id":1, "method":"getTotalNumOfUnits", "params":[] }' http://127.0.0.1:6553
curl --data '{"jsonrpc":"2.0", "id":1, "method":"getUnitInfo", "params":["b18RhLdpfR6ZFDtmcnmP96Dbyjmw8zJeds9U1zdg4BA="] }' http://127.0.0.1:6553
其中,params指定要查询的unit。
curl --data '{"jsonrpc":"2.0", "id":1, "method":"getPeerList", "params":[] }' http://127.0.0.1:6553
上面命令执行结果示例:
{"incoming connections":"[\"58.132.177.157:3463\"]","outgoing connections":"[\"ws://119.28.23.97:9193\",\"ws://119.28.128.192:9193\",\"ws://119.28.191.240:9193\",\"ws://119.28.14.51:9193\",\"ws://119.28.143.96:9193\",\"ws://119.28.44.246:9193\"]"}
其中:
- incoming connections:所有连入本节点的节点
- outgoing connections:本节点连出的所有节点
curl --data '{"jsonrpc":"2.0", "id":1, "method":"createMinerAddress", "params":[1000000] }' http://127.0.0.1:6553
其中,1000000为打入押金合约的金额,该值不能为0,也不能大于给SuperNode地址打币的金额。 若押金合约创建成功,会返回如下格式的内容:
{"jsonrpc":"2.0","result":"W3MMU32YURN6XISK5YADI4QQXKRH5INK","id":1}
其中,"W3MMU32YURN6XISK5YADI4QQXKRH5INK"是当前节点的押金合约地址。
curl --data '{"jsonrpc":"2.0", "id":1, "method":"miningStatus", "params":[] }' http://127.0.0.1:6553
上面命令执行结果示例:
{\"pow_count\":591,\"coinbase\":15806504738,\"balance\":{\"base\":{\"stable\":15906207226,\"pending\":0,\"is_private\":null}},\"current_round\":780,\"max_mci\":39983}
其中:
- pow_count:挖矿成功的次数
- coinbase:已获得的Coinbase总量,单位是note
- current_round:当前轮次值
- max_mci:当前稳定高度
- difficulty:当前难度值
- totalMine:总挖矿量
- totalPublishCoin:总发行量
- depositRatio:当前抵押率
- inflationRatio:年化通胀率
注意:本地账本的当前轮次和当前稳定高度可能小于全网的实际值。
curl --data '{"jsonrpc":"2.0", "id":1, "method":"getDurationByRoundIndex", "params":[1530] }' http://127.0.0.1:6553
其中,参数为轮次号
{"jsonrpc":"2.0","result":278,"id":1}
结果中的数字以秒为单位。
tail -f log.txt | grep connection
执行结果示例:
Mon Apr 08 2019 16:43:09 GMT+0800 (CST): 13 incoming connections,
12 outgoing connections,
0 outgoing connections being opened
注意:
- 本文适用于Explorer和SuperNode。但出于安全考虑,SuperNode的RPC接口仅允许本地访问
- 请确认SuperNode程序是最新版,无需删除本地数据库
- 通过修改conf.js文件的rpcInterface和rpcPort,可以修改rpc接口的访问权限,默认允许127.0.0.1访问,默认端口6553
Basics
- Home
- Getting Started
- User Documentation
- Design Discussions
- FAQ
- Code of Conduct
Contributing
Mining
Infrastructure
Exchange integrations
R&D
RingNetwork Community
RingNetwork Governance
Risk Management
Ring Network Internals
- Unit Header Data Structure
- Detailed validation logic
- P2P Protocol
Misc