From 9542d6e16a314046514486c2de6ba06c624c7e6a Mon Sep 17 00:00:00 2001 From: Ryan Waits Date: Tue, 3 Oct 2023 12:55:48 -0500 Subject: [PATCH 1/8] update copy --- .../how-to-explore-ordinal-activities.md | 8 ++++---- ...how-to-use-ordhook-as-a-service-using-bitcoind.md | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/how-to-guides/how-to-explore-ordinal-activities.md b/docs/how-to-guides/how-to-explore-ordinal-activities.md index e2aded8a..df831bf8 100644 --- a/docs/how-to-guides/how-to-explore-ordinal-activities.md +++ b/docs/how-to-guides/how-to-explore-ordinal-activities.md @@ -2,7 +2,7 @@ title: Explore Ordinal activities in your terminal --- -Ordhook can be used to extract ordinal activities from the Bitcoin chain and stream these activities to the indexer. This guide helps you with the steps to explore ordinal activities and post these activities to the indexer. +Ordhook is a tool that helps you find ordinal activities from the Bitcoin chain. Think of it like a detective that can find and track these activities for you. Once it finds these activities, it can be used to help build your own database. This guide will show you how to use Ordhook to stream these activities. ### Explore ordinal activity @@ -32,9 +32,9 @@ Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 r Number of transfers: 2 ``` -### Configure ordhook +### Configure Ordhook -This section walks you through streaming ordinal activities to an indexer. To post the ordinal activity, you'll need to configure bitcoind. Refer to [Setting up a bitcoin node](https://docs.hiro.so/chainhook/how-to-guides/how-to-run-chainhook-as-a-service-using-bitcoind#setting-up-a-bitcoin-node) to understand the steps to configure Bitcoind. +This section walks you through streaming ordinal activities. To post the ordinal activity, you'll need to configure bitcoind. Refer to [Setting up a bitcoin node](https://docs.hiro.so/ordhook/how-to-guides/how-to-run-chainhook-as-a-service-using-bitcoind#setting-up-a-bitcoin-node) to understand the steps to configure Bitcoind. > **_NOTE_** > Ordhook is applicable to the Bitcoin chain only. @@ -98,7 +98,7 @@ bitcoind_rpc_password = "devnet" bitcoind_zmq_url = "tcp://0.0.0.0:18543" ``` -### Post ordinal activity to the indexer +### Post ordinal activity to an external endpoint After adjusting the `Ordhook.toml` settings to make them match the bitcoind configuration, the following command can be run to scan blocks and post events to a local server. diff --git a/docs/how-to-guides/how-to-use-ordhook-as-a-service-using-bitcoind.md b/docs/how-to-guides/how-to-use-ordhook-as-a-service-using-bitcoind.md index aba709b8..683aeedd 100644 --- a/docs/how-to-guides/how-to-use-ordhook-as-a-service-using-bitcoind.md +++ b/docs/how-to-guides/how-to-use-ordhook-as-a-service-using-bitcoind.md @@ -4,24 +4,24 @@ title: Run Ordhook as a Service using Bitcoind ## Run ordhook as a service using Bitcoind -In this section, you'll learn how to run Ordhook as a service using [Chainhook SDK](https://github.com/hirosystems/chainhook/tree/develop/components/chainhook-sdk) to create a predicate ordinal theory and post events to a server. +In this section, you'll learn how to run Ordhook as a service using [Ordhook SDK](https://github.com/hirosystems/ordhook/tree/develop/components/ordhook-sdk-js) to post events to a server. ## Prerequisites - [Bitcoind configuration](https://docs.hiro.so/chainhook/how-to-guides/how-to-run-chainhook-as-a-service-using-bitcoind#setting-up-a-bitcoin-node) -- Configure ordhook by following [this](./how-to-explore-ordinal-activities.md#configure-ordhook) section +- Configure Ordhook by following [this](./how-to-explore-ordinal-activities.md#configure-ordhook) section ## Run ordhook service for streaming blocks -Use the following command to start the ordhook service for streaming and processing new blocks appended to the Bitcoin blockchain. +Use the following command to start the Ordhook service for streaming and processing new blocks appended to the Bitcoin blockchain. `ordhook service start --post-to=http://localhost:3000/api/events --config-path=./Ordhook.toml` -When the ordhook service starts, the chainhook service gets initiated in the background to augment the blocks that Bitcoind sends. The bitcoind sends zeromq notifications to Ordhook to retrieve the inscriptions. +When the Ordhook service starts, the chainhook service gets initiated in the background to augment the blocks from Bitcoin. Bitcoind sends ZeroMQ notifications to Ordhook to retrieve the inscriptions. ### Add `http-post` endpoints dynamically -To enable dynamically posting endpoints to the server, you can spin up the redis server by enabling the following lines of code in the `ordhook.toml` file. +To enable dynamically posting endpoints to the server, you can spin up the Redis server by enabling the following lines of code in the `Ordhook.toml` file. ```toml [http_api] @@ -35,4 +35,4 @@ Based on the `Ordhook.toml` file configuration, the ordhook service spins up an `ordhook service start --config-path=./Ordhook.toml` -A comprehensive OpenAPI specification explaining how to interact with this HTTP REST API can be found [here](https://github.com/hirosystems/chainhook/blob/develop/docs/chainhook-openapi.json). +A comprehensive OpenAPI specification explaining how to interact with this HTTP REST API can be found [here](https://github.com/hirosystems/ordhook/blob/develop/docs/ordhook-openapi.json). From 23937a98f4a1c7b39baf760303f256f620e99d54 Mon Sep 17 00:00:00 2001 From: Ryan Waits Date: Tue, 3 Oct 2023 12:56:14 -0500 Subject: [PATCH 2/8] add openapi reference file to ordhook docs for better context --- docs/ordhook-openapi.json | 1159 +++++++++++++++++++++++++++++++++++++ 1 file changed, 1159 insertions(+) create mode 100644 docs/ordhook-openapi.json diff --git a/docs/ordhook-openapi.json b/docs/ordhook-openapi.json new file mode 100644 index 00000000..f70b8017 --- /dev/null +++ b/docs/ordhook-openapi.json @@ -0,0 +1,1159 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "chainhook", + "version": "1.0.0" + }, + "paths": { + "/ping": { + "get": { + "tags": [ + "Health Check" + ], + "operationId": "handle_ping", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + }, + "/v1/chainhooks": { + "get": { + "tags": [ + "Managing Predicates" + ], + "operationId": "handle_get_predicates", + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} + } + } + } + } + }, + "post": { + "tags": [ + "Managing Predicates" + ], + "operationId": "handle_create_predicate", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChainhookFullSpecification" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + }, + "/v1/chainhooks/{predicate_uuid}": { + "get": { + "tags": [ + "Managing Predicates" + ], + "operationId": "handle_get_predicate", + "parameters": [ + { + "name": "predicate_uuid", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + }, + "/v1/chainhooks/bitcoin/{predicate_uuid}": { + "delete": { + "tags": [ + "Managing Predicates" + ], + "operationId": "handle_delete_bitcoin_predicate", + "parameters": [ + { + "name": "predicate_uuid", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + }, + "/v1/chainhooks/stacks/{predicate_uuid}": { + "delete": { + "tags": [ + "Managing Predicates" + ], + "operationId": "handle_delete_stacks_predicate", + "parameters": [ + { + "name": "predicate_uuid", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": {} + } + } + } + } + } + } + }, + "components": { + "schemas": { + "ChainhookFullSpecification": { + "oneOf": [ + { + "type": "object", + "required": [ + "chain", + "name", + "networks", + "uuid", + "version" + ], + "properties": { + "chain": { + "type": "string", + "enum": [ + "bitcoin" + ] + }, + "uuid": { + "type": "string" + }, + "owner_uuid": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "networks": { + "oneOf": [ + { + "type": "object", + "required": [ + "regtest" + ], + "properties": { + "regtest": { + "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" + } + } + }, + { + "type": "object", + "required": [ + "testnet" + ], + "properties": { + "testnet": { + "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" + } + } + }, + { + "type": "object", + "required": [ + "mainnet" + ], + "properties": { + "mainnet": { + "$ref": "#/components/schemas/BitcoinChainhookNetworkSpecification" + } + } + } + ] + } + } + }, + { + "type": "object", + "required": [ + "chain", + "name", + "networks", + "uuid", + "version" + ], + "properties": { + "chain": { + "type": "string", + "enum": [ + "stacks" + ] + }, + "uuid": { + "type": "string" + }, + "owner_uuid": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "version": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "networks": { + "oneOf": [ + { + "type": "object", + "required": [ + "simnet" + ], + "properties": { + "simnet": { + "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" + } + } + }, + { + "type": "object", + "required": [ + "devnet" + ], + "properties": { + "devnet": { + "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" + } + } + }, + { + "type": "object", + "required": [ + "testnet" + ], + "properties": { + "testnet": { + "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" + } + } + }, + { + "type": "object", + "required": [ + "mainnet" + ], + "properties": { + "mainnet": { + "$ref": "#/components/schemas/StacksChainhookNetworkSpecification" + } + } + } + ] + } + } + } + ] + }, + "BitcoinNetwork": { + "type": "string", + "enum": [ + "regtest", + "testnet", + "mainnet" + ] + }, + "BitcoinChainhookNetworkSpecification": { + "type": "object", + "required": [ + "if_this", + "then_that" + ], + "properties": { + "blocks": { + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "nullable": true + }, + "start_block": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "end_block": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "expire_after_occurrence": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "include_proof": { + "type": "boolean", + "nullable": true + }, + "include_inputs": { + "type": "boolean", + "nullable": true + }, + "include_outputs": { + "type": "boolean", + "nullable": true + }, + "include_witness": { + "type": "boolean", + "nullable": true + }, + "if_this": { + "$ref": "#/components/schemas/BitcoinPredicateType" + }, + "then_that": { + "$ref": "#/components/schemas/HookAction" + } + } + }, + "BitcoinPredicateType": { + "oneOf": [ + { + "type": "object", + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "block" + ] + } + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "equals" + ], + "properties": { + "equals": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "txid" + ] + } + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "txid" + ], + "properties": { + "txid": { + "$ref": "#/components/schemas/TxinPredicate" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "witness_script" + ], + "properties": { + "witness_script": { + "$ref": "#/components/schemas/MatchingRule" + } + }, + "additionalProperties": false + } + ], + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "inputs" + ] + } + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "op_return" + ], + "properties": { + "op_return": { + "$ref": "#/components/schemas/MatchingRule" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "p2pkh" + ], + "properties": { + "p2pkh": { + "$ref": "#/components/schemas/ExactMatchingRule" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "p2sh" + ], + "properties": { + "p2sh": { + "$ref": "#/components/schemas/ExactMatchingRule" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "p2wpkh" + ], + "properties": { + "p2wpkh": { + "$ref": "#/components/schemas/ExactMatchingRule" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "p2wsh" + ], + "properties": { + "p2wsh": { + "$ref": "#/components/schemas/ExactMatchingRule" + } + }, + "additionalProperties": false + } + ], + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "outputs" + ] + } + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "operation" + ], + "properties": { + "operation": { + "type": "string", + "enum": [ + "stacker_rewarded" + ] + } + } + }, + { + "type": "object", + "required": [ + "operation" + ], + "properties": { + "operation": { + "type": "string", + "enum": [ + "block_committed" + ] + } + } + }, + { + "type": "object", + "required": [ + "operation" + ], + "properties": { + "operation": { + "type": "string", + "enum": [ + "leader_registered" + ] + } + } + }, + { + "type": "object", + "required": [ + "operation" + ], + "properties": { + "operation": { + "type": "string", + "enum": [ + "stx_transferred" + ] + } + } + }, + { + "type": "object", + "required": [ + "operation" + ], + "properties": { + "operation": { + "type": "string", + "enum": [ + "stx_locked" + ] + } + } + } + ], + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "stacks_protocol" + ] + } + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "operation" + ], + "properties": { + "operation": { + "type": "string", + "enum": [ + "inscription_feed" + ] + } + } + } + ], + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "ordinals_protocol" + ] + } + } + } + ] + }, + "TxinPredicate": { + "type": "object", + "required": [ + "txid", + "vout" + ], + "properties": { + "txid": { + "type": "string" + }, + "vout": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + }, + "MatchingRule": { + "oneOf": [ + { + "type": "object", + "required": [ + "equals" + ], + "properties": { + "equals": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "starts_with" + ], + "properties": { + "starts_with": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "ends_with" + ], + "properties": { + "ends_with": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "ExactMatchingRule": { + "oneOf": [ + { + "type": "object", + "required": [ + "equals" + ], + "properties": { + "equals": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "HookAction": { + "oneOf": [ + { + "type": "string", + "enum": [ + "noop" + ] + }, + { + "type": "object", + "required": [ + "http_post" + ], + "properties": { + "http_post": { + "$ref": "#/components/schemas/HttpHook" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "file_append" + ], + "properties": { + "file_append": { + "$ref": "#/components/schemas/FileHook" + } + }, + "additionalProperties": false + } + ] + }, + "HttpHook": { + "type": "object", + "required": [ + "authorization_header", + "url" + ], + "properties": { + "url": { + "type": "string" + }, + "authorization_header": { + "type": "string" + } + } + }, + "FileHook": { + "type": "object", + "required": [ + "path" + ], + "properties": { + "path": { + "type": "string" + } + } + }, + "StacksNetwork": { + "type": "string", + "enum": [ + "simnet", + "devnet", + "testnet", + "mainnet" + ] + }, + "StacksChainhookNetworkSpecification": { + "type": "object", + "required": [ + "if_this", + "then_that" + ], + "properties": { + "blocks": { + "type": "array", + "items": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "nullable": true + }, + "start_block": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "end_block": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "expire_after_occurrence": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "capture_all_events": { + "type": "boolean", + "nullable": true + }, + "decode_clarity_values": { + "type": "boolean", + "nullable": true + }, + "include_contract_abi": { + "type": "boolean", + "nullable": true + }, + "if_this": { + "$ref": "#/components/schemas/StacksPredicate" + }, + "then_that": { + "$ref": "#/components/schemas/HookAction" + } + } + }, + "StacksPredicate": { + "oneOf": [ + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "equals" + ], + "properties": { + "equals": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "higher_than" + ], + "properties": { + "higher_than": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "lower_than" + ], + "properties": { + "lower_than": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "between" + ], + "properties": { + "between": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + ] + }, + "maxItems": 2, + "minItems": 2 + } + }, + "additionalProperties": false + } + ], + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "block_height" + ] + } + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "deployer" + ], + "properties": { + "deployer": { + "type": "string" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "implement_trait" + ], + "properties": { + "implement_trait": { + "$ref": "#/components/schemas/StacksTrait" + } + }, + "additionalProperties": false + } + ], + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "contract_deployment" + ] + } + } + }, + { + "type": "object", + "required": [ + "contract_identifier", + "method", + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "contract_call" + ] + }, + "contract_identifier": { + "type": "string" + }, + "method": { + "type": "string" + } + } + }, + { + "type": "object", + "anyOf": [ + { + "type": "object", + "required": [ + "contains", + "contract_identifier" + ], + "properties": { + "contract_identifier": { + "type": "string" + }, + "contains": { + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "contract_identifier", + "matches_regex" + ], + "properties": { + "contract_identifier": { + "type": "string" + }, + "matches_regex": { + "type": "string" + } + } + } + ], + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "print_event" + ] + } + } + }, + { + "type": "object", + "required": [ + "actions", + "asset_identifier", + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "ft_event" + ] + }, + "asset_identifier": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + { + "type": "object", + "required": [ + "actions", + "asset_identifier", + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "nft_event" + ] + }, + "asset_identifier": { + "type": "string" + }, + "actions": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + { + "type": "object", + "required": [ + "actions", + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "stx_event" + ] + }, + "actions": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "equals" + ], + "properties": { + "equals": { + "type": "string" + } + }, + "additionalProperties": false + } + ], + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "txid" + ] + } + } + } + ] + }, + "StacksTrait": { + "type": "string", + "enum": [ + "sip09", + "sip10", + "*" + ] + } + } + } +} \ No newline at end of file From 6f10325b102d445504188569956b75fdc4daed75 Mon Sep 17 00:00:00 2001 From: Ryan Waits Date: Tue, 3 Oct 2023 12:59:16 -0500 Subject: [PATCH 3/8] typo in reference link for bitcoind --- docs/how-to-guides/how-to-explore-ordinal-activities.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how-to-guides/how-to-explore-ordinal-activities.md b/docs/how-to-guides/how-to-explore-ordinal-activities.md index df831bf8..297c8aa7 100644 --- a/docs/how-to-guides/how-to-explore-ordinal-activities.md +++ b/docs/how-to-guides/how-to-explore-ordinal-activities.md @@ -34,7 +34,7 @@ Number of transfers: 2 ### Configure Ordhook -This section walks you through streaming ordinal activities. To post the ordinal activity, you'll need to configure bitcoind. Refer to [Setting up a bitcoin node](https://docs.hiro.so/ordhook/how-to-guides/how-to-run-chainhook-as-a-service-using-bitcoind#setting-up-a-bitcoin-node) to understand the steps to configure Bitcoind. +This section walks you through streaming ordinal activities. To post the ordinal activity, you'll need to configure bitcoind. Refer to [Setting up a bitcoin node](https://docs.hiro.so/chainhook/how-to-guides/how-to-run-chainhook-as-a-service-using-bitcoind#setting-up-a-bitcoin-node) to understand the steps to configure Bitcoind. > **_NOTE_** > Ordhook is applicable to the Bitcoin chain only. From f27104218d0bbe3cfe4f7e56e515e82f299aff3f Mon Sep 17 00:00:00 2001 From: Ryan Waits Date: Tue, 3 Oct 2023 13:00:40 -0500 Subject: [PATCH 4/8] remove references to chainhook --- docs/how-to-guides/how-to-explore-ordinal-activities.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/how-to-guides/how-to-explore-ordinal-activities.md b/docs/how-to-guides/how-to-explore-ordinal-activities.md index 297c8aa7..95118a95 100644 --- a/docs/how-to-guides/how-to-explore-ordinal-activities.md +++ b/docs/how-to-guides/how-to-explore-ordinal-activities.md @@ -64,7 +64,7 @@ mode = "mainnet" bitcoind_rpc_url = "http://0.0.0.0:8332" bitcoind_rpc_username = "devnet" bitcoind_rpc_password = "devnet" -# Bitcoin block events can be received by Chainhook +# Bitcoin block events can be received by Ordhook # either through a Bitcoin node's ZeroMQ interface, # or through the Stacks node. Zmq is being # used by default: @@ -104,6 +104,6 @@ After adjusting the `Ordhook.toml` settings to make them match the bitcoind conf `ordhook scan blocks 767430 767753 --post-to=http://localhost:3000/api/events --config-path=./Ordhook.toml` -The above command uses chainhook to create a predicate ordinal theory where one of the inscriptions is created and posts the events to `http://localhost:3000/api/events`. +The above command uses Ordhook to create a predicate ordinal theory where one of the inscriptions is created and posts the events to `http://localhost:3000/api/events`. You can update the above command to scan between block heights and post events to the local server. From 0f7f33595227d5127a8c5f5930e25ba20dd0b4a7 Mon Sep 17 00:00:00 2001 From: Ryan Waits Date: Tue, 3 Oct 2023 13:44:17 -0500 Subject: [PATCH 5/8] break out guides for scanning and streaming ordinal activities --- ...run-ordhook-as-a-service-using-bitcoind.md | 153 ++++++++++++++++++ .../how-to-scan-ordinal-activities.md | 33 ++++ ...md => how-to-stream-ordinal-activities.md} | 32 +--- ...use-ordhook-as-a-service-using-bitcoind.md | 38 ----- 4 files changed, 188 insertions(+), 68 deletions(-) create mode 100644 docs/how-to-guides/how-to-run-ordhook-as-a-service-using-bitcoind.md create mode 100644 docs/how-to-guides/how-to-scan-ordinal-activities.md rename docs/how-to-guides/{how-to-explore-ordinal-activities.md => how-to-stream-ordinal-activities.md} (62%) delete mode 100644 docs/how-to-guides/how-to-use-ordhook-as-a-service-using-bitcoind.md diff --git a/docs/how-to-guides/how-to-run-ordhook-as-a-service-using-bitcoind.md b/docs/how-to-guides/how-to-run-ordhook-as-a-service-using-bitcoind.md new file mode 100644 index 00000000..1421a69f --- /dev/null +++ b/docs/how-to-guides/how-to-run-ordhook-as-a-service-using-bitcoind.md @@ -0,0 +1,153 @@ +--- +title: Run Ordhook as a Service using Bitcoind +--- + +## Prerequisites + +### Setting up a Bitcoin Node + +The Bitcoin Core daemon (bitcoind) is a program that implements the Bitcoin protocol for remote procedure call (RPC) use. Chainhook can be set up to interact with the Bitcoin chainstate through bitcoind's ZeroMQ interface, its embedded networking library, passing raw blockchain data to be evaluated for relevant events. + +This guide is written to work with the latest Bitcoin Core software containing bitcoind, [Bitcoin Core 25.0](https://bitcoincore.org/bin/bitcoin-core-25.0/). + +> **_NOTE:_** +> +> While bitcoind can and will start syncing a Bitcoin node, customizing this node to your use cases beyond supporting a Chainhook is out of scope for this guide. See the Bitcoin wiki for ["Running Bitcoin"](https://en.bitcoin.it/wiki/Running_Bitcoin) or bitcoin.org [Running A Full Node guide](https://bitcoin.org/en/full-node). + +- Make note of the path of your `bitcoind` executable (located within the `bin` directory of the `bitcoin-25.0` folder you downloaded above appropriate to your operating system) +- Navigate to your project folder where your Chainhook node will reside, create a new file, and rename it to `bitcoin.conf`. Copy the configuration below to this `bitcoin.conf` file. +- Find and copy your Bitcoin data directory and paste to the `datadir` field in the `bitcoin.conf` file below. Either copy the default path (see [list of default directories by operating system](https://en.bitcoin.it/wiki/Data_directory)) or copy the custom path you set for your Bitcoin data +- Set a username of your choice for bitcoind and use it in the `rpcuser` configuration below (`devnet` is a default). +- Set a password of your choice for bitcoind and use it in the `rpcpassword` configuration below (`devnet` is a default). + +```conf +# Bitcoin Core Configuration + +datadir=/path/to/bitcoin/directory/ # Path to Bitcoin directory +server=1 +rpcuser=devnet +rpcpassword=devnet +rpcport=8332 +rpcallowip=0.0.0.0/0 +rpcallowip=::/0 +txindex=1 +listen=1 +discover=0 +dns=0 +dnsseed=0 +listenonion=0 +rpcserialversion=1 +disablewallet=0 +fallbackfee=0.00001 +rpcthreads=8 +blocksonly=1 +dbcache=4096 + +# Start zeromq +zmqpubhashblock=tcp://0.0.0.0:18543 +``` + +> **_NOTE:_** +> +> The below command is a startup process that, if this is your first time syncing a node, might take a few hours to a few days to run. Alternatively, if the directory pointed to in the `datadir` field above contains bitcoin blockchain data, syncing will resume. + +Now that you have the `bitcoin.conf` file ready with the bitcoind configurations, you can run the bitcoind node. The command takes the form `path/to/bitcoind -conf=path/to/bitcoin.conf`, for example: + +```console +/Volumes/SSD/bitcoin-25.0/bin/bitcoind -conf=/Volumes/SSD/project/Chainhook/bitcoin.conf +``` + +Once the above command runs, you will see `zmq_url` entries in the console's stdout, displaying ZeroMQ logs of your bitcoin node. + +### Configure Ordhook + +In this section, you will configure Ordhook to match the network configurations with the bitcoin config file. First, [install the latest version of Ordhook](../getting-started.md#installing-ordhook). + +Next, you will generate a `Ordhook.toml` file to connect Ordhook with your bitcoind node. Navigate to the directory where you want to generate the `Ordhook.toml` file and use the following command in your terminal: + +```console +chainhook config generate --mainnet +``` + +Several network parameters in the generated `Chainhook.toml` configuration file need to match those in the `bitcoin.conf` file created earlier in the [Setting up a Bitcoin Node](#setting-up-a-bitcoin-node) section. Please update the following parameters accordingly: + +1. Update `bitcoind_rpc_username` with the username set for `rpcuser` in `bitcoin.conf`. +2. Update `bitcoind_rpc_password` with the password set for `rpcpassword` in `bitcoin.conf`. +3. Update `bitcoind_rpc_url` with the same host and port used for `rpcport` in `bitcoin.conf`. + +Additionally, if you want to receive events from the configured Bitcoin node, substitute `stacks_node_rpc_url` with `bitcoind_zmq_url`, as follows: + +```toml +[storage] +working_dir = "cache" + +# The Http Api allows you to register / deregister +# predicates dynamically. +# This is disabled by default. + +# [http_api] +# http_port = 20456 +# database_uri = "redis://localhost:6379/" + +[network] +mode = "mainnet" +bitcoind_rpc_url = "http://localhost:8332" +bitcoind_rpc_username = "devnet" +bitcoind_rpc_password = "devnet" +# Bitcoin block events can be received by Chainhook +# either through a Bitcoin node's ZeroMQ interface, +# or through the Stacks node. The Stacks node is +# used by default: +# stacks_node_rpc_url = "http://localhost:20443" +# but zmq can be used instead: +bitcoind_zmq_url = "tcp://0.0.0.0:18543" + +[limits] +max_number_of_bitcoin_predicates = 100 +max_number_of_concurrent_bitcoin_scans = 100 +max_number_of_stacks_predicates = 10 +max_number_of_concurrent_stacks_scans = 10 +max_number_of_processing_threads = 16 +max_number_of_networking_threads = 16 +max_caching_memory_size_mb = 32000 + +[[event_source]] +tsv_file_url = "https://archive.hiro.so/mainnet/stacks-blockchain-api/mainnet-stacks-blockchain-api-latest" +``` + +Here is a table of the relevant parameters this guide changes in our configuration files. + +| bitcoin.conf | Chainhook.toml | +| --------------- | --------------------- | +| rpcuser | bitcoind_rpc_username | +| rpcpassword | bitcoind_rpc_password | +| rpcport | bitcoind_rpc_url | +| zmqpubhashblock | bitcoind_zmq_url | + +## Initiate Ordhook Service + +In this section, you'll learn how to run Ordhook as a service using [Ordhook SDK](https://github.com/hirosystems/ordhook/tree/develop/components/ordhook-sdk-js) to post events to a server. + +Use the following command to start the Ordhook service for streaming and processing new blocks appended to the Bitcoin blockchain. + +`ordhook service start --post-to=http://localhost:3000/api/events --config-path=./Ordhook.toml` + +When the Ordhook service starts, the chainhook service gets initiated in the background to augment the blocks from Bitcoin. Bitcoind sends ZeroMQ notifications to Ordhook to retrieve the inscriptions. + +### Add `http-post` endpoints dynamically + +To enable dynamically posting endpoints to the server, you can spin up the Redis server by enabling the following lines of code in the `Ordhook.toml` file. + +```toml +[http_api] +http_port = 20456 +database_uri = "redis://localhost:6379/" +``` + +## Run ordhook service + +Based on the `Ordhook.toml` file configuration, the ordhook service spins up an HTTP API to manage event destinations. Use the following command to start the ordhook service. + +`ordhook service start --config-path=./Ordhook.toml` + +A comprehensive OpenAPI specification explaining how to interact with this HTTP REST API can be found [here](https://github.com/hirosystems/ordhook/blob/develop/docs/ordhook-openapi.json). diff --git a/docs/how-to-guides/how-to-scan-ordinal-activities.md b/docs/how-to-guides/how-to-scan-ordinal-activities.md new file mode 100644 index 00000000..e29479bb --- /dev/null +++ b/docs/how-to-guides/how-to-scan-ordinal-activities.md @@ -0,0 +1,33 @@ +--- +title: Scan Ordinal Activities in your Terminal +--- + +Ordhook is a tool that helps you find ordinal activities from the Bitcoin chain. Think of it like a detective that can find and track these activities for you. Once it finds these activities, it can be used to help build your own database. This guide will show you how to use Ordhook to scan these activities in your terminal. + +### Explore ordinal activity + +You can use the following command to scan a range of blocks on mainnet or testnet. + +`ordhook scan blocks 767430 767753 --mainnet` + +The above command generates a `hord.sqlite.gz` file in your directory and displays inscriptions and transfers activities occurring in the range of the specified blocks. + +The output of the above command looks like this: + +``` +Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 revealed at block #767430 (ordinal_number 1252201400444387, inscription_number 0) +Inscription 26482871f33f1051f450f2da9af275794c0b5f1c61ebf35e4467fb42c2813403i0 revealed at block #767753 (ordinal_number 727624168684699, inscription_number 1) +``` + +You can now generate an activity for a given inscription by using the following command: + +`ordhook scan inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 --mainnet` + +The above command generates the ordinal activity for that inscription and also the number of transfers in the transactions. + +``` +Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 revealed at block #767430 (inscription_number 0, ordinal_number 1252201400444387) + → Transferred in transaction 0x2c8a11858825ae2056be90c3e49938d271671ac4245b452cd88b1475cbea8971 (block #785391) + → Transferred in transaction 0xbc4c30829a9564c0d58e6287195622b53ced54a25711d1b86be7cd3a70ef61ed (block #785396) +Number of transfers: 2 +``` diff --git a/docs/how-to-guides/how-to-explore-ordinal-activities.md b/docs/how-to-guides/how-to-stream-ordinal-activities.md similarity index 62% rename from docs/how-to-guides/how-to-explore-ordinal-activities.md rename to docs/how-to-guides/how-to-stream-ordinal-activities.md index 95118a95..3c67acf3 100644 --- a/docs/how-to-guides/how-to-explore-ordinal-activities.md +++ b/docs/how-to-guides/how-to-stream-ordinal-activities.md @@ -1,40 +1,12 @@ --- -title: Explore Ordinal activities in your terminal +title: Stream Ordinal Activities to an API --- Ordhook is a tool that helps you find ordinal activities from the Bitcoin chain. Think of it like a detective that can find and track these activities for you. Once it finds these activities, it can be used to help build your own database. This guide will show you how to use Ordhook to stream these activities. -### Explore ordinal activity - -You can use the following command to scan a range of blocks on mainnet or testnet. - -`ordhook scan blocks 767430 767753 --mainnet` - -The above command generates a `hord.sqlite.gz` file in your directory and displays inscriptions and transfers activities occurring in the range of the specified blocks. - -The output of the above command looks like this: - -``` -Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 revealed at block #767430 (ordinal_number 1252201400444387, inscription_number 0) -Inscription 26482871f33f1051f450f2da9af275794c0b5f1c61ebf35e4467fb42c2813403i0 revealed at block #767753 (ordinal_number 727624168684699, inscription_number 1) -``` - -You can now generate an activity for a given inscription by using the following command: - -`ordhook scan inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 --mainnet` - -The above command generates the ordinal activity for that inscription and also the number of transfers in the transactions. - -``` -Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 revealed at block #767430 (inscription_number 0, ordinal_number 1252201400444387) - → Transferred in transaction 0x2c8a11858825ae2056be90c3e49938d271671ac4245b452cd88b1475cbea8971 (block #785391) - → Transferred in transaction 0xbc4c30829a9564c0d58e6287195622b53ced54a25711d1b86be7cd3a70ef61ed (block #785396) -Number of transfers: 2 -``` - ### Configure Ordhook -This section walks you through streaming ordinal activities. To post the ordinal activity, you'll need to configure bitcoind. Refer to [Setting up a bitcoin node](https://docs.hiro.so/chainhook/how-to-guides/how-to-run-chainhook-as-a-service-using-bitcoind#setting-up-a-bitcoin-node) to understand the steps to configure Bitcoind. +This section walks you through streaming ordinal activities. To post the ordinal activity, you'll need to configure bitcoind. Refer to [Setting up a bitcoin node](./how-to-run-ordhook-as-a-service-using-bitcoind.md#setting-up-a-bitcoin-node) to understand the steps to configure Bitcoind. > **_NOTE_** > Ordhook is applicable to the Bitcoin chain only. diff --git a/docs/how-to-guides/how-to-use-ordhook-as-a-service-using-bitcoind.md b/docs/how-to-guides/how-to-use-ordhook-as-a-service-using-bitcoind.md deleted file mode 100644 index 683aeedd..00000000 --- a/docs/how-to-guides/how-to-use-ordhook-as-a-service-using-bitcoind.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: Run Ordhook as a Service using Bitcoind ---- - -## Run ordhook as a service using Bitcoind - -In this section, you'll learn how to run Ordhook as a service using [Ordhook SDK](https://github.com/hirosystems/ordhook/tree/develop/components/ordhook-sdk-js) to post events to a server. - -## Prerequisites - -- [Bitcoind configuration](https://docs.hiro.so/chainhook/how-to-guides/how-to-run-chainhook-as-a-service-using-bitcoind#setting-up-a-bitcoin-node) -- Configure Ordhook by following [this](./how-to-explore-ordinal-activities.md#configure-ordhook) section - -## Run ordhook service for streaming blocks - -Use the following command to start the Ordhook service for streaming and processing new blocks appended to the Bitcoin blockchain. - -`ordhook service start --post-to=http://localhost:3000/api/events --config-path=./Ordhook.toml` - -When the Ordhook service starts, the chainhook service gets initiated in the background to augment the blocks from Bitcoin. Bitcoind sends ZeroMQ notifications to Ordhook to retrieve the inscriptions. - -### Add `http-post` endpoints dynamically - -To enable dynamically posting endpoints to the server, you can spin up the Redis server by enabling the following lines of code in the `Ordhook.toml` file. - -```toml -[http_api] -http_port = 20456 -database_uri = "redis://localhost:6379/" -``` - -## Run ordhook service - -Based on the `Ordhook.toml` file configuration, the ordhook service spins up an HTTP API to manage event destinations. Use the following command to start the ordhook service. - -`ordhook service start --config-path=./Ordhook.toml` - -A comprehensive OpenAPI specification explaining how to interact with this HTTP REST API can be found [here](https://github.com/hirosystems/ordhook/blob/develop/docs/ordhook-openapi.json). From f602d89e6534a251f19ed567769eef7d1b78a820 Mon Sep 17 00:00:00 2001 From: Ryan Waits Date: Tue, 3 Oct 2023 13:48:44 -0500 Subject: [PATCH 6/8] fix references to Ordhook.toml --- docs/how-to-guides/how-to-stream-ordinal-activities.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/how-to-guides/how-to-stream-ordinal-activities.md b/docs/how-to-guides/how-to-stream-ordinal-activities.md index 3c67acf3..e277ec66 100644 --- a/docs/how-to-guides/how-to-stream-ordinal-activities.md +++ b/docs/how-to-guides/how-to-stream-ordinal-activities.md @@ -17,7 +17,7 @@ Once the Bitcoin node is configured, you can use the following command in your t You will see a success message "Created file Ordhook.toml" in your terminal. -The generated `ordhook.toml` file looks like this: +The generated `Ordhook.toml` file looks like this: ```toml [storage] @@ -61,7 +61,7 @@ ordinals_internals = true chainhook_internals = true ``` -Observe that the bitcoind configured fields will appear in the `ordhook.toml` file. Now, ensure that these fields are configured with the right values and URLs, as shown below: +Observe that the bitcoind configured fields will appear in the `Ordhook.toml` file. Now, ensure that these fields are configured with the right values and URLs, as shown below: ```toml bitcoind_rpc_url = "http://0.0.0.0:8332" From 6edb5f422e6c2ed67e043f66b02e921d60b26761 Mon Sep 17 00:00:00 2001 From: Ryan Waits Date: Tue, 3 Oct 2023 16:01:37 -0500 Subject: [PATCH 7/8] update content for each guide --- .../how-to-scan-ordinal-activities.md | 15 +++++++++------ .../how-to-stream-ordinal-activities.md | 6 ++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/how-to-guides/how-to-scan-ordinal-activities.md b/docs/how-to-guides/how-to-scan-ordinal-activities.md index e29479bb..83191d46 100644 --- a/docs/how-to-guides/how-to-scan-ordinal-activities.md +++ b/docs/how-to-guides/how-to-scan-ordinal-activities.md @@ -12,22 +12,25 @@ You can use the following command to scan a range of blocks on mainnet or testne The above command generates a `hord.sqlite.gz` file in your directory and displays inscriptions and transfers activities occurring in the range of the specified blocks. +> **_NOTE_** +> By default, Ordhook creates a folder named `ordhook` in your current directory and stores the `hord.sqlite` file there. This file is used to pull in the latest ordinal data and scan against it based on the block numbers you provide. + The output of the above command looks like this: ``` -Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 revealed at block #767430 (ordinal_number 1252201400444387, inscription_number 0) -Inscription 26482871f33f1051f450f2da9af275794c0b5f1c61ebf35e4467fb42c2813403i0 revealed at block #767753 (ordinal_number 727624168684699, inscription_number 1) +Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 revealed at block #767430 (inscription_number 0, ordinal_number 1252201400444387) +Inscription 26482871f33f1051f450f2da9af275794c0b5f1c61ebf35e4467fb42c2813403i0 revealed at block #767753 (inscription_number 1, ordinal_number 727624168684699) ``` -You can now generate an activity for a given inscription by using the following command: +You can also get activity for a given inscription by using the following command: `ordhook scan inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 --mainnet` -The above command generates the ordinal activity for that inscription and also the number of transfers in the transactions. +The above command returns ordinal activity for that inscription and also the number of transfers in the transactions. ``` Inscription 6fb976ab49dcec017f1e201e84395983204ae1a7c2abf7ced0a85d692e442799i0 revealed at block #767430 (inscription_number 0, ordinal_number 1252201400444387) - → Transferred in transaction 0x2c8a11858825ae2056be90c3e49938d271671ac4245b452cd88b1475cbea8971 (block #785391) - → Transferred in transaction 0xbc4c30829a9564c0d58e6287195622b53ced54a25711d1b86be7cd3a70ef61ed (block #785396) + → Transferred in transaction 0x2c8a11858825ae2056be90c3e49938d271671ac4245b452cd88b1475cbea8971 (block #785391) + → Transferred in transaction 0xbc4c30829a9564c0d58e6287195622b53ced54a25711d1b86be7cd3a70ef61ed (block #785396) Number of transfers: 2 ``` diff --git a/docs/how-to-guides/how-to-stream-ordinal-activities.md b/docs/how-to-guides/how-to-stream-ordinal-activities.md index e277ec66..366707b8 100644 --- a/docs/how-to-guides/how-to-stream-ordinal-activities.md +++ b/docs/how-to-guides/how-to-stream-ordinal-activities.md @@ -36,7 +36,7 @@ mode = "mainnet" bitcoind_rpc_url = "http://0.0.0.0:8332" bitcoind_rpc_username = "devnet" bitcoind_rpc_password = "devnet" -# Bitcoin block events can be received by Ordhook +# Bitcoin block events can be received by Chainhook # either through a Bitcoin node's ZeroMQ interface, # or through the Stacks node. Zmq is being # used by default: @@ -76,6 +76,4 @@ After adjusting the `Ordhook.toml` settings to make them match the bitcoind conf `ordhook scan blocks 767430 767753 --post-to=http://localhost:3000/api/events --config-path=./Ordhook.toml` -The above command uses Ordhook to create a predicate ordinal theory where one of the inscriptions is created and posts the events to `http://localhost:3000/api/events`. - -You can update the above command to scan between block heights and post events to the local server. +The above command uses Ordhook to stream and then post ordinal activities to `http://localhost:3000/api/events` where you can build out your own database or custom views. From 818ac8508157e6a003bb49b8296430e01df3b49f Mon Sep 17 00:00:00 2001 From: Max Efremov <51917427+mefrem@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:00:52 -0500 Subject: [PATCH 8/8] replace mentions of Chainhook --- ...-run-ordhook-as-a-service-using-bitcoind.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/how-to-guides/how-to-run-ordhook-as-a-service-using-bitcoind.md b/docs/how-to-guides/how-to-run-ordhook-as-a-service-using-bitcoind.md index 1421a69f..e54d93e2 100644 --- a/docs/how-to-guides/how-to-run-ordhook-as-a-service-using-bitcoind.md +++ b/docs/how-to-guides/how-to-run-ordhook-as-a-service-using-bitcoind.md @@ -6,16 +6,16 @@ title: Run Ordhook as a Service using Bitcoind ### Setting up a Bitcoin Node -The Bitcoin Core daemon (bitcoind) is a program that implements the Bitcoin protocol for remote procedure call (RPC) use. Chainhook can be set up to interact with the Bitcoin chainstate through bitcoind's ZeroMQ interface, its embedded networking library, passing raw blockchain data to be evaluated for relevant events. +The Bitcoin Core daemon (bitcoind) is a program that implements the Bitcoin protocol for remote procedure call (RPC) use. Ordhook can be set up to interact with the Bitcoin chainstate through bitcoind's ZeroMQ interface, its embedded networking library, passing raw blockchain data to be evaluated for relevant events. This guide is written to work with the latest Bitcoin Core software containing bitcoind, [Bitcoin Core 25.0](https://bitcoincore.org/bin/bitcoin-core-25.0/). > **_NOTE:_** > -> While bitcoind can and will start syncing a Bitcoin node, customizing this node to your use cases beyond supporting a Chainhook is out of scope for this guide. See the Bitcoin wiki for ["Running Bitcoin"](https://en.bitcoin.it/wiki/Running_Bitcoin) or bitcoin.org [Running A Full Node guide](https://bitcoin.org/en/full-node). +> While bitcoind can and will start syncing a Bitcoin node, customizing this node to your use cases beyond supporting a Ordhook is out of scope for this guide. See the Bitcoin wiki for ["Running Bitcoin"](https://en.bitcoin.it/wiki/Running_Bitcoin) or bitcoin.org [Running A Full Node guide](https://bitcoin.org/en/full-node). - Make note of the path of your `bitcoind` executable (located within the `bin` directory of the `bitcoin-25.0` folder you downloaded above appropriate to your operating system) -- Navigate to your project folder where your Chainhook node will reside, create a new file, and rename it to `bitcoin.conf`. Copy the configuration below to this `bitcoin.conf` file. +- Navigate to your project folder where your Ordhook node will reside, create a new file, and rename it to `bitcoin.conf`. Copy the configuration below to this `bitcoin.conf` file. - Find and copy your Bitcoin data directory and paste to the `datadir` field in the `bitcoin.conf` file below. Either copy the default path (see [list of default directories by operating system](https://en.bitcoin.it/wiki/Data_directory)) or copy the custom path you set for your Bitcoin data - Set a username of your choice for bitcoind and use it in the `rpcuser` configuration below (`devnet` is a default). - Set a password of your choice for bitcoind and use it in the `rpcpassword` configuration below (`devnet` is a default). @@ -54,7 +54,7 @@ zmqpubhashblock=tcp://0.0.0.0:18543 Now that you have the `bitcoin.conf` file ready with the bitcoind configurations, you can run the bitcoind node. The command takes the form `path/to/bitcoind -conf=path/to/bitcoin.conf`, for example: ```console -/Volumes/SSD/bitcoin-25.0/bin/bitcoind -conf=/Volumes/SSD/project/Chainhook/bitcoin.conf +/Volumes/SSD/bitcoin-25.0/bin/bitcoind -conf=/Volumes/SSD/project/Ordhook/bitcoin.conf ``` Once the above command runs, you will see `zmq_url` entries in the console's stdout, displaying ZeroMQ logs of your bitcoin node. @@ -66,10 +66,10 @@ In this section, you will configure Ordhook to match the network configurations Next, you will generate a `Ordhook.toml` file to connect Ordhook with your bitcoind node. Navigate to the directory where you want to generate the `Ordhook.toml` file and use the following command in your terminal: ```console -chainhook config generate --mainnet +ordhook config generate --mainnet ``` -Several network parameters in the generated `Chainhook.toml` configuration file need to match those in the `bitcoin.conf` file created earlier in the [Setting up a Bitcoin Node](#setting-up-a-bitcoin-node) section. Please update the following parameters accordingly: +Several network parameters in the generated `Ordhook.toml` configuration file need to match those in the `bitcoin.conf` file created earlier in the [Setting up a Bitcoin Node](#setting-up-a-bitcoin-node) section. Please update the following parameters accordingly: 1. Update `bitcoind_rpc_username` with the username set for `rpcuser` in `bitcoin.conf`. 2. Update `bitcoind_rpc_password` with the password set for `rpcpassword` in `bitcoin.conf`. @@ -94,7 +94,7 @@ mode = "mainnet" bitcoind_rpc_url = "http://localhost:8332" bitcoind_rpc_username = "devnet" bitcoind_rpc_password = "devnet" -# Bitcoin block events can be received by Chainhook +# Bitcoin block events can be received by Ordhook # either through a Bitcoin node's ZeroMQ interface, # or through the Stacks node. The Stacks node is # used by default: @@ -117,7 +117,7 @@ tsv_file_url = "https://archive.hiro.so/mainnet/stacks-blockchain-api/mainnet-st Here is a table of the relevant parameters this guide changes in our configuration files. -| bitcoin.conf | Chainhook.toml | +| bitcoin.conf | Ordhook.toml | | --------------- | --------------------- | | rpcuser | bitcoind_rpc_username | | rpcpassword | bitcoind_rpc_password | @@ -132,7 +132,7 @@ Use the following command to start the Ordhook service for streaming and process `ordhook service start --post-to=http://localhost:3000/api/events --config-path=./Ordhook.toml` -When the Ordhook service starts, the chainhook service gets initiated in the background to augment the blocks from Bitcoin. Bitcoind sends ZeroMQ notifications to Ordhook to retrieve the inscriptions. +When the Ordhook service starts, it is initiated in the background to augment the blocks from Bitcoin. Bitcoind sends ZeroMQ notifications to Ordhook to retrieve the inscriptions. ### Add `http-post` endpoints dynamically