This project is intended to demonstrated a simple private blockchain creation using models and helpers. It is ready to scale and build features on top of it
git clone https://github.com/joseasousa/PrivateBlockchain.git
cd PrivateBlockchain
npm install
This installs the dependencies of the project.
npm start
This starts the API server, listening on port 8000 of localhost.
The endpoints implemented are:
Sample output:
{
"status": true,
"message": "Server is working",
"size": 3
}
Sample input:
{
"data": "String Test"
}
Sample output:
{
"success": true,
"data": {
"hash": "66f9a59eba778febd1f1d3aec57992b508644255ca0e670bc6ebf1c13dfbd112",
"height": 2,
"body": "String Test",
"time": "1532806713",
"previousBlockHash": "09ac1f5139b0fa411544194180e18c8e1dafb329cf6701d9340c49dd22510f57"
}
}
Sample output:
[
{
"hash": "253eea560b7b62557a3f6efdccbba7974b9e4570bad921b3be01a7dff75c6ada",
"height": 0,
"body": "First block in the chain - Genesis block",
"time": "1533917415",
"previousBlockHash": "",
"isValid": true
},
{
"hash": "7ce0d8803c51dac90c9fcfd381aa047f27e78afa54842b9a48d8644b5312d40c",
"height": 1,
"body": "blocc",
"time": "1533917569",
"previousBlockHash": "253eea560b7b62557a3f6efdccbba7974b9e4570bad921b3be01a7dff75c6ada",
"isValid": true
}
]
Sample output:
{
"success": true,
"data": {
"hash": "66f9a59eba778febd1f1d3aec57992b508644255ca0e670bc6ebf1c13dfbd112",
"height": 2,
"body": "String Test",
"time": "1532806713",
"previousBlockHash": "09ac1f5139b0fa411544194180e18c8e1dafb329cf6701d9340c49dd22510f57"
}
}