Skip to content

Basic implementation of a blockchain in python.

Notifications You must be signed in to change notification settings

AdamHodgson/pychain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pychain   Codacy Badge

Basic implementation of a blockchain in python.

Usage

Installation

$ python server.py
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

Interacting with the Blockchain

GET /chain

{
    "chain": [
        {
            "index": 1,
            "previous_hash": 1,
            "proof": 100,
            "timestamp": 1517160942.196952,
            "transactions": []
        }
    ],
    "length": 1
}

GET /mine

{
    "index": 2,
    "message": "New Block Mined",
    "previous_hash": "79a84c98d2e85064113391ce2cd10ca613ff02ee9136c99e28ce7511288d016b",
    "proof": 35293,
    "transactions": [
        {
            "amount": 1,
            "recipient": "c37647f0f5b944698f10a4b81a3e51d3",
            "sender": "0"
        }
    ]
}

POST /transactions/new

{
 "sender": "d4ee26eee15148ee92c6cd394edd974e",
 "recipient": "someone-other-address",
 "amount": 5
}
{
    "message": "Transaction will be added to block 3"
}

Next steps

  1. Add a comprehensive set of unit tests.
  2. Transition from PoW to PoS.

Contributors

Implementation was based on an article by Daniel van Flymen.

About

Basic implementation of a blockchain in python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages