sudo apt update
sudo apt install snapd
snap install bitcoin-core
## if you want to use a mounted media as chain folder:
snap connect bitcoin-core:removable-media
## create a folder for bitcoin chain
mkdir -p /mnt/HC_Volume/bitcoin_chain
## run bitcoind using the new folder
bitcoin-core.daemon -txindex=1 -datadir="/mnt/HC_Volume/bitcoin_chain" -restWarning
If running on Signet, add -signet to bitcoin-core.daemon command, if you're planning on running BRC2.0 Programmable Module, also enable RPC authentication by adding -rpcuser=<USER> and -rpcpassword=<PASSWORD>.
- First install and run postgresql binaries.
sudo apt update
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresql.service- (Optional), I'll usually mark postgres on hold since apt will try to auto update postgres which will restart its process and close all active connections.
sudo apt-mark hold postgresql postgresql-14 postgresql-client-14 postgresql-client-common postgresql-common postgresql-contrib- Set a password for postgresql user.
sudo -u postgres psqlALTER USER postgres WITH PASSWORD '********';
\q- (Optional), if you want to connect to DB instance remotely (if postgres is not installed on your local PC) you need to configure pg_hba.conf file.
nano /etc/postgresql/14/main/pg_hba.conf## add the following line to the end of the file, change ip_address_of_your_pc with real IP
hostssl all all <ip_address_of_your_pc>/32 scram-sha-256
To reload the new configuration:
sudo -u postgres psqlSELECT pg_reload_conf();
\q- (Optional), some configuration changes:
nano /etc/postgresql/14/main/postgresql.conflisten_addresses = '*'
max_connections = 2000
sudo systemctl restart postgresqlThese steps are following the guide at here.
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
sudo apt-get install nodejs -yThese steps are following the guide at here.
curl https://sh.rustup.rs -sSf | sh
source "$HOME/.cargo/env"To update cargo & rust:
rustup update stablegit clone https://github.com/bestinslot-xyz/OPI.git && cd OPIWarning
If running on Signet with BRC2.0, clone the experimental signet branch by using:
git clone -b experimental-signet-brc20-prog https://github.com/bestinslot-xyz/OPI.git && cd OPI
All next shell script groups assumes that you are in OPI folder cloned by above command.
cd modules/brc20_api; npm install;
cd ../bitmap_api; npm install;
cd ../pow20_api; npm install;
cd ../sns_api; npm install;
cd ../..;Create a virtual environment and install python libraries
sudo apt install python3.12-venv -y;
cd modules;
python3 -m venv .venv;
source .venv/bin/activate;
pip3 install -r requirements.txt;
cd ..;sudo apt install build-essential libssl-dev pkg-config clang -y;
cd ord; cargo build --release;Run reset_init.py in each module folder (preferrably start from main_index) to initialise .env file, databases and set other necessary files.
Postgres will auto run on system start.
Bitcoind needs to be run with -txindex=1 flag before running main indexer.
Here, we run the ord binary directly. Ord also serves an RPC server.
Main Meta-Protocol Indexer
cd ord/target/release;
ord --data-dir . index run;Note
For ord to reach the bitcoin rpc server correctly, pass --bitcoin-rpc-url, --bitcoin-rpc-username and --bitcoin-rpc-password parameters before index run. To run on signet, add --signet as well.
BRC-20 Indexer
Warning
If running BRC2.0, set up and run brc20_prog server using the instructions at bestinslot-xyz/brc20-programmable-module#usage before running brc20_index.py.
BRC2.0 requires setting up the BITCOIN_RPC_USER and BITCOIN_RPC_PASSWORD, and on Signet, BITCOIN_RPC_NETWORK=signet.
BRC2.0 needs to be running before starting the brc20 indexer. When running reset_init.py, enable BRC2.0 by setting the variable to true when asked.
cd modules/brc20_index;
cargo build --release;
cd target/release;
./brc20-index;BRC-20 API
This is an optional API and doesn't need to be run.
cd modules/brc20_api;
node api.js;Bitmap Indexer
cd modules/bitmap_index;
python3 bitmap_index.py;Bitmap API
This is an optional API and doesn't need to be run.
cd modules/bitmap_api;
node api.js;SNS Indexer
cd modules/sns_index;
python3 sns_index.py;SNS API
This is an optional API and doesn't need to be run.
cd modules/sns_api;
node api.js;POW20 Indexer
cd modules/pow20_index;
python3 pow20_index.py;POW20 API
This is an optional API and doesn't need to be run.
cd modules/pow20_api;
node api.js;- Stop all indexers and apis (preferably starting from main indexer but actually the order shouldn't matter)
- Update the repo (
git pull) - Recompile ord (
cd ord; cargo build --release;) - Re-run all indexers and apis