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/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.
The following commands starts all the services required to run the caching engine:
docker compose up
npm install
Copy .env.example
to .env
and set environment variables.
cp .env.example .env
nano .env
Edit .env
file, and save it.
npm run build
prisma package is being used for postgresql
database.
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
This script will listen for any new blocks.
npm run node
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
This script will serve API. Please refer to this page for more info.
npm run app