Giter Site home page Giter Site logo

4ban-old / eos-demux-js-example Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 111 KB

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

License: MIT License

JavaScript 100.00%
eos eosio eosio-blockchain eos-contracts blockchain demux demuxjs

eos-demux-js-example's Introduction

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

eos-demux-js-example's People

Contributors

4ban avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

eosiogo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.