Blockchain

Last updated 4 months ago

get
Block headers

http://127.0.0.1:31567
/blockchain/headers
Returns a list of some information about each header on the main chain in JSON format
Request
Response
200: OK
[{
"hash": "hash"
"timestamp": timestamp,
"date": "19-07-21 11:16:17",
"blockNumber": 1,
"difficulty": "difficulty",
"target": "target"
}...]

get
Blockchain Info

http://127.0.0.1:31567
/blockchain/info
Returns information about the current status of the blockchain
Request
Response
200: OK
{
"chain": "testnet",
"blocks": "blocks",
"headers": "headers",
"difficulty": "difficulty",
"medianTime": "medianTime",
"initialBlockDownload": false,
"tip": "tip"
}

get
Block

http://127.0.0.1:31567
/blockchain/block
Request
Response
Path Parameters
blockNumber
required
string
block number wanted
hash
required
string
hash of block
200: OK

get
Block Reward

http://127.0.0.1:31567
/blockchain/blockreward
Return the reward at a given block
Request
Response
Path Parameters
blockNumber
required
string
Number of block to check
200: OK

post
Publish Block

http://127.0.0.1:31567
/blockchain/publishblock
Publish a block
Request
Response
Body Parameters
block
required
string
block to publish
200: OK
400: Bad Request
error
proof of work failed

post
Submit Header

http://127.0.0.1:31567
/blockchain/submitheader
Request
Response
Body Parameters
header
required
string
The header to submit
200: OK

post
Block Template

http://127.0.0.1:31567
/blockchain/blocktemplate
Request
Response
Path Parameters
address
required
string
address of block
200: OK

post
Publish Transaction on Blockchain

http://127.0.0.1:31567
/blockchain/publishtransaction
Request
Response
Body Parameters
tx
required
string
transaction hash
200: OK
400: Bad Request
invalid transaction