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

blockchainer

v0.0.1

Published

A simple daemon process that checkpoints your blockchain onto a public network (e.g. Ethereum)

Downloads

7

Readme

blockchainer

A simple command line tool to checkpoint your blockchain's state on another blockchain.

Blockchainer takes your blockchain's state snapshot and imprints it on a higher level chain.

State Snapshots

Any database or Ethereum-based blockchain can have its state snapshotted by taking a hash on the formatted data. In the case of Ethereum-based blockchains, this hash can be saved along with a block number and used to prove that a set of data is consistent with the current history of the blockchain.

Diagram

This lends credibility to the private blockchain because its history can be proven to have existed at a certain point in time (enforced by the trust in the public Ethereum blockchain).

Parity creates state snapshots by default when your node syncs (snapshots taken by default every 30,000 blocks). It stores a hash and a block number corresponding to these snapshots in a MANIFEST file. For more information, see this page. Blockchainer references this MANIFEST and imprints the state hash and block number onto a higher level chain (usually public Ethereum, but configurable). As of now, Parity is the only client that takes state snapshots, so it is a requirement to run blockchainer.

Steps to configure

The following information needs to be captured in config.json:

  1. Create a 12-24 BIP39 mnemonic phrase (generator here) and save this as MNEMONIC
  2. Determine your GAS_PRICE and GAS_LIMIT - I recommend 0x5F5E100 and 0x7A120, respectively.
  3. Find where Parity stores blockchain data on your machine (details here) and save this as PARITY_DIR. On mac, this should be ~/Library/Application\ Support/io.parity.ethereum/
  4. Determine the name of the chain you are using for Parity. For more information, see this article. Note that for testing, if you have a node running on the public net you can use ethereum.
  5. Identify your gateway to the higher level network. For production, I recommend using INFURA. For local development, I recommend Ganache, which manifests itself as http://localhost:7545. Save this variable as PUBLIC_HOST.
  6. Deploy the contract in contracts/Checkpoint.sol with truffle migrate. Get the address of this contract and save it as CONTRACT.

Your config.json file should look like this:

{
  "PUBLIC_HOST": "http://localhost:7545",
  "CONTRACT": "0xf12b5dd4ead5f743c6baa640b0216200e89b60da",
  "MNEMONIC": "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat",
  "PARITY_DIR": "~/Library/Application Support/io.parity.ethereum",
  "CHAIN_NAME": "ethereum",
  "GAS_PRICE": "0x5F5E100",
  "GAS_LIMIT": "0x7A120"
}

Running blockchainer

With the configuration set, you're ready to start blockchainer with the following command:

blockchainer run <interval> <chainId>

Where <interval> is the number of seconds between checkpoints and <chainId> can be anything you want. Typically this would be the identifier that goes along with your blockchain (each private chain will have its own chainId, which you can find in web3.version.network), but there are no restrictions so you can leave this as 0 if you want. For more information on chainIds, see here).