Blockchain

get
CGP

http://127.0.0.1:31567/blockchain/cgp
Get the current CGP status of the Blockchain
Request
Response
Request
Response
200: OK
{
"interval": 2391,
"allocation": 90,
"payout": {
"recipient": "tzn1q7fnh47xftwr2zpxtpxepf022l9u5k0kusahactcn099vlumxy58s4kzzx6",
"spendlist": [{
"asset": "00",
"amount": "12300000000"
}]
}
}

get
CGP History

http://127.0.0.1:31567/blockchain/cgp/history
Get the history of the CGP up to the previous interval
Request
Response
Request
Response
200: OK
[...
{
"interval": 2389,
"allocation": 89,
"payout": {}
}, {
"interval": 2390,
"allocation": 89,
"payout": {}
}]

get
CGP Info

http://127.0.0.1:31567/blockchain/contract/cgp
Provide info on how to execute the cgp contract
Request
Response
Request
Response
200: OK
{
"raw": {
"dict": [
[
"Outputs",
{
"list": [
{
"list": [
{
"lock": {
"PK": {
"hash": "f2677af8c95b86a104cb09b214bd4af9794b3edc876fdc2f13794acff366250f",
"address": "tzn1q7fnh47xftwr2zpxtpxepf022l9u5k0kusahactcn099vlumxy58s4kzzx6"
}
}
},
{
"list": [
{
"string": "000000000000000000000000000000000000000000000000000000000000000000000000"
},
{
"u64": 12300000000
}
]
}
]
}
]
}
]
]
},
"encoded": "0c01074f7574707574730d010d02080220f2677af8c95b86a104cb09b214bd4af9794b3edc876fdc2f13794acff366250f0d0206483030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030300500000002dd231b00000000",
"cgpContract": "00000000eac6c58bed912ff310df9f6960e8ed5c28aac83b8a98964224bab1e06c779b93"
}

get
Total ZP

http://127.0.0.1:31567/blockchain/totalzp
Get the total minted ZP up to a precise block
Request
Response
Request
Path Parameters
blockNumber
required
string
Response
200: OK

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
Request
Query Parameters
blockNumber
optional
string
start to take from blockNumber. Must be used with take
take
optional
string
take the first n blocks instead of all of the headers
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
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
Request
Path Parameters
blockNumber
required
string
block number wanted
hash
required
string
hash of block
Response
200: OK

get
Block Reward

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

get
Get Transaction

http://127.0.0.1:31567/blockchain/transaction
Request
Response
Request
Query Parameters
hex
optional
string
if true it return the tx in hex format
hash
required
string
Hash of a transaction
Response
200: OK

post
Publish Block

http://127.0.0.1:31567/blockchain/publishblock
Publish a block only provide block in hex format or header and body
Request
Response
Request
Body Parameters
body
optional
string
in hex format
header
optional
string
in hex format
block
required
string
in hex format
Response
200: OK
400: Bad Request
error
proof of work failed

post
Submit Header

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

post
Block Template

http://127.0.0.1:31567/blockchain/blocktemplate
Request
Response
Request
Path Parameters
address
optional
string
Miner coinbase address
Response
200: OK

post
Publish Transaction

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

post
Execute Contract

http://127.0.0.1:31567/blockchain/contract/execute
Request
Response
Request
Body Parameters
command
optional
string
command provided to the contract
messageBody
optional
string
message body in hex format
otion.sender
optional
string
bip39 path
tx
optional
string
Tx in hex format
address
optional
string
Contract Address
Response
200: OK
tx in hex format
123456789abcdef