Skip to content

axlos/private-blockchain-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful Web API with Node.js Framework

Web API using a Node.js Express V4 framework that will interact with the private Blockchain to submit a retrieve block chain data.

Getting Started

GET http://localhost:3000/block/:id

GET request to fetch a block by height parameter. The response for this endpoint retrieve the block object in JSON format, like this:

{ 
"hash": "49cce61ec3e6ae664514d5fa5722d86069cf981318fc303750ce66032d0acff3",
"height": 0,
"body": "First block in the chain - Genesis block",
"time": "1530311457",
"previousBlockHash": ""
}

POST http://localhost:3000/block

Post a new block with data payload option to add data to the block body. The block body should support a string of text.

{ 
"data": "Here is my data",
}

The response for this endpoint provide a block object in JSON format, like this.

{ 
"hash": "49cce61ec3e6ae664514d5fa5722d86069cf981318fc303750ce66032d0acff3",
"height": 1,
"body": "Here is my data",
"time": "1530311457",
"previousBlockHash": ""
}

Prerequisites

  • node --version = v10.9.0
  • npm --version = 6.4.1

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

RESTful Web API with Node.js Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published