hirosystems / ordhook

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

http_port is not working #326

Open jeff-upbit opened 3 weeks ago

jeff-upbit commented 3 weeks ago

Ordhook.toml

[storage]
working_dir = "/data/ordinals/data/ordhook"

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

[network]
mode = "mainnet"
bitcoind_rpc_url = "http://xx.xx.xx.xx:28333"
bitcoind_rpc_username = ""
bitcoind_rpc_password = ""
# 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://xx.xx.xx.xx:29000"
# 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

# 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

Ordhook Run Command

ordhook service start --config-path=./Ordhook.toml

ordinals-api .env

RUN_MODE=default
/** Hostname of the API server */
API_HOST=0.0.0.0
/** Port in which to serve the API */
API_PORT=8085
/** Port in which to serve the Admin RPC interface */
ADMIN_RPC_PORT=8086
/** Port in which to receive ordhook events */
EVENT_PORT=8087
/** Event server body limit (bytes) */
EVENT_SERVER_BODY_LIMIT=10000000
/** Hostname that will be reported to the ordhook node so it can call us back with events */
EXTERNAL_HOSTNAME=

/** Hostname of the ordhook node we will use to register predicates */
ORDHOOK_NODE_RPC_HOST=127.0.0.1
/** Control port of the ordhook node */
ORDHOOK_NODE_RPC_PORT=20456
/**
* Authorization token that the ordhook node must send with every event to make sure it is
* coming from the valid instance
*/
ORDHOOK_NODE_AUTH_TOKEN=
/**
* Register ordhook predicates automatically when the API is first launched. Set this to `false`
* if you are configuring your predicates manually for any reason.
*/
ORDHOOK_AUTO_PREDICATE_REGISTRATION=true
/**
* Ordhook ingestion mode. Controls the APIs Ordhook payload ingestion behavior:
* * `default`: The API will stay running and will listen for payloads indefinitely
* * `replay`: The API will stay running and listening only for payloads marked as "not streaming"
*   by Ordhook (historical replays). Once Ordhook starts streaming recent blocks from its chain
*   tip, the API will shut down. Recommended for deployments meant to sync the ordinals chain
*   from genesis.
*/
ORDHOOK_INGESTION_MODE=default

PGHOST=127.0.0.1
PGPORT=5433
PGUSER=postgres
PGPASSWORD=
PGDATABASE=
/** Limit to how many concurrent connections can be created */
PG_CONNECTION_POOL_MAX=10
PG_IDLE_TIMEOUT=10
PG_MAX_LIFETIME=10
PG_STATEMENT_TIMEOUT=10

When executing ordinals-api, below errors occurred

{"level":"error","time":"2024-06-24T06:11:09.667Z","pid":3567685,"hostname":"server-03","name":"chainhook-client","err":{"type":"Error","message":"connect ECONNREFUSED 127.0.0.1:20456","stack":"Error: connect ECONNREFUSED 127.0.0.1:20456\n    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1195:16)","errno":-111,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":20456},"msg":"Chainhook node not available, retrying..."}

Are there wrong setting values?

4ker-dep commented 3 weeks ago

Hi jeff-upbit! I'm one of the many poor souls that tries to get this working and from my understanding of ordhook / ordinals api, your ordhook might not be accepting connections yet. Is the local chain state ready? Are you still fetching data from your bitcoin node? Did your ordinals api get registered as one of the ordhook observers? You can check the current observer list via: (GET /v1/observers/).

jeff-upbit commented 3 weeks ago

Hi @4ker-dep

And it appears that ordhook is not running the rest api server.

telnet 127.0.0.1 20456
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

Thank you!

rafaelcr commented 1 week ago

hi @jeff-upbit apologies for the late reply... what @4ker-dep mentions is correct: ordhook does not open the HTTP server for predicate registration until it's caught up with bitcoind.

However, the no such table: ledger error might be an underlying issue that still needs fixing. I will look into this

rafaelcr commented 1 week ago

Possible duplicate of #324