Basic implementation of a blockchain in python.
$ python server.py
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
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"
}
- Add a comprehensive set of unit tests.
- Transition from PoW to PoS.
Implementation was based on an article by Daniel van Flymen.