0.1.2 • Published 5 years ago

@santiment-network/eth-exporter v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

ETH Data Exporter

This package defines an easy to use class for exporting data from the ETH blockchain to the Santiment Data Pipeline.

Usage

There is a Yeoman generator for new exporters, so using that is the easiest. Make sure you have docker and docker-compose installed first and then run:

$ npm install -g yo
$ npm install -g @santiment-network/generator-eth-exporter

Then create a folder for the new exporter and initialize the skeleton:

$ mkdir my-exporter && cd my-exporter
$ yo @santiment-network/eth-exporter

Running the exporter is done with

$ docker-compose up --build

If you want to cleanup the current state and run from the beginning run

$ docker-compose rm

Connect to the analytics DB

The pipeline uses (ClickHouse)https://clickhouse.yandex as an analytics DB. This is a very fast columnar DB, which allows to use SQL to query the data. In order to connect to the DB run:

$ docker-compose exec clickhouse clickhouse-client 

Running the tests

To run the tests run

$ docker-compose run --no-deps --rm exporter npm test

API

The main way to use the extractor is to extract all the events defined into an ABI. You can do it like this:

const { ETHExporter } = require('@santiment-network/eth-exporter')
const contractAbi = require('./abi.json')

const exporter = new ETHExporter("contract-events")

exporter.extractEventsWithAbi(contractAbi)

This is going to extract all the events defined in the ABI from all contracts deployed on Ethereum.

The function extractEventsWithAbi accepts the following parameters: