@ethereumjs/blockchain v5.0.0-beta.2
Pre-releaseATTENTION: 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 Releases feedback issue #923 or our Discord channel.
This is the second beta release towards a final library release, see beta.1 release notes for an overview on the full changes since the last publicly released version.
This release introduces new breaking changes, so please carefully read the additional release note sections!
Safe Static Constructor
The library now has an additional safe static constructor Blockchain.create() which awaits the init method and throws if the init method throws:
const common = new Common({ chain: 'ropsten' })
const blockchain = await Blockchain.create({ common })This is the new recommended way to instantiate a Blockchain object, see PR #930.
Refactored Genesis Block Handling Mechanism
Genesis handling has been reworked to now be safer and reduce the risk of wiping a blockchain by setting a new genesis, see PR #930.
Breaking: The dedicated setGenesisBlock() methods and the optional isGenesis option on Blockchain.putBlock() have been removed. Instead the genesis block is created on initialization either from the Common library instance passed or a custom genesis block passed along with the genesisBlock option. If a custom genesis block is used, this custom block now always has to be passed along on Blockchain initialization, also when operating on an already existing DB.
Changes and Refactoring
- Refactored
DBManagerwith the introduction of an abstract DB operation handling mechanism, if you have modifiedDBManagerin your code this will be a potentially breaking change for you, PR #927 - Renaming of internal variables like
Blockchain._headBlock, if you are using these variables in your code this will be a potentially breaking change for you, PR #930 - Made internal
_methods like_saveHeads()private, if you are using these functions in your code this will be a potentially breaking change for you, PR #930 - Improved code documentation, PR #930
- Fixed potential blockchain DB concurrency issues along PR #930
Testing and CI
- Dedicated
blockchainreorg test setup and executable test, PR #926 - Breaking:
validatePowoption has been renamed tovalidateConsensusto prepare for a future integration of non-PoW (PoA) consensus mechanisms,validateConsensusas well asvalidateBlocksoptions now throw when set totruefor validation on a non-PoW chain (determined byCommon, e.g. 'goerli'), see PR #937