A service that indexes Bitcoin Ordinals data and exposes it via REST API endpoints.
- Complete ordinal inscription ingestion
- Genesis block and transaction information
- Transfer history
- Current location and ownership information
- Satoshi ordinal notation endpoints
- Easy to use REST JSON endpoints with ETag caching
- Run modes for auto-scaling
See the Ordinals API Reference for more information.
The Ordinals API is a microservice that has hard dependencies on other systems. Before you start, you'll need to have access to:
- A Chainhook node with a fully indexed Ordinals
.redb
database. - A local writeable Postgres database for data storage
Clone the repo.
Create an .env
file and specify the appropriate values to configure the local API server, postgres
DB and Chainhook node reachability. See
env.ts
for all available
configuration options.
Build the app (NodeJS v18+ is required)
npm install
npm run build
Start the service
npm run start
To better support auto-scaling server configurations, this service supports three run modes
specified by the RUN_MODE
environment variable:
default
: Runs all background jobs and the API server. Use this when you're running this service only on one instance. This is the default mode.readonly
: Runs only the API server. Use this in an auto-scaled cluster when you have multiplereadonly
instances and just onewriteonly
instance. This mode needs awriteonly
instance to continue populating the DB.writeonly
: Use one of these in an auto-scaled environment so you can continue consuming new inscriptions. Use in conjunction with multiplereadonly
instances as explained above.
When shutting down, you should always prefer to send the SIGINT
signal instead of SIGKILL
so
the service has time to finish any pending background work and all dependencies are gracefully
disconnected.