Bitmark Database Bootstrap Instructions

This guide explains how to initialize the PostgreSQL database for the Bitmark Explorer and Indexer.


Step 0 – Edit Password

Open the bootstrap file and change the default password:

nano bitmark-bootstrap.psql

Replace:

CREATE ROLE bitmark LOGIN PASSWORD 'CHANGE_ME_STRONG_PASSWORD'

With a strong password:

CREATE ROLE bitmark LOGIN PASSWORD 'StrongPassword123!'

Step 1 – Run as PostgreSQL Superuser

sudo -u postgres psql -f bitmark-bootstrap.psql

If successful, you will see confirmation output.


Step 2 – Verify Database Creation

sudo -u postgres psql
Then inside PostgreSQL:
\l
\c bitmark
\dt bitmark.*

You should see:


Step 3 – Test Login as bitmark User

psql 'postgres://bitmark:StrongPassword123!@127.0.0.1:5432/bitmark?sslmode=disable'

Step 4 – Configure Environment Variable

nano /home/coins/indexer.env.sh
Add:
export PG_DSN="postgres://bitmark:StrongPassword123!@127.0.0.1:5432/bitmark?sslmode=disable"
Reload:
source ~/indexer.env.sh
echo $PG_DSN

Step 5 – Start the Indexer

bitmark-indexer
It should begin ingesting blocks.

Step 6 – Start Homepage Generator

bitmark-explorer-hp-generator
You should see:
Generating initial homepage...
Waiting for new block...

Step 7 – Confirm Data Is Being Written

Inside PostgreSQL:
SELECT COUNT(*) FROM bitmark.blocks;
SELECT height, hash FROM bitmark.blocks ORDER BY height DESC LIMIT 5;

Resetting the Database (If Needed)

sudo -u postgres psql
DROP DATABASE bitmark;
DROP ROLE bitmark;
Then re-run the bootstrap script.

Common Issues


Bitmark Explorer Infrastructure Documentation