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.
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.
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:
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.
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 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.
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.
- Craig Bovis (@cbovis)
Infrastructure for 0x Tracker is generously supported by these companies.
Bugsnag |
CryptoCompare |
Netlify |