25

Chia区块链RPC API官方文档【中文版】

 3 years ago
source link: http://blog.hubwiz.com/2021/06/02/chia-api-doc/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Chia RPC API官方文档中文版由汇智网翻译整理, 访问地址:http://cw.hubwiz.com/card/c/chia-rpc/

1、Chia RPC API 概述

Chia节点内置JSON RPC API服务,开发人员可以用来获取区块链信息并加以控制。可以通过 HTTP、WebSockets或Python客户端访问这些API。RPC API的端口可以在~/.chia/mainnet/config/config.yaml 配置文件中进行设置。注意RPC API端口不要在互联网上暴露,出于安全性考虑,Chia使用TLS证书用于 对通信进行加密。

Chia RPC API默认端口如下:

  • Daemon/后台服务: 55400
  • Full Node/全节点: 8555
  • Farmer/农夫: 8559
  • Harvester/收割人: 8560
  • Wallet/钱包: 9256

从命令行调用RPC API时必须使用证书,请确保使用了正确的证书。所有的访问端节点都是使用JSON 数据进行POST请求,响应结果是一个JSON字典,其中的success字段可以是true或false。

如果你使用Websockets API,可以直接利用Daemon来路由请求。每一个WebSocket消息都包含以下字段:

{
"command": "get_blockchain_state",
"ack": false,
"data": {},
"request_id": "123456",
"destination": "wallet",
"origin": "ui",
}

大多数RPC方法可以通过src/rpc下的不同client对象来访问。可以访问Chia的命令行实现来了解 其使用方法,例如chia wallet、chia show等等。

可以在这里查看JavaScript客户端实现: https://github.com/freddiecoleman/chia-client

2、Chia RPC API目录

FullNode Api

Wallet Api

Harvester Api

Farmer Api

公共Api


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK