Skip to content

pradel/stackspulse

Repository files navigation

stackspulse

Real-Time Gateway to Stacks DeFi.

This project aims to provide a real-time view of Stacks DeFi ecosystem by aggregating public blockchain data and making it accessible through a easy to use interface.

Development

First, install the dependencies:

pnpm install

Create and migrate the database:

pnpm db:generate
pnpm db:migrate

Then, run the development server:

pnpm dev

Once the server is running you can run the predicates of your choice using chainhooks:

chainhook predicates scan /<path-to-stackspulse>/chainhooks/arkadiko/arkadiko-swap-v2-1.swap-x-for-y.json --mainnet

Deploy to production

Create a .env.production.local file with the following content:

CHAINHOOKS_API_TOKEN=your-prod-token

Generate the chainhoooks predicates with the correct settings for the production environment.

pnpm chainhooks:generate

Then, deploy the production server to fly (or any other provider of your choice):

fly deploy --remote-only

Finally upload the chainhooks predicates file chainhooks.production.json to the Hiro platform for your project.

Add new production environment variables

Add the variable to the .env.production.local file and encrypt it using the dotenvx command:

pnpm dotenvx vault encrypt --env-file .env.production.local

Download the production database locally

flyctl ssh issue --agent
flyctl proxy 10022:22
scp -r -P 10022 root@localhost:/data  /your/local/path/where/to/copy/data