Skip to main content

Run a Public RPC Node

A public RPC node allows external parties to interact with the blockchain, enabling actions such as querying blockchain data or submitting transactions. This setup is crucial for applications that rely on real-time data from the blockchain.


Exposing RPC can pose significant security risks. Enabling RPC through the rpc.listen_address configuration can open the JSON-RPC port to arbitrary machines, increasing vulnerability. It's strongly advised against enabling RPC unless absolutely necessary. If unavoidable, ensure access is restricted solely to trusted machines, following the provided guidelines.

RPC Access Control

Here is an example using Nginx API Gateway to configure the RPC access control.

Explore more solutions or submit new ones using the GitHub tag ckb-rpc-proxy.

Step 1: Install Docker-Compose and Docker

apt install docker-compose
apt install docker

Step 2: Clone the Proxy Configuration

git clone

Step 3: Replace Default RPC Address

Navigate to the cloned directory and update the Nginx configuration to point to your CKB node's RPC IP address and port:

cd ckb-nginx-proxy
sed -i "s/YOUR_CKR_RPC_IP:8114/" nginx.conf

Step 4: Run Proxy

docker-compose up -d


Get tip block hash and number:

This example retrieves the latest block's hash and number from the CKB node through the configured Nginx proxy.

echo '{
"id": 2,
"jsonrpc": "2.0",
"method": "get_tip_header",
"params": []
}' \
| tr -d '\n' \
| curl -H 'content-type: application/json' -d @- \

## Note that needs to be changed to your proxy IP.

Restricted Methods

Certain RPC methods are restricted to prevent abusive interactions with the CKB node:

  • clear_banned_addresses
  • set_ban
  • set_network_active
  • add_node
  • remove_node
  • remove_transaction
  • clear_tx_pool

These methods can alter the node's network interactions significantly and should be exposed only to trusted administrators. For example, clear_tx_pool can be used to remove all transactions from the mempool, which could disrupt node operation if used maliciously.

echo '{
"id": 2,
"jsonrpc": "2.0",
"method": "clear_tx_pool",
"params": []
}' | tr -d '\n' | curl -H 'content-type: application/json' -d @- \