mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-01-12 16:52:57 +08:00
feat: upgrade service start implementation + documentation
This commit is contained in:
21
README.md
21
README.md
@@ -604,7 +604,24 @@ Tbe first time this command run, a chainstate archive will be downloaded, uncomp
|
||||
The subsequent scans will use the cached chainstate if already present, speeding up iterations and the overall feedback loop.
|
||||
|
||||
---
|
||||
## Running `chainhook` in production mode
|
||||
## Run `chainhook` as a service for streaming new blocks
|
||||
|
||||
To be documented.
|
||||
`chainhook` can be ran as a background service for streaming and processing new canonical blocks appended to the Bitcoin and Stacks blockchains.
|
||||
|
||||
When running chainhook as a service, `if_this` / `then_that` predicates can be registered by passing the path of the `json` file in the command line:
|
||||
|
||||
```bash
|
||||
$ chainhook service start --predicate-path=./path/to/predicate-1.json --predicate-path=./path/to/predicate-2.json --config-path=./path/to/config.toml
|
||||
```
|
||||
|
||||
Predicates can also be added dynamically. When the `--predicate-path` option is not passed or when the `--start-http-api` option is passed, `chainhook` will instantiate a REST API allowing developers to list, add and removes preducates at runtime:
|
||||
|
||||
```bash
|
||||
$ chainhook service start --config-path=./path/to/config.toml
|
||||
```
|
||||
|
||||
```bash
|
||||
$ chainhook service start --predicate-path=./path/to/predicate-1.json --start-http-api --config-path=./path/to/config.toml
|
||||
```
|
||||
|
||||
A comprehensive OpenAPI spcification explaining how to interact with the Chainhook REST API can be found [here](./docs/chainhook-openapi.json).
|
||||
|
||||
Reference in New Issue
Block a user