npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gxchain2-ethereumjs/blockchain

v5.4.3

Published

A module to store and interact with blocks

Downloads

8

Readme

@ethereumjs/blockchain

NPM Package GitHub Issues Actions Status Code Coverage Discord

| A module to store and interact with blocks. | | --- |

Note: this README reflects the state of the library from v5.0.0 onwards. See README from the standalone repository for an introduction on the last preceeding release.

INSTALL

npm install @ethereumjs/blockchain

USAGE

Introduction

The following is an example to iterate through an existing Geth DB (needs level to be installed separately).

This module performs write operations. Making a backup of your data before trying it is recommended. Otherwise, you can end up with a compromised DB state.

import Blockchain from '@ethereumjs/blockchain'
import Common, { Chain } from '@ethereumjs/common'

const level = require('level')

const gethDbPath = './chaindata' // Add your own path here. It will get modified, see remarks.

const common = new Common({ chain: Chain.Ropsten })
const db = level(gethDbPath)
// Use the safe static constructor which awaits the init method
const blockchain = Blockchain.create({ common, db })

blockchain.iterator('i', (block) => {
  const blockNumber = block.header.number.toString()
  const blockHash = block.hash().toString('hex')
  console.log(`Block ${blockNumber}: ${blockHash}`)
})

WARNING: Since @ethereumjs/blockchain is also doing write operations on the DB for safety reasons only run this on a copy of your database, otherwise this might lead to a compromised DB state.

EIP-1559 Support

This library supports the handling of EIP-1559 blocks and transactions starting with the v5.3.0 release.

API

Documentation

DEVELOPER

For debugging blockchain control flows the debug library is used and can be activated on the CL with DEBUG=[Logger Selection] node [Your Script to Run].js.

The following initial logger is currently available:

| Logger | Description | | - | - | | blockchain:clique | Clique operations like updating the vote and/or signer list |

The following is an example for a logger run:

Run with the clique logger:

DEBUG=blockchain:clique ts-node test.ts

EthereumJS

See our organizational documentation for an introduction to EthereumJS as well as information on current standards and best practices.

If you want to join for work or do improvements on the libraries have a look at our contribution guidelines.