Skip to main content

Turn On Fee Estimator

CKB v0.120.0 introduces a new experimental feature, Fee Estimator, to help developers and users determine optimal transaction fee rates.

To enable the Fee Estimator, the CKB node operator needs to specify the backend algorithms and activate the "Experiment" JSON-RPC API module in the CKB Node Configuration (ckb.toml). As shown below:

Specify the algorithm in ckb.toml:

[fee_estimator]
# Specifies the fee estimate algorithm. Current options: ConfirmationFraction, WeightUnitsFlow.
algorithm = "WeightUnitsFlow"

Enable the JSON-RPC API module Experiment:

[rpc]
# List of API modules: ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"]
modules = ["Net", "Pool", "Miner", "Chain", "Stats", "Subscription", "Experiment", "Debug", "Indexer"]

Once the CKB node is started, users can estimate the fee rate by making an RPC request:

echo '{ "id": 1, "jsonrpc": "2.0", "method": "estimate_fee_rate", "params": [] }' \
| curl -s -H "Content-Type: application/json" -d @- "http://localhost:8114" \
| jq

Example response:

{
"jsonrpc": "2.0",
"result": "0x3e8",
"id": 1
}

More About CKB Transaction Fee Estimator