Skip to content

bitgreen/node-cache-engine

Repository files navigation

Bitgreen Cache Engine

The Bitgreen Caching Engine makes on-chain actions and function results available with REST API calls, and provides a JSON response (Javascript Object Notation). This simplifies the process of querying the Bitgreen chain, making it accessible to anyone with an Internet connection, and does not require a node or other blockchain related deployments. You can use the example links below to see the data returned when the cache engine is queried.

Examples:

https://api-mainnet.bitgreen.org/project?search=yourSearchString

https://api-mainnet.bitgreen.org/transactions?account=yourAccount&date_start=2022-05-01&date_end=2022-05-31

https://api-mainnet.bitgreen.org/transaction?hash=yourHash

If you require any assistance using these features, or this repo, please contact us at [contact], we are happy to assist.

Additional, detailed technical information regarding the use and response of the caching engine can be found below.

Getting Started

The following commands starts all the services required to run the caching engine:

docker compose up

Installation

npm install

Config

Copy .env.example to .env and set environment variables.

cp .env.example .env
nano .env

Edit .env file, and save it.


Build

npm run build

Database

prisma package is being used for postgresql database.

Run Migrations

This will create all necessary tables and handle configuration. Run npx prisma migrate dev for development, or npx prisma migrate deploy for production environment.

You can also reset the database, which will drop all schemas and remigrate:

npx prisma migrate reset

For more information: Prisma Docs


Run Crawler

This script will listen for any new blocks.

npm run node

Run Fetcher

This script will process all blocks from X to Y. Ending block number is optional.

npm run fetch -- --block-start=X --block-end=Y

To analyze blockchain for data, you can use -a flag.

npm run fetch -- --block-start=X -a

Run the following command for more details:

npm run fetch -- --help

Important: in order process the old blocks, the node should run in "archive" mode by the additional parameter:

--pruning archive

Run APP

This script will serve API. Please refer to this page for more info.

npm run app

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •