Skip to content
This repository has been archived by the owner on May 21, 2020. It is now read-only.

Example of using demux-js library for getting the transaction history (concrete actions) of specific contract and saving them into MongoDB

License

Notifications You must be signed in to change notification settings

4ban-old/EOS-demux-js-example

Repository files navigation

demux-service

The daemon to monitor the EOS producer and record committed transactions (actions) into the Mongo database.

There are 2 identical models and effects for them in case to demonstrate how easy to modify it if you want to use different actions, models, save functions

Description

This example tracks the transfer action for different contracts and store them into different collections in the Mongo database.

  • {contract account name 1}::transfer
  • {contract account name 2}::transfer

Install

Install dependencies: npm install Fill the .env file.

Available parameters:

# Mainnet
ENDPOINT=https://eos.greymass.com
# {server_address} is a ip address or domain name of the server
# EOS is a Mongo database name
MONGODB_URL=mongodb://{server_address}:27017/DBname

or

# Testnet
ENDPOINT=http://api.kylin.alohaeos.com
# {server_address} is a ip address or domain name of the server
# EOStest is a Mongo database name
MONGODB_URL=mongodb://{server_address}:27017/DBnameTest

Start | Stop points

# Start point of tracking
# 0 - is a "tail" mode, where service start at an offset of the most recent blocks.
START_AT=100
# Stop point of tracking
# 0 - means that it will not stop
STOP_AT=200

To handle the microfork issue enable the processing of irreversible blocks

# irreversible blocks only
IRREVERSIBLE=true

Accounts with contracts to track

ACCOUNT_1=eosio.token
ACCOUNT_2={contract_account_name 2}

Credentials

# Login and password from the database
MONGODB_USER={username}
MONGODB_PASS={password}

Usage

To run the service: npm start

Additional

For further use of the database, look at the example implementation of API example

About

Example of using demux-js library for getting the transaction history (concrete actions) of specific contract and saving them into MongoDB

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published