RPC API 参考
访问 API 参考页面,查看所有 CometBFT RPC 方法的完整列表
- 通过 HTTP 的 URI - 类似 REST 的接口,适合简单查询
- 通过 HTTP 的 JSONRPC - 标准的 JSON-RPC 2.0 协议
- 通过 WebSockets 的 JSONRPC - 支持订阅的持久连接
快速开始
默认情况下,RPC 服务器监听tcp://127.0.0.1:26657。你可以使用 curl 进行查询:
配置
可以在config.toml 文件的 [rpc] 部分中配置 RPC 服务器:
CometBFT provides a comprehensive RPC API for interacting with nodes, querying blockchain data, broadcasting transactions, and subscribing to real-time events.
RPC API Reference
Visit the API Reference page for a list of all CometBFT RPC methods
- URI over HTTP - REST-like interface for simple queries
- JSONRPC over HTTP - Standard JSON-RPC 2.0 protocol
- JSONRPC over WebSockets - Persistent connection with subscription support
Quick Start
By default, the RPC server listens ontcp://127.0.0.1:26657. You can query it using curl:
Configuration
The RPC server can be configured in yourconfig.toml file under the [rpc] section: