In order for a software application to interact with the Conflux blockchain - either by reading blockchain data or sending transactions to the network - it must connect to an Conflux node.
For this purpose, every Conflux client implements a JSON-RPC specification, so there are a uniform set of methods that applications can rely on regardless of the specific node or client implementation.
JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol. It defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in many various message passing environments. It uses JSON (RFC 4627) as data format.
Currently, Conflux has a Rust implementation that supports JSON-RPC 2.0 over an HTTP, TPC, or WebSocket connection.
If you are a node operator, you can enable and configure various RPC interfaces through the TOML config file, or directly by passing command line arguments. The main configuration items are listed in the table below. Note that if you want to enable HTTPS or access control, you will need to set up a proxy for your node.
|enabled by default
The JSON-RPC API is organized into namespaces, with each namespace containing a set of methods. All methods name in one namespace have a same prefix, for example all methods in
cfx namespace have a same prefix
cfx_getTransactionByHash. The following namespaces are currently supported:
📄️ cfx Namespace
The core JSON-RPC API of Conflux.
📄️ txpool Namespace
txpool related RPCs which can enable developer get more info about transaction pool. Which was introduced from conflux-rust v1.1.6.
📄️ pos Namespace
The `pos` namespace includes RPCs related to PoS consensus.
📄️ debug Namespace
A set of methods related to debugging
📄️ trace Namespace
Through trace RPCs we can know the transaction executive details. To use these RPC Conflux archive node need set two additional config:
📄️ Publish-Subscribe API
The Publish-Subscribe API of Conflux Core Space
📄️ Common RPC errors
🗃️ RPC Behaviour