Skip to content

sadoprotocol/ordinal-api

Repository files navigation

Ordinal API



Deployment

Requirement

  • An indexed ord server
  • An ord wallet

Configuration

Copy dotenv to .env.
Edit .env and set proper parameters.


Install packages:

$ npm install

Start:

$ npm start

# Optional: OR background it with screen
$ ./screen-ordinal-api.sh


Usage

CLI browser API

At the moment, until systemD or daemon is utilised. Run this as a background task using screen or tmux.
Because this is a temporary wrapper to the ord cli command, this application should not be available to public.
If it's behind a firewall, simplest option is to access using SSH local forwarding:

$ ssh -N -T -L 3000:localhost:3000 username@host -i /path/to/identity

// Access localy via http://localhost:3000

Example is available in index.html.



Background Snapshots

At the moment, ord stops indexing process if there is a reorg.
Therefore, we create snapshots every 30 blocks. Approximately once in every 6 hours.
Simply run the following using a cron job for every 5 minutes.

# Copy the config and change the values accordingly
$ cp ord-index-config .ord-index-config

$ ./ord-snapshot.sh

Background Indexer

Run the snapshot command first before executing this indexer command.

The ord cli command is using Sado's version and on-fly indexing has been disabled to improve API request responses.
Simply run the following using a cron job for every 3 minutes.

# Make sure you have done the config in the background snapshot process above.

$ ./ord-index.sh