hirosystems / ordhook

Build indexers, standards and protocols on top of Ordinals and Inscriptions (BRC20, etc).
Apache License 2.0
182 stars 54 forks source link

Extend auto-download of missing `cache/hord.sqlite` when using hord as a service #152

Open ryanwaits opened 1 year ago

ryanwaits commented 1 year ago

description

the single binary hord scan works as expected by downloading the cache/hord.sqlite if it does not exist, but when trying to spin up hord as a service and stream ordinal activity for the first time (if the file does not exist yet) we get an error

"FATAL: could not find cache/hord.sqlite"

the current workaround for anyone trying to stream ordinal activity is to first run the default binary, something like hord scan blocks 767430 767753 --mainnet which will download the cache/hord.sqlite if it does not exist yet.

expected behavior

run the hord service start commands and if cache/hord.sqlite does not exist auto-download - if it does exist, use it.

actual results

error: "FATAL: could not find cache/hord.sqlite"

chresko commented 1 year ago

@lgalabru Thoughts on this one?

csgui commented 1 year ago

Hello @ryanwaits !

The hord.sqlite db file is generated upon the start of hord as a service. An empty file is created to make possible the service running.

Can you please detail which branch are you using? Or if possible, can you please update your code and try to run the service again. Thanks!

GopherJ commented 5 months ago

@csgui I'm on v2.1.0 (latest release), I can still reproduce this error

GopherJ commented 5 months ago
ordhook scan blocks --post-to=http://localhost:1337/api/events --config-path=./Ordhook.toml  --interval 1:10
[storage]
working_dir = "ordhook"

# The Http Api allows you to register / deregister
# dynamically predicates.
# Disable by default.
#
# [http_api]
# http_port = 20456

[network]
mode = "devnet"
bitcoind_rpc_url = "http://127.0.0.1:18443"
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. Zmq is being
# used by default:
bitcoind_zmq_url = "tcp://127.0.0.1:30001"
# but stacks can also be used:
# stacks_node_rpc_url = "http://0.0.0.0:20443"

[resources]
ulimit = 2048
cpu_core_available = 16
memory_available = 32
bitcoind_rpc_threads = 4
bitcoind_rpc_timeout = 15
expected_observers_count = 1
max_caching_memory_size_mb = 1024

# Disable the following section if the state
# must be built locally
# [snapshot]
# download_url = "https://archive.hiro.so/mainnet/ordhook/mainnet-ordhook-sqlite-latest"

[logs]
ordinals_internals = true
chainhook_internals = true