import type { LightBlock } from '../../../blockchain-provider/components/block.interfaces';
export declare class Chain {
    block: LightBlock;
    next: Chain | null;
    prev: Chain | null;
}
/**
 * EVM-only Blockchain class with full Patricia Trie validation
 * Works with ALL EVM networks automatically:
 * Any EVM-compatible chain configured by the crawler/runtime.
 */
export declare class Blockchain {
    private _head;
    private _tail;
    private _size;
    private _maxSize;
    private _baseBlockHeight;
    private heightIndex;
    constructor({ maxSize, baseBlockHeight }: {
        maxSize: number;
        baseBlockHeight?: number;
    });
    get head(): Chain | null;
    get tail(): Chain | null;
    get firstBlockHash(): string | undefined;
    get lastBlock(): LightBlock | undefined;
    /**
     * Gets the previous hash of the last block in the chain
     * @returns The previous hash of the last block, or undefined if the chain is empty
     * Complexity: O(1)
     */
    get lastPrevBlockHash(): string | undefined;
    /**
     * Gets the hash of the last block in the chain
     * @returns The hash of the last block, or undefined if the chain is empty
     * Complexity: O(1)
     */
    get lastBlockHash(): string | undefined;
    /**
     * Gets the height of the last block in the chain
     * @returns The height of the last block, or undefined if the chain is empty
     * Complexity: O(1)
     */
    get lastBlockHeight(): number | undefined;
    /**
     * Gets the size of the blockchain
     * @returns The number of blocks in the chain
     * Complexity: O(1)
     */
    get size(): number;
    /**
     * Adds a block to the end of the chain without validation
     * @param block - The block to add
     * @returns True if the block was added successfully, false otherwise
     * Complexity: O(1)
     */
    private addBlockFast;
    /**
     * Adds a block to the end of the chain with SPV validation
     * @param block - The block to add
     * @returns True if the block was added successfully, false otherwise
     * Complexity: O(1)
     */
    addBlock(block: LightBlock): boolean;
    /**
     * Adds an array of light blocks to the chain
     * @param blocks - Array of light blocks to add
     * @returns True if the blocks were added successfully, false otherwise
     * Complexity: O(n), where n is the number of blocks in the array
     */
    addBlocks(blocks: LightBlock[]): boolean;
    /**
     * Gets the last block without deleting it
     * @returns The last block in the chain, or null if the chain is empty
     * Complexity: O(1)
     */
    peekLast(): LightBlock | null;
    /**
     * Validates the next block to be added to the chain
     * @param blockNumber - The height of the new block
     * @param parentHash - The hash of the previous block
     * @returns True if the block is valid, false otherwise
     * Complexity: O(1)
     */
    validateNextBlock(blockNumber: number, parentHash: string): boolean;
    /**
     * Validates an array of light blocks to be added to the chain
     * Ensures that the blocks are in the correct order and can be added sequentially
     * @param blocks - Array of light blocks to validate
     * @returns True if all blocks are valid and in the correct order, false otherwise
     * Complexity: O(n), where n is the number of blocks in the array
     */
    validateNextBlocks(blocks: LightBlock[]): boolean;
    /**
     * Truncates the blockchain up to a specified block height (inclusive)
     * The block with the given height becomes the new tail of the chain
     *
     * @param blockNumber - The height up to which the chain should be truncated
     *                      Passing this._baseBlockHeight will clear the entire chain
     * @returns Returns true if truncation was successful or the chain is already in the desired state, false otherwise
     * Complexity O(n), where n is the number of blocks to check from the tail to the specified height
     */
    truncateToBlock(blockNumber: number): boolean;
    /**
     * Validates the entire blockchain
     * @returns True if the blockchain is valid, false otherwise
     * Complexity: O(n), where n is the number of blocks in the chain
     */
    validateChain(): boolean;
    /**
     * Validates that the provided block data matches the last block in the chain
     * @param blockNumber - The expected height of the last block
     * @param hash - The expected hash of the last block
     * @param parentHash - The expected previous hash of the last block
     * @returns True if the provided data matches the last block, false otherwise
     * NOTE: This method is needed for the case when we confirm the indexing of a block
     * in another command to make sure that the block we are passing exactly matches the chain
     * Complexity: O(1)
     */
    validateLastBlock(blockNumber: number, hash: string, parentHash: string): boolean;
    /**
     * Finds a block by its height using O(1) index lookup
     * @param blockNumber - The height of the block to find
     * @returns The block, or null if not found
     * Complexity: O(1) - constant time lookup
     */
    findBlockByHeight(blockNumber: number): LightBlock | null;
    /**
     * Removes the first block in the chain
     * @returns The removed block, or null if the chain is empty
     * Complexity: O(1)
     */
    private removeOldestChain;
    /**
     * Gets the last N blocks from the blockchain in reverse order
     * @param n - The number of blocks to retrieve
     * @returns An array containing the last N blocks in the chain, in reverse order
     * Complexity: O(n), where n is the number of blocks to retrieve
     */
    getLastNBlocks(n: number): LightBlock[];
    /**
     * Converts the linked list of blocks into an ordered array of LightBlock objects
     * @returns An array containing all blocks in the blockchain from head to tail
     * Complexity O(n) - where n is the number of blocks in the blockchain
     */
    toArray(): LightBlock[];
    /**
     * Restores the linked list of blocks from an ordered array of LightBlock objects
     * This method clears the current blockchain and rebuilds it from the provided array
     * @param blocks - An array of LightBlock objects to reconstruct the blockchain
     * @returns void
     * Complexity O(n) - where n is the number of blocks in the provided array
     */
    fromArray(blocks: LightBlock[]): void;
}
