Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ There is also a subsection of example Clarity contracts where you'll find **star

We all have different styles of learning. If you've already got a good concept of web3 fundamentals and want to get a quick taste of what the DevEx is like on Stacks, then check out the [Developer Quickstart](get-started/developer-quickstart.md). Or find the path that clicks for you — and if bandwidth allows, tackle them all!

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h4><strong>Try the Developer Quickstart</strong></h4></td><td>Your 0→1 guide for building a Clarity contract and app on Stacks.</td><td><a href="get-started/developer-quickstart.md">developer-quickstart.md</a></td></tr><tr><td><h4><strong>Start Learning Clarity</strong></h4></td><td>An easy starting point for learning smart contracts.</td><td><a href="get-started/clarity-crash-course.md">clarity-crash-course.md</a></td></tr><tr><td><h4><strong>Bitcoin Primer Tutorial</strong></h4></td><td>A comprehensive end-to-end experience to building full-stack dApps on Bitcoin.</td><td><a href="https://app.gitbook.com/s/skGYu79qDNfITOqDNU3s/bitcoin-primer">Bitcoin Primer</a></td></tr><tr><td><h4><strong>Earn a Stacks Developer Degree</strong></h4></td><td>A hands-on Stacks bootcamp by LearnWeb3.</td><td><a href="https://learnweb3.io/degrees/stacks-developer-degree/">https://learnweb3.io/degrees/stacks-developer-degree/</a></td></tr><tr><td><h4><strong>Watch Our Hands-On Videos</strong></h4></td><td>Developer insights and workshops from the Stacks ecosystem</td><td><a href="https://www.youtube.com/@stacks-developers">https://www.youtube.com/@stacks-developers</a></td></tr><tr><td><h4><strong>Clarity Development Using Clarinet</strong></h4></td><td>The smart contract toolkit for Stacks</td><td><a href="/broken/pages/UK5Kgh2MHLoQvfoFVnLr">Broken link</a></td></tr></tbody></table>
<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h4><strong>Try the Developer Quickstart</strong></h4></td><td>Your 0→1 guide for building a Clarity contract and app on Stacks.</td><td><a href="get-started/developer-quickstart.md">developer-quickstart.md</a></td></tr><tr><td><h4><strong>Start Learning Clarity</strong></h4></td><td>An easy starting point for learning smart contracts.</td><td><a href="get-started/clarity-crash-course.md">clarity-crash-course.md</a></td></tr><tr><td><h4><strong>Bitcoin Primer Tutorial</strong></h4></td><td>A comprehensive end-to-end experience to building full-stack dApps on Bitcoin.</td><td><a href="https://app.gitbook.com/s/skGYu79qDNfITOqDNU3s/bitcoin-primer">Bitcoin Primer</a></td></tr><tr><td><h4><strong>Earn a Stacks Developer Degree</strong></h4></td><td>A hands-on Stacks bootcamp by LearnWeb3.</td><td><a href="https://learnweb3.io/degrees/stacks-developer-degree/">https://learnweb3.io/degrees/stacks-developer-degree/</a></td></tr><tr><td><h4><strong>Watch Our Hands-On Videos</strong></h4></td><td>Developer insights and workshops from the Stacks ecosystem</td><td><a href="https://www.youtube.com/@stacks-developers">https://www.youtube.com/@stacks-developers</a></td></tr><tr><td><h4><strong>Clarity Development Using Clarinet</strong></h4></td><td>The smart contract toolkit for Stacks</td><td><a href="clarinet/overview.md">clarinet/overview.md</a></td></tr></tbody></table>



Expand All @@ -107,7 +107,7 @@ We all have different styles of learning. If you've already got a good concept o
| If you are… | First check out... |
| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Completely new to building with Stacks | [Developer Quickstart](get-started/developer-quickstart.md) |
| Learning smart contract development | [Clarity Crash Course](get-started/clarity-crash-course.md), [Learn Clarinet](/broken/pages/UK5Kgh2MHLoQvfoFVnLr) |
| Learning smart contract development | [Clarity Crash Course](get-started/clarity-crash-course.md), [Learn Clarinet](clarinet/overview.md) |
| Preferring a structured, guided course that shows you every step to build full-stack apps | [Stacks Developer Degree](https://learnweb3.io/degrees/stacks-developer-degree/), [Bitcoin Primer](https://app.gitbook.com/s/skGYu79qDNfITOqDNU3s/bitcoin-primer/introduction), [EasyA](https://www.easya.io/challenges/stacks) |
| Wanting to integrate sBTC in your app | [sBTC guides](more-guides/sbtc/) |
| Launching a token | [Create Tokens](get-started/create-a-token/) |
Expand Down
25 changes: 25 additions & 0 deletions docs/build/SUMMARY.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that the Bitcoin Indexer is omitted entirely, but the Hiro docs state that, while updates will cease, it's going to continue to be open sourced. Should we try to preserve that documentation somewhere rather than just not porting it over? I think it's worth thinking about that a bit more.

Same question for ordinals and runes. I think we should examine what's available in those GitHub repos before we decide that those docs should be omitted entirely.

Same question for the platform API. Are we no longer making that available? If we want to migrate all the Hiro docs and we're still going to allow people to interact with that API, I don't think we should cut it.

Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@
* [Implementation](post-conditions/implementation.md)
* [Examples](post-conditions/examples.md)

## Chainhooks

* [Overview](chainhooks/overview.md)
* [Quickstart](chainhooks/quickstart.md)
* [Create Chainhooks](chainhooks/create.md)
* [Fetch Chainhooks](chainhooks/fetch.md)
* [Update Chainhooks](chainhooks/update.md)
* [Evaluate Chainhooks](chainhooks/evaluate.md)
* [Manage Secrets](chainhooks/secrets.md)
* [FAQ](chainhooks/faq.md)
* [Migration Guide](chainhooks/migration.md)
* [Reference](chainhooks/reference/README.md)
* [Filters](chainhooks/reference/filters.md)
* [Options](chainhooks/reference/options.md)
* [Payload Anatomy](chainhooks/reference/payload-anatomy.md)

## Contract Monitoring

* [Overview](contract-monitoring/README.md)
* [Create an Alert](contract-monitoring/create-alert.md)

## More Guides

* [sBTC](more-guides/sbtc/README.md)
Expand All @@ -96,6 +117,10 @@
* [Verifying Bitcoin Transactions in Clarity](more-guides/verify-bitcoin-transactions-clarity/README.md)
* [Creating a Bitcoin Transaction](more-guides/verify-bitcoin-transactions-clarity/creating-btc-tx.md)
* [Parsing a Bitcoin Transaction](more-guides/verify-bitcoin-transactions-clarity/parsing-a-bitcoin-transaction.md)
* [Build an NFT Marketplace](more-guides/build-an-nft-marketplace.md)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All four of these guides probably belong in a different location than Build.

Also, it looks like the three infrastructure guides didn't get ported over at all, but no reason appears to be given.

Infrastructure

* [Build a Decentralized Kickstarter](more-guides/build-a-decentralized-kickstarter.md)
* [No-Loss Lottery](more-guides/no-loss-lottery.md)
* [Using Clarity Values](more-guides/using-clarity-values.md)
* [Bridging USDCx](more-guides/bridging-usdcx.md)
* [c32check](more-guides/c32check.md)

Expand Down
106 changes: 106 additions & 0 deletions docs/build/chainhooks/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
description: Create, enable, and bulk-manage Hiro Chainhooks with the SDK.
---

# Create Chainhooks

New chainhooks are created in a disabled state unless you set `enable_on_registration` to `true`.

## Register a chainhook

```ts
import { ChainhooksClient, CHAINHOOKS_BASE_URL } from '@hirosystems/chainhooks-client';

const client = new ChainhooksClient({
baseUrl: CHAINHOOKS_BASE_URL.testnet,
apiKey: process.env.HIRO_API_KEY!,
});

const chainhook = await client.registerChainhook({
version: '1',
name: 'my-chainhook',
chain: 'stacks',
network: 'testnet',
filters: {
events: [
{
type: 'contract_call',
contract_identifier: 'SP...XYZ.counter',
function_name: 'increment',
},
],
},
action: {
type: 'http_post',
url: 'https://example.com/webhooks',
},
options: {
decode_clarity_values: true,
enable_on_registration: true,
},
});

console.log('Chainhook UUID:', chainhook.uuid);
console.log('Enabled:', chainhook.status.enabled);
```

## Enable or disable a single chainhook

```ts
await client.enableChainhook('chainhook-uuid', true);
await client.enableChainhook('chainhook-uuid', false);
```

Successful enablement updates return HTTP `204 No Content`.

## Bulk enable or disable chainhooks

### By UUID

```ts
await client.bulkEnableChainhooks({
enabled: true,
filters: {
uuids: ['uuid-1', 'uuid-2', 'uuid-3'],
},
});
```

### By webhook URL

```ts
await client.bulkEnableChainhooks({
enabled: true,
filters: {
webhook_url: 'https://example.com/webhooks',
},
});
```

### By status

```ts
await client.bulkEnableChainhooks({
enabled: true,
filters: {
statuses: ['inactive'],
},
});
```

### Combined filters

```ts
await client.bulkEnableChainhooks({
enabled: false,
filters: {
webhook_url: 'https://old-server.com/webhooks',
statuses: ['active'],
},
});
```

## Next steps

- [Evaluate chainhooks](evaluate.md)
- [Filter reference](reference/filters.md)
52 changes: 52 additions & 0 deletions docs/build/chainhooks/evaluate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
description: Replay a block against a Hiro Chainhook to debug or backfill payloads.
---

# Evaluate Chainhooks

The evaluate endpoint replays a single block against one of your registered chainhooks so you can test filters and webhook consumers without waiting for live traffic.

## Supported inputs

| Method | Parameter | Example |
| --- | --- | --- |
| By height | `block_height` | `{ block_height: 100000 }` |
| By hash | `index_block_hash` | `{ index_block_hash: '0xa204...' }` |

## Evaluate by block height

```ts
import { ChainhooksClient, CHAINHOOKS_BASE_URL } from '@hirosystems/chainhooks-client';

const client = new ChainhooksClient({
baseUrl: CHAINHOOKS_BASE_URL.testnet,
apiKey: process.env.HIRO_API_KEY!,
});

await client.evaluateChainhook('chainhook-uuid', {
block_height: 100000,
});
```

## Evaluate by block hash

```ts
await client.evaluateChainhook('chainhook-uuid', {
index_block_hash: '0xa204...',
});
```

Successful evaluation returns HTTP `204 No Content`. If the block matches your filters, Chainhooks delivers the payload to your configured webhook URL.

## Common use cases

| Use case | Description |
| --- | --- |
| Debug | Reproduce a block that should have triggered a delivery |
| Backfill | Replay historical activity after creating a new hook |
| Re-process | Test your webhook consumer after an infrastructure fix |

## Next steps

- [Filter reference](reference/filters.md)
- [Payload anatomy](reference/payload-anatomy.md)
56 changes: 56 additions & 0 deletions docs/build/chainhooks/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
description: Frequently asked questions about Hiro Chainhooks.
---

# FAQ

## Versioning and migration

<details>
<summary>What happened to legacy Chainhooks v1?</summary>

Legacy Chainhooks v1 was deprecated on March 9, 2026. Use the current SDK and API flows documented in these build and reference sections for new work, and follow the [migration guide](migration.md) when moving older definitions forward.

</details>

<details>
<summary>How do I migrate older chainhooks?</summary>

Use the [migration guide](migration.md) to map v1 predicates to the current event-based filter model, register a v2 hook, test deliveries, and then retire the legacy definition.

</details>

## Operating questions

<details>
<summary>Can I edit an existing chainhook?</summary>

Yes. Use the SDK or API to update a chainhook definition in place. Start with the [update guide](update.md).

</details>

<details>
<summary>Can I filter by multiple event types?</summary>

Yes. Add multiple entries to `filters.events`. A chainhook triggers when any event filter matches. See [filters](reference/filters.md#combining-filters).

</details>

<details>
<summary>What happens if my webhook endpoint is down?</summary>

Chainhooks retries deliveries and may pause the hook if the endpoint continues to fail. After you recover the consumer, use [evaluate](evaluate.md) to replay known blocks if needed.

</details>

<details>
<summary>Can I test chainhooks against historical blocks?</summary>

Yes. Use [evaluate](evaluate.md) to replay a specific block height or block hash.

</details>

## Support

- Discord: `#chainhook` in [Stacks Discord](https://stacks.chat/)
- Product access and API keys: [Hiro Platform](https://platform.hiro.so)
45 changes: 45 additions & 0 deletions docs/build/chainhooks/fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
description: List and fetch Hiro Chainhooks with the SDK.
---

# Fetch Chainhooks

Use the SDK to paginate through your existing hooks or retrieve one hook by UUID.

## List chainhooks

```ts
import { ChainhooksClient, CHAINHOOKS_BASE_URL } from '@hirosystems/chainhooks-client';

const client = new ChainhooksClient({
baseUrl: CHAINHOOKS_BASE_URL.testnet,
apiKey: process.env.HIRO_API_KEY!,
});

const chainhooks = await client.getChainhooks();

console.log('Total chainhooks:', chainhooks.total);
console.log('Results:', chainhooks.results.length);
console.log('Limit:', chainhooks.limit);
console.log('Offset:', chainhooks.offset);
```

### Paginate results

```ts
const chainhooks = await client.getChainhooks({
limit: 50,
offset: 100,
});
```

## Fetch a single chainhook

```ts
const chainhook = await client.getChainhook('be4ab3ed-b606-4fe0-97c4-6c0b1ac9b185');
```

## Next steps

- [Update chainhooks](update.md)
- [Create chainhooks](create.md)
Loading
Loading