Introduce
All the indexing RPCs built in the CKB has been deprecated since v0.36.0 and removed in v0.40.0. This is a standalone service for creating cell and transaction indexes as an alternate solution.
Usage
Build binary from source
Connect to default ckb rpc service at http://127.0.0.1:8114 and stores the indexer data at /tmp/ckb-indexer-test folder
RUST_LOG=info
Or connect to ckb rpc service at tcp://127.0.0.1:18114
RUST_LOG=info
Indexing the pending txs in the ckb tx-pool
RUST_LOG=info
Run ckb-indexer --help for more information
RPC
get_tip
Returns the indexed tip block
Parameters
null
Returns
block_hash - indexed tip block hash
block_number - indexed tip block number
Examples
| |
get_cells
Returns the live cells collection by the lock or type script.
Parameters
search_key:
script - Script
scrip_type - enum, lock | type
filter - filter cells by following conditions, all conditions are optional
script: if search script type is lock, filter cells by type script prefix, and vice versa
output_data_len_range: [u64; 2], filter cells by output data len range, [inclusive, exclusive]
output_capacity_range: [u64; 2], filter cells by output capacity range, [inclusive, exclusive]
block_range: [u64; 2], filter cells by block number range, [inclusive, exclusive]
order: enum, asc | desc
limit: result size limit
after_cursor: pagination parameter, optional
Returns
objects - live cells
last_cursor - pagination parameter
Examples
get cells by lock script
| |
get cells by lock script and filter by type script
| |
get cells by lock script and filter capacity range
| |
get_transactions
Returns the transactions collection by the lock or type script.
Parameters
search_key:
script - Script
scrip_type - enum, lock | type
filter - filter cells by following conditions, all conditions are optional
script: if search script type is lock, filter cells by type script, and vice versa
block_range: [u64; 2], filter cells by block number range, [inclusive, exclusive]
order: enum, asc | desc
limit: result size limit
after_cursor: pagination parameter, optional
Returns
objects - transactions
last_cursor - pagination parameter
Examples
| |
get_cells_capacity
Returns the live cells capacity by the lock or type script.
Parameters
search_key:
script - Script
scrip_type - enum, lock | type
filter - filter cells by following conditions, all conditions are optional
script: if search script type is lock, filter cells by type script prefix, and vice versa
output_data_len_range: [u64; 2], filter cells by output data len range, [inclusive, exclusive]
output_capacity_range: [u64; 2], filter cells by output capacity range, [inclusive, exclusive]
block_range: [u64; 2], filter cells by block number range, [inclusive, exclusive]
Returns
capacity - total capacity
block_hash - indexed tip block hash
block_number - indexed tip block number
Examples
| |
get_indexer_info
Returns the indexer service information.
Returns
version - indexer version
Examples
| |