How to Run the Bord Client (CBRC-20 Indexer)
This guide provides detailed instructions on how to set up and run the Bord Client, a CBRC-20 indexer.
Prerequisites
Before you start, make sure you have the following components installed:
NodeJS: Download and install the latest version of NodeJS from NodeJS Download.
MongoDB Command Line & MongoDB Compass:
MongoDB Command Line: MongoDB Command Line Tools.
MongoDB Compass: MongoDB Compass Download.
Bitcoin Core Node: Install and setup a Bitcoin Core node with
txindex=1
in the bitcoin.conf file. Download it from Bitcoin Core.XORD Client: Download the XORD client from XORD GitHub Repository.
BORD Client: Download the BORD client from BORD GitHub Repository.
Configuration
Bitcoin Core Node
Edit your
bitcoin.conf
file for the Bitcoin Core node with the following settings:
txindex=1
dbcache=8000
server=1
rest=1
rpcbind=127.0.0.1
externalip=[your_ip]
rpcworkqueue=1000
rpcuser=[username]
rpcpassword=[password]
rpcport=8332
rpcallowip=127.0.0.1
Note: Replace
[your_ip]
,[username]
, and[password]
with your specific details.
XORD Client
After downloading XORD, compile it using the command:
cargo build --release
.Create a folder named
xord_index
and move the compiled xord binary to this folder.To start syncing the XORD index, navigate to the
xord_index
folder and run:
./ord --bitcoin-data-dir [your_btc_data_directory] --bitcoin-rpc-pass [password] --bitcoin-rpc-user [username] --data-dir [your_xord_index_folder] --index-only-first-transfer --filter-metaprotocol @ --filter-metaprotocol cbrc-20 server --http-port 4444 -j
Replace placeholders with your actual Bitcoin data directory, RPC username, and password.
Bord Client
Unzip the downloaded BORD client file.
Install necessary packages with:
npm install && cp .env_example .env
Edit the
.env
file with appropriate configurations:
BITCOIND_HOST="localhost"
BITCOIND_PORT="8332"
BITCOIND_USER="username"
BITCOIND_PASSWORD="password"
ORD_URL="http://localhost:4444/"
MONGO_URL="mongodb://localhost:27017/cbrc_index_0"
CONTENT_OUTDIR="/tmp/"
API_PORT=5005
Note: Set the
BITCOIND_USER
andBITCOIND_PASSWORD
to your previously configured Bitcoin RPC username and password.
Running the Indexer
Start the Bord Client Indexer with:
npm run indexer:start
To continue indexing from an existing database, use:
npm run indexer:start --continue
Optional flags include
--offset=<height>
to start from a specific block height, and--max-concurrency=<number>
to adjust Bitcoin node RPC usage.
Running the API
To start the API, run:
npm run api:start
This will make the API service available at http://0.0.0.0:5005 (or whatever is set as the API_PORT
in your .env files).
API Endpoints
The Bord Client API provides various endpoints that allow developers and users to interact with the CBRC-20 indexer. Below is an overview of the available API endpoints:
1. Heights (/heights
)
Description: Retrieves the current block heights of the Bitcoin blockchain and the Cybord indexer.
Method:
GET
Response: JSON object containing
bitcoin
andcybord
block heights.
2. Deploy (/deploy
)
Description: Fetches all deployment operations.
Method:
GET
Query Parameters:
order
: Sort order (e.g.,creation:1
).limit
: Number of results to return.offset
: Results offset.
Response: Array of deploy operations.
3. Transfer (/transfer
)
Description: Returns a specific transfer operation.
Method:
GET
Query Parameters:
q
: Query lookup.
Response: Details of the requested transfer operation.
4. Deploy by Ticker (/deploy/:tick
)
Description: Fetches deployment details for a specific ticker.
Method:
GET
Path Parameters:
tick
: Token ticker.
Response: Deployment details of the specified ticker.
5. Mint Distribution (/mint/:tick
)
Description: Retrieves the mint distribution of a token.
Method:
GET
Path Parameters:
tick
: Token ticker.
Response: Mint distribution details for the specified token.
6. Tokens (/tokens
)
Description: Searches for tokens based on a query.
Method:
GET
Query Parameters:
q
: Query lookup.
Response: Array of tokens matching the query.
7. Token Details (/token/:tick
)
Description: Retrieves details of a specific token.
Method:
GET
Path Parameters:
tick
: Token ticker.
Response: Token details.
8. Account Balance (/balance/:acc
)
Description: Fetches the balance of an account.
Method:
GET
Path Parameters:
acc
: Account address.
Response: Account balance information.
9. Balance Operations Count (/balance-ops-count/:acc
)
Description: Provides the estimated number of operations for an account.
Method:
GET
Path Parameters:
acc
: Account address.
Response: Number of operations.
10. Balance Operations (/balance-ops/:acc
)
Description: Retrieves operations associated with an account's balance.
Method:
GET
Path Parameters:
acc
: Account address.
Query Parameters:
offset
: Results offset.limit
: Number of results to return.
Response: Array of balance operations.
11. Account Balance by Ticker (/balance/:acc/:tick
)
Description: Fetches the balance of an account for a specific ticker.
Method:
GET
Path Parameters:
acc
: Account address.tick
: Token ticker.
Response: Account balance for the specified ticker.
12. Metaoperations (/metaops
)
Description: Retrieves metaoperations.
Method:
GET
Query Parameters:
offset
: Results offset.limit
: Number of results to return.
Response: Array of metaoperations.
13. Metaoperations by Account (/metaops/:acc
)
Description: Fetches metaoperations for a specific account.
Method:
GET
Path Parameters:
acc
: Account address.
Response: Metaoperations related to the account.
14. Predicates (/predicates/:tick
)
Description: Retrieves operations associated with a specific ticker.
Method:
GET
Path Parameters:
tick
: Token ticker.
Query Parameters:
offset
: Results offset.limit
: Number of results to return.
Response: Array of operations for the ticker.
15. Number of Predicates (/predicates_n/:tick
)
Description: Provides the estimated count of operations for a specific ticker.
Method:
GET
Path Parameters:
tick
: Token ticker.
Response: Estimated count of operations for the ticker.
16. Race (/race
)
Description: Retrieves information about the most active tokens.
Method:
GET
Query Parameters:
offset
: Results offset.limit
: Number of results to return.
Response: Array of active tokens.
17. System (/system
)
Description: Provides system statistics, including live stats and database stats.
Method:
GET
Response: System statistics.
18. Home (/
)
Description: Basic information about the indexer.
Method:
GET
Response: Greeting or information message.
Monitoring Progress
Use MongoDB Compass to connect to your MongoDB server (default URL:
mongodb://localhost:27017
) and monitor the database (e.g.,cbrc_index_0
) to verify the indexing progress and success.
Conclusion
Following these steps will set up a full CBRC-20 Indexer environment, allowing you to index CBRC-20 tokens and run your API for querying indexed data. Happy building sers! :D
The github repo for BORD client is not accessible.
https://github.com/the-moto/cybord-sindexer/