@btc-vision/transaction
Version:
OPNet transaction library allows you to create and sign transactions for the OPNet network.
48 lines • 1.79 kB
TypeScript
import { IChallengeSolution, RawChallenge } from '../interfaces/IChallengeSolution.js';
export declare class EpochValidator {
private static readonly BLOCKS_PER_EPOCH;
/**
* Calculate SHA-1 hash
*/
static sha1(data: Uint8Array): Uint8Array;
/**
* Calculate mining preimage
*/
static calculatePreimage(checksumRoot: Uint8Array, publicKey: Uint8Array, salt: Uint8Array): Uint8Array;
/**
* Count matching bits between two hashes
*/
static countMatchingBits(hash1: Uint8Array, hash2: Uint8Array): number;
/**
* Verify an epoch solution using IPreimage
*/
static verifySolution(challenge: IChallengeSolution, log?: boolean): boolean;
/**
* Get the mining target block for an epoch
*/
static getMiningTargetBlock(epochNumber: bigint): bigint | null;
/**
* Validate epoch winner from raw data
*/
static validateEpochWinner(epochData: RawChallenge): boolean;
/**
* Validate epoch winner from Preimage instance
*/
static validateChallengeSolution(challenge: IChallengeSolution): boolean;
/**
* Calculate solution hash from preimage components
* @param targetChecksum The target checksum (32 bytes)
* @param publicKey The public key buffer (32 bytes)
* @param salt The salt buffer (32 bytes)
* @returns The SHA-1 hash of the preimage
*/
static calculateSolution(targetChecksum: Uint8Array, publicKey: Uint8Array, salt: Uint8Array): Uint8Array;
/**
* Check if a solution meets the minimum difficulty requirement
*/
static checkDifficulty(solution: Uint8Array, targetHash: Uint8Array, minDifficulty: number): {
valid: boolean;
difficulty: number;
};
}
//# sourceMappingURL=EpochValidator.d.ts.map