Run your Blobscan instance

Running locally

Requirements

Installing dependencies

Install a recent Node.js version and pnpm:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
curl -fsSL https://get.pnpm.io/install.sh | sh -

Git clone the repository:

git clone https://github.com/Blobscan/blobscan.git
cd blobscan

Install all the Node.js dependencies:

pnpm fetch -r
pnpm install -r
SKIP_ENV_VALIDATION=true npm run build

Setup environment variables

PostgreSQL database

You need to have access to a database.

You can use the provided docker-compose file to spin up the required databases (Postgres and Redis):

docker compose -f docker-compose.local.yml up -d postgres redis

Configure the environment variables accordingly, including the DATABASE_URL.

Run

Run the development command:

pnpm dev

Lastly, apply all database migrations and optionally, add some fixture data:

cd packages/db
pnpm db:migrate
pnpm db:seed

Metrics aggregation

Metrics are recalculated every 15 minutes by a background process.

During development, you may want to force backfilling all the data, which can be achieved using the following commands:

# Aggregates all blob data since the beginning
cd clis/stats-aggregation-cli
pnpm start overall
# Aggregates all blob data for yesterday
cd clis/stats-aggregation-cli
pnpm start daily

In case you need to delete aggregated metrics, you can use the stats aggregation cli:

cd clis/stats-aggregation-cli
pnpm start daily --delete
pnpm start overall --delete
Previous
Background jobs