BTC::Block represents a collection of transactions within the block chain. It consists of block header and an array of transactions.
Returns a genesis block for mainnet. See also BTC::Network#genesis_block.
Returns a genesis block for testnet. See also BTC::Network#genesis_block.
Returns a new block initialized with a binary string in wire format.
Raises ArgumentError
if block is incomplete or incorrectly encoded.
Returns a new block initialized with data in wire format read from a given stream.
Raises ArgumentError
if block is incomplete or incorrectly encoded.
Returns a new block with named attributes. All attributes are optional and have appropriate default values.
Block.new(
version: 2,
previous_block_id: "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
merkle_root: "...",
transactions: [...])
Block version (1 or 2).
Binary hash of the previous block.
Hex big-endian hash of the previous block. See Hash↔ID Conversion.
Binary root hash of the transactions’ merkle tree.
32-bit unsigned UNIX timestamp.
Time object derived from timestamp
Proof-of-work target in a compact form (uint32). See Proof-of-Work Conversion Routines.
Proof-of-work nonce (uint32 value iterated during mining).
List of BTC::Transaction instances contained within the block.
Optional height in the block chain (genesis block has height 0). Not stored within block's binary representation. Third party APIs may set this value for user’s convenience.
Optional number of the confirmations for transactions in this block.
If this block is the latest one, confirmations
equals 1.
Not stored within block's binary representation.
Third party APIs may set this value for user’s convenience.
Binary hash of the block. Equals SHA256(SHA256(header_data))
.
Hex big-endian hash of the block. See Hash↔ID Conversion.
Returns a BTC::BlockHeader instance containing all attributes of this block except transactions
.
Returns block’s header data in wire format.
Returns block’s entire data in wire format.
Returns a copy of the block.
Returns true
if binary representation of both blocks is equal (external attributes height
, confirmations
are ignored).