This repo demonstrate an attempt to use Ordinals in containerized environment.
Example is based on Docker Compose
Considerations:
ordis connecting tobitcoindvia RPC URL, but its current implementation expects the RPC authentication configured onbitcoindside- To generate unique user and password RPC Auth see the
./scripts/rpcauth, update the bitcoin.conf afterwards and set Environment variables (via .env file) forord bitcoindshould be started first and fully synced beforeordcan start indexingbitcoindshould be launched with flagtxindex=1.
Run bitcoind:
docker compose up -d bitcoindCheck logs
docker compose logs bitcoind -f --tail 100Once bitcoind fully synced
docker compose up -d ordIf txindex is set to true (1), Bitcoin Core maintains an index of all transactions that have ever happened, which you can query using the remote procedure call (RPC) method getrawtransaction or the RESTful API call get-tx.
Can be verified in container:
docker compose exec bitcoind bitcoin-cli getindexinfoExpecting "synced": true.
Get details of the first Transaction should return without error:
docker compose exec bitcoind bitcoin-cli getrawtransaction "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16 trueOr via JSON-RPC interface
curl --user foo --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getrawtransaction", "params": ["f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16", true]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/https://jlopp.github.io/bitcoin-core-config-generator/
When starting ord the Bitcoin Block Index loading should be completed (usually few minutes), otherwise the following error:
ord | error: JSON-RPC error: RPC error response: RpcError { code: -28, message: "Loading block index…", data: None }