Skip to content

ClosureOne/eth-block-tracker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ethjs-query new BlockTracker({ provider })

// // public //

getCurrentBlock() start() stop()

EVENTS

Greenkeeper badge block <-- every block in order fork <-- common root of fork force <-- latest block was forced latest <-- the latest block, possibly skipping blocks

// // private //

async _performSync() { const latestBlock = await this._fetchLatestBlock() return this._considerBlock(latestBlock) }

async _considerBlock(newBlock) { const currentBlock = this.getCurrentBlock() // check if new block should be head if (!difficultyLessThan(currentBlock, newBlock)) { return Promise.resolve() } const blockPath = await _fetchPathBetweenBlocks(currentBlock, newBlock) }

_fetchPathBetweenBlocks (startBlock, endBlock) { // walk from end to start }

_fetchLatestBlock

_fetchBlockByHash

_fetchBlockByTag

poll latest, walk back to current block, abort if too far? ignore if 'latest' if less difficulty

About

This module walks the Ethereum blockchain, keeping track of the latest block. It uses a web3 provider as a data source and will continuously poll for the next block.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%