In this project I created a private blockchain.
I implemented the classes defining the data structure for the blocks and the
chain.
In order to be able to persist my blochchain I used LevelDB.
Finally I implemented GET and POST API endpoints using the hapijs framework.
- Download or clone the repository
- Install project dependencies:
npm install
- Start the web service:
node app.js
The server runs locally by default on port 8000.
You may select a different one by updating the PORT
parameter of the BlockAPI constructor in app.js.
- /api/block/height: to retrieve a block by its height/index.
- /api/block: to add a new block ("data=block's content")
- Starter code
- LevelDB to persist the data
- Node.js
- hapijs framework to build API web service
- crypto-js for SHA256 cryptographic function
- Understanding usage of async/await instead of regular promises: