Minimal python implementation of a blockchain. Following the article A blockchain in 200 lines of code.
If you don't trust the green tag from travis-ci.org you can run tests on your own:
virtualenv -p python3 venv
source venv/bin/activate
python -m unittest discover tests
Returns a list of the chain blocks in JSON format.
-
URL
/blocks
-
Method:
GET
-
URL Params
Optional:
from_index=[integer]
-
Data Params
None
-
Success Response:
- Code: 200
Content:{ items: [{ index: <index>, timestamp: <float>, "data": <Object>, hash: <Hex digest of SHA256 for current object>}] }
- Code: 200
-
Error Response:
- Code: 500 ERROR
Content:{ error : <error message> }
- Code: 500 ERROR
-
Sample Call:
$.ajax({ url: "/blocks/?from_index=5", dataType: "json", type : "GET", success : function(r) { console.log(r); } });