Chainhook Overview
Chainhook enables you to build custom event streams for Bitcoin layers and trigger actions based on those events.
Chainhook is a reorg-aware indexer that serves reliable blockchain data—saving you time by avoiding reindexing your database every time there’s a fork. Chainhook also lets you index only the data you need, which means you can build lighter databases, get faster query results, and deliver a better experience to your users.
Chainhook can be used as a tool in your local development environment and as a hosted service in the cloud via the Hiro Platform.
Install Chainhook
Clone the Chainhook Repo:
git clone https://github.com/hirosystems/chainhook.git
Navigate to the root directory and run cargo chainhook-install
to install:
cd chainhook && cargo chainhook-install
Create Event Streams
Create a Bitcoin chainhook
→Build a chainhook that reacts to events on the Bitcoin blockchain.
Create a Stacks chainhook
→Build a chainhook that reacts to events on the Stacks blockchain.
Scan Blocks for Past Events
Index Bitcoin
→Scan past Bitcoin blocks for the data you need.
Index Stacks
→Scan past Stacks blocks for the data you need.
Related Tools
Ordhook: Create event streams specifically for Bitcoin Ordinals.
Hiro Platform: Streamline chainhook creation in a cloud-hosted UI.
Need help building with Chainhook? Reach out to us on the #chainhook
channel on Discord under the Hiro Developer Tools section. There's also a weekly office hours on Discord every Thursday at 11am ET.