Git Product home page Git Product logo

pychain's Introduction

pychain

PoW blockchain written in python.

Feauters

  • Uses PoW for mining/adding blocks.
  • Decentralized, peer-to-peer.
  • A really simple consensus algorithm.
  • Mining difficulty is proportional to number of nodes.
  • A node updating algorithm that maintains peer-to-peer connections & consensus with all nodes.

Setup

  • cd pychain/
  • execute pip install -r requirements.txt

Example

  • run a node of port 8080 with no peer by executing following command:
    make serve port=8080 peer=None
  • run 2nd node of port 7575 connecting peer 8080 by executing following command:
    make serve port=7575 peer=127.0.0.1:8080
  • run 3rd node of port 6969 connecting peer 7575 by executing following command:
    make serve port=6969 peer=127.0.0.1:7575

that's it, you are running a blockahin of containing three nodes.
(add block to see syncing changes)
you can add more nodes by connecting it to peers of already running chain or simply run another blockchain by peer as None.

API endpoints

  • to see chain /
  • to add block /add?nonce=<any-number>/data=<any-data> (adds block then redirects to /)
  • to see connected peers /nodes

pychain's People

Contributors

vilgacx avatar

Stargazers

胡同首富 avatar

Watchers

 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.