| title | Getting Started |
|---|
Chainhook is a transaction indexing engine for Stacks and Bitcoin. It can extract data from blockchains based on a predicate definition. Chainhook can be used as a development tool and a service.
Chainhook can extract data from the Bitcoin and the Stacks blockchains using predicates (sometimes called chainhooks). A predicate specifies a rule applied as a filtering function on every block transaction.
- Chainhook as a development tool has a few convenient features designed to make developers as productive as possible by allowing them to iterate quickly in their local environments.
- Chainhook as a service can be used to evaluate new Bitcoin and/or Stacks blocks against your predicates. You can also dynamically register new predicates by enabling predicates registration API.
Before installing Chainhook, ensure you have the following:
- Rust toolchain (stable) — required to build from source
git— to clone the repository- A C compiler and
pkg-config(on Linux:build-essential,libssl-dev)
Chainhook can be installed from the source by following the steps below:
-
Clone the chainhook repo by using the following command:
git clone https://github.com/hirosystems/chainhook.git
-
Navigate to the root directory of the cloned repo:
cd chainhook -
Build and install the Chainhook CLI:
cargo install --path components/chainhook-cli
-
Verify the installation:
chainhook --version
If you want to start using Chainhook for extracting data from Bitcoin or Stacks, you can design your predicates using the following guides: