Skip to content
Doris Chia-ching Lin edited this page Dec 5, 2020 · 15 revisions

API Contract

GET api/load-blocks

response
{
 [
  {
    "data": <str>,
    "previousHash": <str>,
    "hash": <str>,
    "nonce": <int>,
    "timeStamp": <str>,
    "workProven": <str>,
  },
  ...
 ]    
}

PUT /api/update-block

request-body
{
  "data":<str>
  "hash":<str>
}
response
{
 [
  {
     "previousHash": <str>,
     "hash": <str>,
     "data": <str>,
     "nonce": <int>,
     "timeStamp": <str>,
     "workProven": <bool>,
  },
  ... 
 ]  
}

POST api/create-block

request-body
{
  "data": <str>
}
response
{
 [
  {
     "previousHash": <str>,
     "hash": <str>,
     "data": <str>,
     "nonce": <int>,
     "timeStamp": <str>,
     "workProven": <bool>,
  },
  ...
 ]    
}

PUT /api/mine-block

request-body
{
  "hash": <str>
}
response
{
 [
  {
     "previousHash": <str>,
     "hash": <str>,
     "data": <str>,
     "nonce": <int>,
     "timeStamp": <int>,
     "workProven": <bool>,
  },
  ...
 ]    
}

Clone this wiki locally