This project is private Blockchain that store data locally using LevelDB integrated with RESTFUL API to GET and POST Blocks.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
Installing Node and NPM is pretty straightforward using the installer package available from the (Node.js® web site).
https://nodejs.org/en/
- Clone the repository to your local computer.
- Open the terminal and install the packages:
npm install
. - Run your application
node app.js
- Go to your browser and type:
http://localhost:8000/block
- Function initializeMockData() will add 10 blocks to Blockchain for testing.
Use POSTMAN or CURL to send GET requests to the Blockchain by adding to the URL block height.
http://localhost:8000/block/[blockheight]
Example URL path: http://localhost:8000/block/0, where '0' is the block height.
For URL, http://localhost:8000/block/0
X-Powered-By →Express
Content-Type →text/plain; charset=utf-8
Data →{"hash":"e4d04d5522c0a2d777695e8b374211fae3bf4f270f45924ce635682bb1b87e35","height":0,"body":"Test Block","time":"1541273025","previousBlockHash":""}
Connection →close
Content-Length →208
ETag →W/"d0-Nam5HnrdK6hqMyz5HW9XEqdxgVs"
Date →Sat, 03 Nov 2018 19:23:45 GMT
Example URL path: http://localhost:8000/block/(Mydata) where (Mydata) is the block data.
Example For URL, http://localhost:8000/block/Foo
X-Powered-By →Express
Content-Type →text/plain; charset=utf-8
Data →{"hash":"5a4cfcb0eeb4ea09eeba722fec4fa8795cb1b8aef3c855f92f59eef4ee956a4e","height":21,"body":"Foo","time":"1541275030","previousBlockHash":"e4d04d5522c0a2d777695e8b374211fae3bf4f270f45924ce635682bb1b87e35"}
Connection →close
Content-Length →207
ETag →W/"cf-1dfORKZcSoeamE44HYEj6a4iUPs"
Date →Sat, 03 Nov 2018 19:57:11 GMT