- 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
Configuration
RPC can be configured by tuning parameters under the[rpc] section in the $CMTHOME/config/config.toml file or by using the --rpc.X command-line flags.
Default Settings
The default RPC listen address istcp://127.0.0.1:26657. To set another address, update the laddr config parameter:
CORS Configuration
CORS (Cross-Origin Resource Sharing) can be enabled by setting the following config parameters:cors_allowed_origins- List of allowed origin domainscors_allowed_methods- HTTP methods allowed for CORS requestscors_allowed_headers- Headers allowed in CORS requests
Protocol Examples
URI over HTTP
A REST-like interface for simple queries:JSONRPC over HTTP
JSONRPC requests can be POST’d to the root RPC endpoint:JSONRPC over WebSockets
JSONRPC requests can also be made via WebSocket for real-time updates. The WebSocket endpoint is at/websocket, e.g. localhost:26657/websocket.
Asynchronous RPC functions like event
subscribe and unsubscribe are only available via WebSockets.Subscribing to Events
Using the websocat tool, you can subscribe to ‘NewBlock’ events:Available Event Types
You can subscribe to the following event types:NewBlock- Emitted when a new block is committedNewBlockHeader- Emitted for new block headersTx- Emitted for transactionsValidatorSetUpdates- Emitted when the validator set changes
Endpoint Categories
The CometBFT RPC API is organized into several categories:| Category | Description | Example Methods |
|---|---|---|
| Info | Node information and blockchain data | status, health, net_info, blockchain, block |
| Tx | Transaction broadcasting and queries | broadcast_tx_sync, broadcast_tx_async, tx, tx_search |
| ABCI | Application Blockchain Interface queries | abci_info, abci_query |
| Evidence | Evidence of misbehavior | broadcast_evidence |
| Unsafe | Administrative operations (requires manual enablement) | dial_seeds, dial_peers, unsafe_flush_mempool |
Arguments
Arguments which expect strings or byte arrays may be passed as:- Quoted strings:
"abc" 0x-prefixed hex strings:0x616263
Common Use Cases
Querying Blockchain Data
Broadcasting Transactions
Node Status and Health
Next Steps
RPC Methods Reference
Browse the complete API reference in the sidebar - all ~30 RPC methods with interactive examples and detailed parameters
WebSocket Subscriptions
Learn more about subscribing to real-time events