Git Product home page Git Product logo

private-blockchain's Introduction

Private-Blockchain

This repository contains a simple list of steps to create your own private Blockchain, much like JPM's Quorum, allowing for a restricted group of users to access the network. Solidity smart contracts can be published to this private blockchain, just as with the MainNet and TestNet, using the Mist browser.

The 'chaindata' folder generates a log of all the blockchain's transactions / confirmations / etc.

Nodes (i.e. users and their computers) in this private network must use mining to confirm transactions and finalize smart contract deployment. Since this is a private network, with limited authorized users, block times are much quicker than Ethereum at ~1 sec. Of course, this block confirmation speed has the tradeoff of less decentralization (Ethereum has over 17,000 nodes worldwide on it's network, which reinforces security).

This repository is for those already fimiliar with writing and deploying Solidity smart contracts. This guide will not outline how to interact with the specific test smart contract deployed in the example here. It will, however, discuss how another developer can generally access and interact with any smart contract code they push to their private chain

Here are the steps on how to create your own private blockchain and interact with it using the Mist browser:

  1. Download and install geth & Mist: https://geth.ethereum.org/downloads/ https://github.com/ethereum/mist/releases
  2. Download the genesis.json file from this repository, place it in a new empty folder you create anywhere on your computer
  3. Open the command line and cursor to the path directory of the folder you just created, which houses the genesis.json file
  4. Open command line as admin, and run the following: geth --datadir=./chaindata init genesis.json
  5. Congrats! You just created Block 1 of your very own private blockchain network!!
  6. Now, to run your private blockchain node, enter the following in command line: geth --datadir=./chaindata
  7. Open Mist (run as administrator). It should automatically detect your private blockchain network running and connect to it.
  8. In Mist, follow the steps to "Add an Account"
  9. Open a second command line window, leaving the first open and running. Repeat step 3 and cursor to the proper folder directory.
  10. In the second command line window, access the Geth Javascript console by entering: geth attach ipc:\.\pipe\geth.ipc
  11. In Mist, you can also "Deploy a New Contract" to your private network under the contracts tab. This accepts the same Solidity smart contact code as the MainNet or TestNet.
  12. You must "mine" to confirm and officially deploy any new contract / transaction to the private network. Do this by: a) In your second command prompt window, enter: miner.setEtherbase(eth.accounts[0]); b) then: miner.start(3);
  13. In Mist, on the "Wallets" tab, you'll see your account start earning Ether as you mine. You'll also see your pending transactions start to be confirmed (after 12 confirmaitons they will be officially written to the private blockchain).
  14. Once contract is deployed, interact with it on the 'Contracts' tab by clicking on the appropriate contract name
  15. From there, you can call any of the functions embedded in your Solidity code, just like in Remix.
  16. Be sure to keep mining in your second command prompt window so that all transactions get processed / confirmed fully.
  17. You can stop mining at any time by entering: miner.stop();

Enjoy!

*note how in Mist it is not connected to the MainNet or TestNet but our Private Blockchain Network!! image

*you can easily interact with your Deployed contracts, on your private blockchain, via Mist: image

*example of how to mine with your private blockchain image

private-blockchain's People

Contributors

samwise711 avatar

Watchers

James Cloos avatar

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.