getblock

Back to blockchain

Summary

If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.

Description

If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'. For witness-pruned historical blocks, this returns the stored block bytes, which may omit witness data. If verbosity is 1, returns an Object with information about block . If verbosity is 2, returns an Object with information about block and information about each transaction. If verbosity is 3, returns an Object with information about block and information about each transaction, including prevout information for inputs (only for unpruned blocks in the current best chain). Verbose block views are unavailable once a historical block's witness data has been pruned.

Arguments

  • blockhash (STR_HEX, required): The block hash
  • verbosity (NUM): 0 for hex-encoded data, 1 for a JSON object, 2 for JSON object with transaction data, and 3 for JSON object with transaction data including prevout information for inputs

Results

  • value (STR_HEX): A string that is serialized, hex-encoded data for block 'hash'
  • value (OBJ): No description.
  • hash (STR_HEX): the block hash (same as provided)
  • confirmations (NUM): The number of confirmations, or -1 if the block is not on the main chain
  • size (NUM): The block size
  • strippedsize (NUM): The block size excluding witness data
  • weight (NUM): The block weight; qbit fully counts witness data
  • height (NUM): The block height or index
  • version (NUM): The block version
  • versionHex (STR_HEX): The block version formatted in hexadecimal
  • merkleroot (STR_HEX): The merkle root
  • tx (ARR): The transaction ids
    • value (STR_HEX): The transaction id
  • time (NUM_TIME): The block time expressed in UNIX epoch time
  • mediantime (NUM_TIME): The median block time expressed in UNIX epoch time
  • nonce (NUM): The nonce
  • bits (STR_HEX): nBits: compact representation of the block difficulty target
  • target (STR_HEX): The difficulty target
  • difficulty (NUM): The difficulty
  • chainwork (STR_HEX): Expected number of hashes required to produce the chain up to this block (in hex)
  • nTx (NUM): The number of transactions in the block
  • previousblockhash (STR_HEX, optional): The hash of the previous block (if available)
  • nextblockhash (STR_HEX, optional): The hash of the next block (if available)
  • value (OBJ): No description.
  • value (ELISION): Same output as verbosity = 1
  • tx (ARR): No description.
    • value (OBJ): No description.
    • value (ELISION): The transactions in the format of the getrawtransaction RPC. Different from verbosity = 1 "tx" result
    • fee (NUM): The transaction fee in QBT, omitted if block undo data is not available
  • value (OBJ): No description.
  • value (ELISION): Same output as verbosity = 2
  • tx (ARR): No description.
    • value (OBJ): No description.
    • vin (ARR): No description.
      • value (OBJ): No description.
      • value (ELISION): The same output as verbosity = 2
      • prevout (OBJ): (Only if undo information is available)
        • generated (BOOL): Coinbase or not
        • height (NUM): The height of the prevout
        • value (STR_AMOUNT): The value in QBT
        • scriptPubKey (OBJ): No description.
        • asm (STR): Disassembly of the output script
        • desc (STR): Inferred descriptor for the output
        • hex (STR_HEX): The raw output script bytes, hex-encoded
        • address (STR, optional): The qbit address (only if a well-defined address exists)
        • type (STR): The type (one of: nonstandard, anchor, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_v1_taproot, witness_v2_p2mr, witness_unknown)

Examples

qbit-cli getblock "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"
curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "getblock", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"]}' -H 'content-type: application/json' http://127.0.0.1:8352/