Skip to content

REST API

Peter edited this page Mar 20, 2018 · 4 revisions
  • /mine [GET] -- mining of new block and placing them to chain of the current node. For example:
curl -s http://localhost:5000/mine
  • /transactions/new [POST] -- making of new transaction. For example:
curl -s -X POST -H 'Content-Type: application/json' -d '{"sender": "", "recipient": "a04434638886485ab60be72e8cb04069", "amount": 10}' http://localhost:5001/transactions/new
  • /chain [GET] -- get current state of chain of blocks from this node. For example:
curl -s http://localhost:5000/chain
  • /nodes [GET] -- get list of slave nodes connected to master node. For example:
curl http://localhost:5000/nodes
  • For POW variant /nodes/register [POST] -- add node to slaves list in master node. For example:
curl -s -X POST -H 'Content-Type: application/json' -d '{"nodes": ["http://localhost:5001"]}' http://localhost:5000/nodes/register
  • For Quantum variant /nodes/register [POST] -- add node to slaves list in master node and associate with keyworker. For example:
curl -s -X POST -H 'Content-Type: application/json' -d '{"nodes": [{"address":"http://localhost:5001","keyworker_id":0}]}' http://localhost:5000/nodes/register
  • For Quantum variant /keyworker/register [POST] -- add keyworker url and id. For example:
curl -s -X POST -H 'Content-Type: application/json' -d '{"keyworkers": [{"address":"http://localhost:55554","id":0}]}' http://localhost:5000/keyworker/register
  • /keyworker [DELETE] -- clear list of keyworkers in master node. For example:
curl -s -X DELETE -H Content-Type: application/json http://localhost:5000/keyworker
  • /nodes [DELETE] -- clear list of slave nodes in master node. For example:
curl -s -X DELETE -H Content-Type: application/json http://localhost:5000/nodes
  • /nodes/resolve [GET] -- run the consensus machinery by master node on slave nodes. For example:
curl -s http://localhost:5000/nodes/resolve
Clone this wiki locally