getBlock

Get information about a specific block.

Input Arguments

Parameter
Description

blockHeight: number

The height of the block you would like to get information about

Success Response

The wallet will return the direct response from the RPC node.

Error Response

Parameter
Description

type: string

The type of error which has occured

description: string

A description of the error which has occured

data: string

Any raw data associated with the error

Example

Request

neolineN3.getBlock({
    blockHeight: 190,
})
.then(result => {
    console.log('Block information: ' + JSON.stringify(result));
})
.catch((error) => {
    const {type, description, data} = error;
    switch(type) {
        case 'NO_PROVIDER':
            console.log('No provider available.');
            break;
        case 'RPC_ERROR':
            console.log('There was an error when broadcasting this transaction to the network.');
            break;
        default:
            // Not an expected error object.  Just write the error to the console.
            console.error(error);
            break;
    }
});

Response

{
    "hash": "0x70635ef3ab897294bcde97255ea1197f99d7d6c587f720430b78743d25f8b313",
    "size": 689,
    "version": 0,
    "previousblockhash": "0xb2462644577fdc9302abfe3517d07cbb9e7d51354872257901ba3ab1c2f4ead6",
    "merkleroot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "time": 1616899442433,
    "index": 190,
    "primary": 6,
    "nextconsensus": "NNjNWMEgRw9bnvg7RkjSB9FZfzXUXfqovh",
    "witnesses": [
        {
            "invocation": "DEAl4+T5RivIUYtCcMDCw/W2G3VvNRWRD8iWv447hmeuUo1XxyqHvC9wFYWWu1ar2Qr6sO36mHlJI6W1lmTol7sSDEDZmjj1k/TGr2f4Ii3IUZyxzroJ6/6pBBZhgafUYFPX1zMJBXYPqpGP7Ppqw8n/jUOgYq7u0XAzzbCco7qT4/1mDECVyDVhe2EwxXpvp9bUGgVH9SOoXub7fsN7zB+7kiEXpSNU0Fp7kn4uIsLE8PlDfEyKktFAMPBEzw1+WJZr/MgmDEB0RS82LHuKwwHmQ24QuRfk6YuFs3bLXFdtvL0BrlwpYrtOEDr6hitybvJ6X2NBiRf5+O88MO/ph3KJwIc7deN4DEDOdD1Ks34NSPHqd/7tNt/kqjIokEkRfxSCoXoBdbuSwQBQr5G6q/a9MpE9WQ+td0+XCsOKPi82QzxXo/TLJnoJ",
            "verification": "FQwhAwCbdUDhDyVi5f2PrJ6uwlFmpYsm5BI0j/WoaSe/rCKiDCECPpsy6om5TQZuZJsST9UOOW7pE2no4qauGxHBcNAiJW0MIQNAjc1BY5b2R4OsWH6h4Vk8V9n+qIDIpqGSDpKiWUd4BgwhAqeDS+mzLimB0VfLW706y0LP0R6lw7ECJNekTpjFkQ8bDCECuixw9ZlvNXpDGYcFhZ+uLP6hPhFyligAdys9WIqdSr0MIQPOExCxK5ItwD/pBcxnN+YrOEwO+j8VZouFPQPAFoJb8AwhAuhZNE7zW7H/65wlUytAKMW4d9uGGtsIYcng7dPIxnyLF0F7zmyl"
        }
    ],
    "tx": [],
    "confirmations": 207480,
    "nextblockhash": "0xb95e56772d16a02f54c9f9cf071bdb60c92d4b6dc0f0eddd7c8388d5649f112b"
}

最后更新于