export interface BlockHeaderRaw { version: number; previousBlockHash: Uint8Array; merkleRoot: Uint8Array; timestamp: number; bits: number; nonce: number; } /** * Represents a Bitcoin Cash block header. * This class handles parsing and serialization of BCH block headers between different formats * (raw object, bytes, hex) and provides access to individual header fields. */ export declare class BlockHeader { private readonly version; private readonly previousBlockHash; private readonly merkleRoot; private readonly timestamp; private readonly bits; private readonly nonce; /** * Creates a new BlockHeader instance. * @param version - The block version * @param previousBlockHash - Hash of the previous block (32 bytes) * @param merkleRoot - Merkle root of the block's transactions (32 bytes) * @param timestamp - Block timestamp in seconds since Unix epoch * @param bits - Compact representation of the target threshold * @param nonce - Value modified during mining to make the block hash valid */ constructor(version: number, previousBlockHash: Uint8Array, merkleRoot: Uint8Array, timestamp: number, bits: number, nonce: number); /** * Creates a BlockHeader instance from a byte array. * @param bytes - 80-byte array containing the serialized block header * @returns A new BlockHeader instance * @throws Error if the byte array length is not 80 */ static fromBytes(bytes: Uint8Array): BlockHeader; /** * Creates a BlockHeader instance from a hex string. * @param hex - 160-character hex string representing the block header * @returns A new BlockHeader instance * @throws Error if the hex string length is not 160 */ static fromHex(hex: string): BlockHeader; /** * Creates a BlockHeader instance from a raw object representation. * @param obj - Object containing the block header fields * @returns A new BlockHeader instance */ static fromRaw(obj: BlockHeaderRaw): BlockHeader; /** * Serializes the block header to a byte array. * @returns 80-byte array containing the serialized block header */ toBytes(): Uint8Array; /** * Converts the block header to a raw object representation. * @returns Object containing the block header fields */ toRaw(): BlockHeaderRaw; /** * Converts the block header to a hex string. * @returns 160-character hex string representing the block header */ toHex(): string; getVersion(): number; getPreviousBlockHash(): Uint8Array; getMerkleRoot(): Uint8Array; getTimestamp(): number; getBits(): number; getNonce(): number; /** * Gets the previous block hash as a hex string. * @returns 64-character hex string */ getPreviousBlockHashHex(): string; /** * Gets the merkle root as a hex string. * @returns 64-character hex string */ getMerkleRootHex(): string; /** * Calculates the hash of this block header. * @returns 32-byte array containing the block hash */ getHash(): Uint8Array; /** * Gets the block hash as a hex string. * @returns 64-character hex string */ getHashHex(): string; }