Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

NodeJS worker built for 0x Tracker which extracts 0x fill events from the Ethereum blockchain and persists them to MongoDB

License

Notifications You must be signed in to change notification settings

0xTracker/0x-event-extractor

Repository files navigation

0x Event Extractor

David

NodeJS worker originally built for 0x Tracker which extracts 0x fill events from the Ethereum blockchain and persists them to MongoDB. Support for V1, V2 and V3 of the 0x protocol is included with events tagged against the protocol version they belong to.

🧐 How It Works

The extractor runs on a configurable interval, scraping a chunk of events from the blockchain using the getLogsAsync method of 0x.js. Events are persisted to MongoDB and the processed block range is logged to ensure the range only gets extracted once.

👮‍♂️ Requirements

To run the project locally you'll need the following installed:

  • NodeJS v10.16.3
  • Yarn v1.19.0
  • MongoDB v4+

The project also has support for the following development tools which you may wish to take advantage of:

🐣 Getting Started

Run cp .env.example .env to create a local environment file, then get yourself an Infura API key and add your endpoint to the .env file. Update the connection string as well if necessary.

Run yarn install to install dependencies and then run yarn start/nodemon to start the extractor. You should start to see events being persisted.

🌳 Project Structure

The project uses a monorepo structure which accomodates different 0x.js dependencies for different versions of the 0x protocol. This structure is mostly invisible in day to day work since it is managed by Yarn. To add or remove dependencies in sub-packages however you'll need a basic understanding of Yarn Workspaces.

🛠 Configuration

Configuration is handled by a combination of dotenv files and node-config. If you need to tweak anything you can either edit your .env file or create a config/local.js file with overrides for the configuration found in config/default.js.

⚠️ Caveats

On July 12th 2019 a vulnerability was discovered in 0x V2 which resulted in a shutdown and redployment of the contract. Because of this the 0x Event Extractor currently only collects event logs from the latest V2 contract (dubbed v2.1), meaning that V2 events before 12th July are not collected. This will be improved in the future by the use of v2 and v2.1 extractors which will handle the pre and post vulnerability contracts respectively.

👨‍💻 Maintainers

Supporters

Infrastructure for 0x Tracker is generously supported by these companies.

Bugsnag
Bugsnag
CryptoCompare
CryptoCompare
Netlify
Netlify

👩‍⚖️ License

Apache 2.0

About

NodeJS worker built for 0x Tracker which extracts 0x fill events from the Ethereum blockchain and persists them to MongoDB

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •