Giter Club home page Giter Club logo

blockchainer's Introduction

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).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.