This repo demonstrate an attempt to use Ordinals in containerized environment.
Example is based on Docker Compose
Considerations:
ord
is connecting tobitcoind
via RPC URL, but its current implementation expects the RPC authentication configured onbitcoind
side- 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
bitcoind
should be started first and fully synced beforeord
can start indexingbitcoind
should be launched with flagtxindex=1
.
Run bitcoind
:
docker compose up -d bitcoind
Check logs
docker compose logs bitcoind -f --tail 100
Once bitcoind
fully synced
docker compose up -d ord
If 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 getindexinfo
Expecting "synced": true
.
Get details of the first Transaction should return without error:
docker compose exec bitcoind bitcoin-cli getrawtransaction "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16 true
Or 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 }