Skip to content

@ethereumjs/blockchain v5.0.0-beta.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@holgerd77 holgerd77 released this 22 Oct 10:34
· 5006 commits to master since this release
97345b5

ATTENTION: This is a pre-release and only meant to be used for testing purposes.

Do not use in production!

Feedback is extremely welcome, please use the beta.1 Releases feedback issue #923 or our Discord channel.


New Package Name

Attention! This new version is part of a series of EthereumJS releases all moving to a new scoped package name format. In this case the library is renamed as follows:

  • ethereumjs-blockchain -> @ethereumjs/blockchain

Please update your library references accordingly or install with:

npm i @ethereumjs/blockchain

Library Promisification

The Blockchain library has been promisified and callbacks have been removed along PR #833 and preceeding PR
#779.

Old API example:

blockchain.getBlock(blockId, (block) => {
  console.log(block)
})

New API example:

const block = await blockchain.getBlock(blockId)
console.log(block)

See Blockchain README for a complete example.

Constructor API Changes

Constructor options for chain setup on all VM monorepo libraries have been simplified and the plain chain and hardfork options have been removed. Passing in a Common instance is now the single way to switch to a non-default chain (mainnet) or start a blockchain with a higher than chainstart hardfork, see PR #863.

Example:

import Blockchain from '@ethereumjs/blockchain'
const common = new Common({ chain: 'ropsten', hardfork: 'byzantium' })
const blockchain = new Blockchain({ common })

Removed deprecated validate option

The deprecated validate option has been removed, please use valdiateBlock and validatePow for options when instantiating a new Blockchain.

Dual ES5 and ES2017 Builds

We significantly updated our internal tool and CI setup along the work on PR #913 with an update to ESLint from TSLint for code linting and formatting and the introduction of a new build setup.

Packages now target ES2017 for Node.js builds (the main entrypoint from package.json) and introduce a separate ES5 build distributed along using the browser directive as an entrypoint, see PR #921. This will result in performance benefits for Node.js consumers, see here for a releated discussion.

Other Changes

Changes and Refactoring

  • Use @ethereumjs/block v3.0.0 block library version, PR #883
  • Removed async dependency, PR #779
  • Updated ethereumjs-util to v7, PR #748

Bug Fixes

  • Fixed blockchain hanging forever in case code throws between a semaphore lock/unlock, Issue #877