Totem Core Explorer backend service responsible for working with smart contracts deployed on the Polygon network and storing data from contracts for faster and more flexible access.
- Install dependencies:
npm install
- Create MongoDB and Redis in Docker, or use local variants.
- Create
.env
file from example.env.sample
and fill in environment variables:GRPC_URL=0.0.0.0:50051 REDIS_URL=redis://127.0.0.1:6379/0 MONGODB_URI=mongodb://user:pass@127.0.0.1:27017 MONGODB_DATABASE=explorer-storage PAYMENT_API_URL=https://payment-api.com PROVIDER_URL=https://polygon-mumbai.chainstacklabs.com PROVIDER_PRIVATE_KEY= AVATAR_LEGACY_CONTRACT= ITEM_LEGACY_CONTRACT= GEM_LEGACY_CONTRACT= GAME_LEGACY_CONTRACT= GAMES_DIRECTORY_CONTRACT=
PROVIDER_PRIVATE_KEY
must be the account that deployed the smart contracts.
*_CONTRACT
variables are the addresses of deployed smart contracts.
Smart contracts can be found in the Totem Smart Contracts repository.PAYMENT_API_URL
is URL to Payment Service - Run service in development mode:
Debug mode:
npm run start:dev
If Node.js default debug portnpm run start:debug
9229
is busy -- you can change it like this:npm run start:debug -- --debug 0.0.0.0:9228
- Build service with version (git required):
Build service without version (without git):
npm run build
npm run build:app
- Run service:
node dist/main
- Build docker image:
docker build -f deployment/docker/Dockerfile -t totem-core-explorer-backend:latest .