Development
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 a PostgreSQL service:
docker compose -f docker-compose.local.yml up -d postgres redis
Configure the environment variables accordingly, including the DATABASE_URL
.
Run
Then run the development command:
pnpm dev
Lastly, create the database schema:
pnpm db:generate
Other commands
Metrics are recalculated every 15 minutes if you are running the cron job.
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
pnpm job:overall
# Aggregates all blob data for yesterday
pnpm job: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