mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-01-12 16:52:57 +08:00
6.5 KiB
6.5 KiB
chainhook-cli
Usage
To get started, build clarinet from source, and then cd components/chainhook-cli and run cargo install --path . to install chainhook-cli.
Before running chainhook-cli, you need to install redis and run a redis server locally.
Start a Testnet node
$ chainhook-cli start --testnet
Start a Mainnet node
$ chainhook-cli start --mainnet
Start a Devnet node
$ chainhook-cli start --devnet
Predicates available
Bitcoin
# Get any transaction matching a given txid
# `txid` mandatory argument admits:
# - 32 bytes hex encoded type. example: "0xfaaac1833dc4883e7ec28f61e35b41f896c395f8d288b1a177155de2abd6052f"
predicate:
txid: 0xfaaac1833dc4883e7ec28f61e35b41f896c395f8d288b1a177155de2abd6052f
# Get any transaction including an OP_RETURN output starting with a set of characters.
# `starts-with` mandatory argument admits:
# - ASCII string type. example: `X2[`
# - hex encoded bytes. example: `0x589403`
predicate:
scope: outputs
op-return:
starts-with: X2[
# Get any transaction including an OP_RETURN output matching the sequence of bytes specified
# `equals` mandatory argument admits:
# - hex encoded bytes. example: `0x589403`
predicate:
scope: outputs
op-return:
equals: 0x69bd04208265aca9424d0337dac7d9e84371a2c91ece1891d67d3554bd9fdbe60afc6924d4b0773d90000006700010000006600012
# Get any transaction including an OP_RETURN output ending with a set of characters
# `ends-with` mandatory argument admits:
# - ASCII string type. example: `X2[`
# - hex encoded bytes. example: `0x589403`
predicate:
scope: outputs
op-return:
ends-with: 0x76a914000000000000000000000000000000000000000088ac
# Get any transaction including a p2pkh output paying a given recipient
# `p2pkh` construct admits:
# - string type. example: "mr1iPkD9N3RJZZxXRk7xF9d36gffa6exNC"
# - hex encoded bytes type. example: "0x76a914ee9369fb719c0ba43ddf4d94638a970b84775f4788ac"
predicate:
scope: outputs
p2pkh: mr1iPkD9N3RJZZxXRk7xF9d36gffa6exNC
# Get any transaction including a p2sh output paying a given recipient
# `p2sh` construct admits:
# - string type. example: "2MxDJ723HBJtEMa2a9vcsns4qztxBuC8Zb2"
# - hex encoded bytes type. example: "0x76a914ee9369fb719c0ba43ddf4d94638a970b84775f4788ac"
predicate:
scope: outputs
p2sh: 2MxDJ723HBJtEMa2a9vcsns4qztxBuC8Zb2
# Get any transaction including a p2wpkh output paying a given recipient
# `p2wpkh` construct admits:
# - string type. example: "bcrt1qnxknq3wqtphv7sfwy07m7e4sr6ut9yt6ed99jg"
predicate:
scope: outputs
p2wpkh: bcrt1qnxknq3wqtphv7sfwy07m7e4sr6ut9yt6ed99jg
# Get any transaction including a p2wsh output paying a given recipient
# `p2wsh` construct admits:
# - string type. example: "bc1qklpmx03a8qkv263gy8te36w0z9yafxplc5kwzc"
predicate:
scope: outputs
p2wsh: bc1qklpmx03a8qkv263gy8te36w0z9yafxplc5kwzc
# Get any transaction including a Stacks Proof of Burn commitment
predicate:
protocol: stacks
operation: pob_commit
# Get any transaction including a Stacks Proof of Transfer commitment
predicate:
protocol: stacks
operation: pox_commit
# Get any transaction including a key registration operation
predicate:
protocol: stacks
operation: key_registration
# Get any transaction including a STX transfer operation
predicate:
protocol: stacks
operation: stx_transfer
# Get any transaction including a STX lock operation
predicate:
protocol: stacks
operation: stx_lock
# Get any transaction including a new Ordinal inscription
predicate:
protocol: ordinal
operation: inscription_revealed
Stacks
# Get any transaction matching a given txid
# `txid` mandatory argument admits:
# - 32 bytes hex encoded type. example: "0xfaaac1833dc4883e7ec28f61e35b41f896c395f8d288b1a177155de2abd6052f"
predicate:
txid: 0xfaaac1833dc4883e7ec28f61e35b41f896c395f8d288b1a177155de2abd6052f
# Get any transaction related to a given fungible token asset identifier
# `asset-identifier` mandatory argument admits:
# - string type, fully qualifying the asset identifier to observe. example: `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.cbtc-sip10::cbtc`
# `actions` mandatory argument admits:
# - array of string type constrained to `mint`, `transfer` and `burn` values. example: ["mint", "burn"]
predicate:
ft-event:
asset-identifier: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.cbtc-sip10::cbtc'
actions:
- mint
- burn
# Get any transaction related to a given non fungible token asset identifier
# `asset-identifier` mandatory argument admits:
# - string type, fully qualifying the asset identifier to observe. example: `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.monkey-sip09::monkeys`
# `actions` mandatory argument admits:
# - array of string type constrained to `mint`, `transfer` and `burn` values. example: ["mint", "burn"]
predicate:
nft-event:
asset-identifier: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.monkey-sip09::monkeys'
actions:
- transfer
- burn
# Get any transaction moving STX tokens
# `actions` mandatory argument admits:
# - array of string type constrained to `mint`, `transfer` and `lock` values. example: ["mint", "lock"]
predicate:
stx-event:
actions:
- mint
- lock
# Get any transaction emitting given print events predicate
# `contract-identifier` mandatory argument admits:
# - string type, fully qualifying the contract to observe. example: `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.monkey-sip09`
# `contains` mandatory argument admits:
# - string type, used for matching event
predicate:
print-event:
contract-identifier: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.monkey-sip09'
contains: "vault"
# Get any transaction including a contract deployment
# `deployer` mandatory argument admits:
# - string "*"
# - string encoding a valid STX address. example: "ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG"
predicate:
contract-deploy:
deployer: "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM"
# Get any transaction including a contract deployment implementing a given trait (coming soon)
# `impl-trait` mandatory argument admits:
# - string type, fully qualifying the trait's shape to observe. example: `ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.sip09-protocol`
predicate:
contract-deploy:
impl-trait: "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.sip09-protocol"