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
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 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}
To run the service: npm start
For further use of the database, look at the example implementation of API example