Blockchain

CGP

GET http://127.0.0.1:31567/blockchain/cgp

Get the current CGP status of the Blockchain

{
    "interval": 2391,
    "allocation": 90,
    "payout": {
        "recipient": "tzn1q7fnh47xftwr2zpxtpxepf022l9u5k0kusahactcn099vlumxy58s4kzzx6",
        "spendlist": [{
            "asset": "00",
            "amount": "12300000000"
        }]
    }
}

CGP History

GET http://127.0.0.1:31567/blockchain/cgp/history

Get the history of the CGP up to the previous interval

[...
{
    "interval": 2389,
    "allocation": 89,
    "payout": {}
}, {
    "interval": 2390,
    "allocation": 89,
    "payout": {}
}]

CGP Info

GET http://127.0.0.1:31567/blockchain/contract/cgp

Provide info on how to execute the cgp contract

{
    "raw": {
        "dict": [
            [
                "Outputs",
                {
                    "list": [
                        {
                            "list": [
                                {
                                    "lock": {
                                        "PK": {
                                            "hash": "f2677af8c95b86a104cb09b214bd4af9794b3edc876fdc2f13794acff366250f",
                                            "address": "tzn1q7fnh47xftwr2zpxtpxepf022l9u5k0kusahactcn099vlumxy58s4kzzx6"
                                        }
                                    }
                                },
                                {
                                    "list": [
                                        {
                                            "string": "000000000000000000000000000000000000000000000000000000000000000000000000"
                                        },
                                        {
                                            "u64": 12300000000
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        ]
    },
    "encoded": "0c01074f7574707574730d010d02080220f2677af8c95b86a104cb09b214bd4af9794b3edc876fdc2f13794acff366250f0d0206483030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030300500000002dd231b00000000",
    "cgpContract": "00000000eac6c58bed912ff310df9f6960e8ed5c28aac83b8a98964224bab1e06c779b93"
}

Total ZP

GET http://127.0.0.1:31567/blockchain/totalzp

Get the total minted ZP up to a precise block

Path Parameters

236520

Block headers

GET http://127.0.0.1:31567/blockchain/headers

Returns a list of some information about each header on the main chain in JSON format

Query Parameters

[{
        "hash": "hash"
        "timestamp": timestamp,
        "date": "19-07-21 11:16:17",
        "blockNumber": 1,
        "difficulty": "difficulty",
        "target": "target"
}...]

Blockchain Info

GET http://127.0.0.1:31567/blockchain/info

Returns information about the current status of the blockchain

{
    "chain": "testnet",
    "blocks": "blocks",
    "headers": "headers",
    "difficulty": "difficulty",
    "medianTime": "medianTime",
    "initialBlockDownload": false,
    "tip": "tip"
}

Block

GET http://127.0.0.1:31567/blockchain/block

Return the content of a block by providing either the block number or the hash of the block

Path Parameters

{
    "hash": "0000000000134025e160d8bc9e2aa4679922577d6c4a19e913e794d9553fc7b1",
    "header": {
        "version": 0,
        "parent": "000000000005f82adc623950001be45869a55a9f6547988f691352bc3e569d21",
        "blockNumber": 173,
        "commitments": "a81f0356128748f3b32f75bb81b204efc326d29e200f8b02bcd30dcd0f2e8011",
        "timestamp": 1530385197246,
        "difficulty": 455897445,
        "nonce": [
            450089378218827185,
            -5391090228939172857
        ]
    },
    "transactions": {
        "6a8e563d53a1dcdf7eb8827a1643d7d9edf1af4665c50146f24d648578469a8d": {
            "version": 0,
            "inputs": [],
            "outputs": [
                {
                    "lock": {
                        "Coinbase": {
                            "blockNumber": 173,
                            "pkHash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                            "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc"
                        }
                    },
                    "spend": {
                        "asset": "00",
                        "amount": "5000000000"
                    }
                }
            ],
            "witness": []
        },
        "89d60fdaab712639b38159b95503e20c1d93d71be547098233c89167de8ef033": {
            "version": 0,
            "inputs": [
                ...,
                {
                    "outpoint": {
                        "txHash": "a7934d6f8d88c120e2b65350889767ab1c2b075b0e4c596de4ef410e33a6d454",
                        "index": 0
                    }
                }
            ],
            "outputs": [
                {
                    "lock": {
                        "PK": {
                            "hash": "3ef74862aad449d4e509cdcdf6131f9f462ada5d0f999992855a6eba04ac3860",
                            "address": "zen1q8mm5sc4263yafegfehxlvyclnarz4kjap7veny59tfht5p9v8psqdzng5l"
                        }
                    },
                    "spend": {
                        "asset": "00",
                        "amount": "100000000000"
                    }
                }
            ],
            "witness": [
                ...,
                {
                    "PKWitness": {
                        "sigHash": "txHash",
                        "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                        "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                        "signature": "cdbf797eb5d4da7f4e4ab7c4ad02435d86a6548341ceab827ebf0354dbd734363ca0180df6dbf8623ec963bd054d07a7803e3f190655855c3ecded890cb23560"
                    }
                }
            ]
        }
    }
}

Block Reward

GET http://127.0.0.1:31567/blockchain/blockreward

Return the reward at a given block

Path Parameters

5000000000

Get Transaction

GET http://127.0.0.1:31567/blockchain/transaction

Return the data of the provided transaction

Query Parameters

{
    "tx": {
        "version": 0,
        "inputs": [
            {
                "outpoint": {
                    "txHash": "a880d71f4711d329d8de232a6ca762bd1a921f8bcc5cbbe5c951410271cd7487",
                    "index": 0
                }
            },
            {
                "outpoint": {
                    "txHash": "af95d752102168833c17d5b811fe8d29b95bc362c795cfe4c369651f18536947",
                    "index": 0
                }
            },
            {
                "outpoint": {
                    "txHash": "b1e957ca66a35496c2e1ab452dc214d727b14786734644b9bee935795ceb562f",
                    "index": 0
                }
            },
            {
                "outpoint": {
                    "txHash": "b8bc6169206fd11b8c49885e1f344d6ebbc57257b542b11cfc9ab99faefefce3",
                    "index": 0
                }
            },
            {
                "outpoint": {
                    "txHash": "be137110b99d6c73cd96b2b3b2b5d799140bd5d435e178aa7e50b692f4ac6571",
                    "index": 0
                }
            },
            {
                "outpoint": {
                    "txHash": "c0cbea76ee2051a5cfa173e483da630275f5594ea2223fbfc20359ea27d10e88",
                    "index": 0
                }
            },
            {
                "outpoint": {
                    "txHash": "d6c23a31aab8d523d53b0ae291a818b7c22382212b2d49c53008a65449e389cd",
                    "index": 0
                }
            },
            {
                "outpoint": {
                    "txHash": "d8326a8e17bc4f3a01310755b921d22f3d6828007e514368c3d6fb82f373008b",
                    "index": 0
                }
            },
            {
                "outpoint": {
                    "txHash": "e953b9b14e4620e12dbaeb3a12a99452ae936d86a0d89bcb7b2f995924adfff5",
                    "index": 0
                }
            },
            {
                "outpoint": {
                    "txHash": "efb796ba6d8ff18ff0ad5a70a1591b4ca30ffbf917bf9a44d6e7954092749d94",
                    "index": 0
                }
            }
        ],
        "outputs": [
            {
                "lock": {
                    "PK": {
                        "hash": "3ef74862aad449d4e509cdcdf6131f9f462ada5d0f999992855a6eba04ac3860",
                        "address": "zen1q8mm5sc4263yafegfehxlvyclnarz4kjap7veny59tfht5p9v8psqdzng5l"
                    }
                },
                "spend": {
                    "asset": "00",
                    "amount": "50000000000"
                }
            }
        ],
        "witness": [
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            },
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            },
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            },
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            },
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            },
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            },
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            },
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            },
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            },
            {
                "PKWitness": {
                    "sigHash": "txHash",
                    "hash": "72c9f711659f19759967607f305da968f77f49e67ff23488d36fbd4df6a07b57",
                    "address": "zen1qwtylwyt9nuvhtxt8vplnqhdfdrmh7j0x0lerfzxnd775ma4q0dtscc2tjc",
                    "signature": "8e8b0295b2f6407812d8de1853200ceab5c218f8626cb0d32b2fc655f25ce78b61b82f811ab7e602082d3ed21171c5c6a5f5ebd97d080114e27b443a292fc03e"
                }
            }
        ]
    },
    "confirmations": 640787
}

Publish Block

POST http://127.0.0.1:31567/blockchain/publishblock

Publish a block only provide block in hex format or header and body

Request Body

000000000008bf918c4672a4b5b7a4928cf180adefab696947de56c948240e47

Submit Header

POST http://127.0.0.1:31567/blockchain/submitheader

Submit hex formatted header to add the block

Request Body

cb746bfdbc472602064dbc04e66326a8edf11a3c64d08ddfa90257e86e866b0f

Block Template

POST http://127.0.0.1:31567/blockchain/blocktemplate

Request a block template to add on top the mempool transaction

Path Parameters

{
    "header": "000000010000000004357e167370845a22b741b01cfc392a3d0cafa5736042ea13910a8c000085c82deddef70ebc9a16f150047ad0fe9118b46b6099c2b89c4bef0d09a1e620c575000001884358696e1c0582dd00000000000000000000000000000000",
    "body": "039bf2e442f34d15fd09d2a6a6cf97e9d65758a39a4a1cba8b76102e15e81a7ec334e357f5efa4b6cdaf25a1c51f4ab17769ab29594d318e45b6fa9281f8c60516f7e92b9cb5a9e696a0d7cfc1f00e974ce2c1693b63a5e647a00f545dbd996818010000000000010624000085c8f2677af8c95b86a104cb09b214bd4af9794b3edc876fdc2f13794acff366250f007e0000012a0603760000",
    "target": "000000000582dd00000000000000000000000000000000000000000000000000",
    "parent": "0000000004357e167370845a22b741b01cfc392a3d0cafa5736042ea13910a8c",
    "blockNumber": 34248
}

Publish Transaction

POST http://127.0.0.1:31567/blockchain/publishtransaction

Publish an hex encoded transaction into the mempool

Request Body

e4592f72c0201345b750fde240309224a7964e2b516440e2bfa0f62d3bc59bb5

Execute Contract

POST http://127.0.0.1:31567/blockchain/contract/execute

Execute a contract by given different data

Request Body

123456789abcdef 

Last updated