简体   繁体   English

开发区块链API

[英]Developing of blockchain API

I need your help, I'm trying to create an API. 我需要您的帮助,我正在尝试创建一个API。 With the help of this API I would like to get statistics for the last 24 hours of Bitcoin network and return something like that: 借助此API,我想获取比特币网络最近24小时的统计信息,并返回类似以下内容:

  • Amount of mined blocks 开采量
  • Amount of transactions 交易金额
  • Hashrate Hashrate

and so on. 等等。

Can you suggest how I can access this data without using others' APIs? 您能否建议我不使用他人的API即可访问此数据?

If you are running a node you should be able to get the needed information through the rpc interface. 如果您正在运行节点,则应该能够通过rpc接口获得所需的信息。 How, would be more implementation specific. 如何,将更具体地实现。 You would need to for example store the block height somewhere, and 24 hours later subtract that from the current. 例如,您需要将块高度存储在某个位置,然后在24小时后从当前高度中减去该高度。

If you are not running a node, you would need to write code to connect directly to the network and find peers to get the information from, maybe using something link bcoin.Peer or equivalent for your language of choice and handle relevant messages as they come in, or roll your own following the protocol 如果您不在运行节点,则需要编写代码以直接连接到网络并查找对等点以从中获取信息,可能使用某种链接bcoin.Peer或同等语言作为您选择的语言并处理相关消息遵循协议 ,或自己滚动

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM