@0xcert/ethereum-scanner
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

Build Status npm version Dependency Status

0xcert Ethereum blockchain parser.

This is an open source package for NodeJS written with TypeScript. It allows for scraping of the Ethereum blockchain for 0xcert protocol related contracts and transactions.

This package is actively maintained, well tested and already used in production environments. The source code is available on GitHub where you can also find our issue tracker.

Installation

Run the command below to install the package.

npm install --save web3 @0xcert/ethereum-scanner

This package uses promises thus you need to use Promise polyfill when promises are not supported.

Getting started

Initialize the Web3 provider.

import * as Web3 from 'web3';

const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));

Load and parse data of a particular block.

import { Scanner } from '@0xcert/ethereum-scanner';

const blockNumber = 2996066;
const scanner = new Scanner(web3);

await scanner.parse(blockNumber); // => { transactions: [...], contracts: [...]}

API

Scanner Class

Scanner(web3)

Main class which allows for parsing the Ethereum blockchain.

Option Type Required Default Description
web3 Web3 Yes - Instance of a Web3 provider.

NOTICE: The scanner class extends is a RawModel class and thus exposes all related helper methods.

Scanner.prototype.parse(block): Promise(JSON)

Populates the scanner with block data and then returns serialized scanner data.

Option Type Required Default Description
block Integer Yes - Block number.

Scanner.prototype.populateByBlock(block): Promise(Scanner)

Loads and parses transactions and new contracts of a particular block on the Ethereum blockchain.

Option Type Required Default Description
block Integer Yes - Block number.

License (MIT)

Copyright (c) 2018 0xcert admin@0xcert.org.

Package Sidebar

Install

npm i @0xcert/ethereum-scanner

Weekly Downloads

4

Version

0.3.3

License

MIT

Unpacked Size

351 kB

Total Files

116

Last publish

Collaborators

  • moman
  • xpepermint