Skip to content

Edorka/blockpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlockPy

Build Status

Minimal python implementation of a blockchain. Following the article A blockchain in 200 lines of code.

Running the tests

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

Get Blocks

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>}] }
  • Error Response:

    • Code: 500 ERROR
      Content: { error : <error message> }
  • Sample Call:

      $.ajax({
        url: "/blocks/?from_index=5",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

About

Minimal blockchain implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages