import { SignatureVersion } from './script_signature.js';
import { Transaction, Output } from './transaction.js';
export declare enum InterpreterErr {
    NONE = "",
    SCRIPT_ERR_SCRIPT_SIZE = "SCRIPT_ERR_SCRIPT_SIZE",
    SCRIPT_ERR_DECOMPILE = "SCRIPT_ERR_DECOMPILE",
    SCRIPT_ERR_SIG_PUSHONLY = "SCRIPT_ERR_SIG_PUSHONLY",
    SCRIPT_ERR_EVAL_FALSE_NO_RESULT = "SCRIPT_ERR_EVAL_FALSE_NO_RESULT",
    SCRIPT_ERR_UNBALANCED_CONDITIONAL = "SCRIPT_ERR_UNBALANCED_CONDITIONAL",
    SCRIPT_ERR_CLEANSTACK = "SCRIPT_ERR_CLEANSTACK",
    SCRIPT_ERR_WITNESS_UNEXPECTED = "SCRIPT_ERR_WITNESS_UNEXPECTED",
    SCRIPT_ERR_UNDEFINED_OPCODE = "SCRIPT_ERR_UNDEFINED_OPCODE",
    SCRIPT_ERR_PUSH_SIZE = "SCRIPT_ERR_PUSH_SIZE",
    SCRIPT_ERR_OP_COUNT = "SCRIPT_ERR_OP_COUNT",
    SCRIPT_ERR_DISABLED_OPCODE = "SCRIPT_ERR_DISABLED_OPCODE",
    SCRIPT_ERR_OP_CODESEPARATOR = "SCRIPT_ERR_OP_CODESEPARATOR",
    SCRIPT_ERR_MINIMALDATA = "SCRIPT_ERR_MINIMALDATA",
    SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS = "SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",
    SCRIPT_ERR_INVALID_STACK_OPERATION = "SCRIPT_ERR_INVALID_STACK_OPERATION",
    SCRIPT_ERR_NEGATIVE_LOCKTIME = "SCRIPT_ERR_NEGATIVE_LOCKTIME",
    SCRIPT_ERR_UNSATISFIED_LOCKTIME = "SCRIPT_ERR_UNSATISFIED_LOCKTIME",
    SCRIPT_ERR_TAPSCRIPT_MINIMALIF = "SCRIPT_ERR_TAPSCRIPT_MINIMALIF",
    SCRIPT_ERR_MINIMALIF = "SCRIPT_ERR_MINIMALIF",
    SCRIPT_ERR_VERIFY = "SCRIPT_ERR_VERIFY",
    SCRIPT_ERR_OP_RETURN = "SCRIPT_ERR_OP_RETURN",
    SCRIPT_ERR_EQUALVERIFY = "SCRIPT_ERR_EQUALVERIFY",
    SCRIPT_ERR_NUMEQUALVERIFY = "SCRIPT_ERR_NUMEQUALVERIFY",
    SCRIPT_ERR_INVALID_ALTSTACK_OPERATION = "SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",
    SCRIPT_ERR_CHECKSIGVERIFY = "SCRIPT_ERR_CHECKSIGVERIFY",
    SCRIPT_ERR_BAD_OPCODE = "SCRIPT_ERR_BAD_OPCODE",
    SCRIPT_ERR_PUBKEY_COUNT = "SCRIPT_ERR_PUBKEY_COUNT",
    SCRIPT_ERR_SIG_COUNT = "SCRIPT_ERR_SIG_COUNT",
    SCRIPT_ERR_NULLFAIL = "SCRIPT_ERR_NULLFAIL",
    SCRIPT_ERR_SIG_NULLDUMMY = "SCRIPT_ERR_SIG_NULLDUMMY",
    SCRIPT_ERR_CHECKMULTISIGVERIFY = "SCRIPT_ERR_CHECKMULTISIGVERIFY",
    SCRIPT_ERR_SIG_NULLFAIL = "SCRIPT_ERR_SIG_NULLFAIL",
    SCRIPT_ERR_SIG_FINDANDDELETE = "SCRIPT_ERR_SIG_FINDANDDELETE",
    SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT = "SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT",
    SCRIPT_ERR_PUBKEYTYPE = "SCRIPT_ERR_PUBKEYTYPE",
    SCRIPT_ERR_SCHNORR_SIG = "SCRIPT_ERR_SCHNORR_SIG",
    SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE = "SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE",
    SCRIPT_ERR_WITNESS_PUBKEYTYPE = "SCRIPT_ERR_WITNESS_PUBKEYTYPE",
    SCRIPT_ERR_SIG_HASHTYPE = "SCRIPT_ERR_SIG_HASHTYPE",
    SCRIPT_ERR_SIG_DER_HIGH_S = "SCRIPT_ERR_SIG_DER_HIGH_S",
    SCRIPT_ERR_SIG_DER_INVALID_FORMAT = "SCRIPT_ERR_SIG_DER_INVALID_FORMAT",
    SCRIPT_ERR_WITNESS_MALLEATED = "SCRIPT_ERR_WITNESS_MALLEATED",
    SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY = "SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY",
    SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH = "SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH",
    SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH = "SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH",
    SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE = "SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE",
    SCRIPT_ERR_DISCOURAGE_OP_SUCCESS = "SCRIPT_ERR_DISCOURAGE_OP_SUCCESS",
    SCRIPT_ERR_STACK_SIZE = "SCRIPT_ERR_STACK_SIZE",
    SCRIPT_ERR_EVAL_FALSE = "SCRIPT_ERR_EVAL_FALSE",
    SCRIPT_ERR_EVAL_FALSE_IN_STACK = "SCRIPT_ERR_EVAL_FALSE_IN_STACK",
    SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM = "SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM",
    SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION = "SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION",
    SCRIPT_ERR_SCHNORR_SIG_SIZE = "SCRIPT_ERR_SCHNORR_SIG_SIZE",
    SCRIPT_ERR_SCHNORR_SIG_HASHTYPE = "SCRIPT_ERR_SCHNORR_SIG_HASHTYPE",
    SCRIPT_ERR_SCHNORR_SIG_NO_PREVOUTS = "SCRIPT_ERR_SCHNORR_SIG_NO_PREVOUTS",
    SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK = "SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",
    SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK = "SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",
    SCRIPT_ERR_WITNESS_MALLEATED_P2SH = "SCRIPT_ERR_WITNESS_MALLEATED_P2SH",
    SCRIPT_ERR_UNKNOWN_ERROR = "SCRIPT_ERR_UNKNOWN_ERROR"
}
export declare class Interpreter {
    static readonly MAX_SCRIPT_SIZE = 10000;
    static readonly MAX_STACK_SIZE = 1000;
    static readonly MAX_SCRIPT_ELEMENT_SIZE = 520;
    static readonly LOCKTIME_THRESHOLD = 500000000;
    static readonly SCRIPT_VERIFY_NONE = 0;
    static readonly SCRIPT_VERIFY_P2SH: number;
    static readonly SCRIPT_VERIFY_STRICTENC: number;
    static readonly SCRIPT_VERIFY_DERSIG: number;
    static readonly SCRIPT_VERIFY_LOW_S: number;
    static readonly SCRIPT_VERIFY_NULLDUMMY: number;
    static readonly SCRIPT_VERIFY_SIGPUSHONLY: number;
    static readonly SCRIPT_VERIFY_MINIMALDATA: number;
    static readonly SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS: number;
    static readonly SCRIPT_VERIFY_CLEANSTACK: number;
    static readonly SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY: number;
    static readonly SCRIPT_VERIFY_CHECKSEQUENCEVERIFY: number;
    static readonly SCRIPT_VERIFY_WITNESS: number;
    static readonly SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM: number;
    static readonly SCRIPT_VERIFY_MINIMALIF: number;
    static readonly SCRIPT_VERIFY_NULLFAIL: number;
    static readonly SCRIPT_VERIFY_WITNESS_PUBKEYTYPE: number;
    static readonly SCRIPT_ENABLE_SIGHASH_FORKID: number;
    static readonly SCRIPT_ENABLE_REPLAY_PROTECTION: number;
    static readonly SCRIPT_VERIFY_CONST_SCRIPTCODE: number;
    static readonly SCRIPT_VERIFY_TAPROOT: number;
    static readonly SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION: number;
    static readonly SCRIPT_VERIFY_DISCOURAGE_OP_SUCCESS: number;
    static readonly SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_PUBKEYTYPE: number;
    /**
     * If this flag set, CTxIn::nSequence is NOT interpreted as a relative
     * lock-time.
     */
    static readonly SEQUENCE_LOCKTIME_DISABLE_FLAG: number;
    /**
     * If CTxIn::nSequence encodes a relative lock-time and this flag is set,
     * the relative lock-time has units of 512 seconds, otherwise it specifies
     * blocks with a granularity of 1.
     */
    static readonly SEQUENCE_LOCKTIME_TYPE_FLAG: number;
    /**
     * If CTxIn::nSequence encodes a relative lock-time, this mask is applied to
     * extract that lock-time from the sequence field.
     */
    static readonly SEQUENCE_LOCKTIME_MASK = 65535;
    /** Signature hash sizes */
    static readonly WITNESS_V0_SCRIPTHASH_SIZE = 32;
    static readonly WITNESS_V0_KEYHASH_SIZE = 20;
    static readonly WITNESS_V1_TAPROOT_SIZE = 32;
    static readonly TAPROOT_LEAF_MASK = 254;
    static readonly TAPROOT_LEAF_TAPSCRIPT = 192;
    static readonly TAPROOT_CONTROL_BASE_SIZE = 33;
    static readonly TAPROOT_CONTROL_NODE_SIZE = 32;
    static readonly TAPROOT_CONTROL_MAX_NODE_COUNT = 128;
    static readonly VALIDATION_WEIGHT_PER_SIGOP_PASSED = 50;
    static readonly VALIDATION_WEIGHT_OFFSET = 50;
    static readonly ANNEX_TAG = 80;
    static readonly TRUE: Uint8Array;
    static readonly FALSE: Uint8Array;
    static readonly TAPROOT_CONTROL_MAX_SIZE: number;
    static readonly PROTOCOL_VERSION = 70016;
    private sigversion;
    private errstr;
    private stack;
    private altstack;
    private vfExec;
    private pc;
    private pbegincodehash;
    private satoshis;
    private nOpCount;
    private flags;
    private execdata;
    private script;
    private tx;
    private prevOuts;
    private nin;
    constructor();
    getErr(): InterpreterErr;
    initialize(): void;
    setScript(script: Uint8Array | Array<number | Uint8Array>): boolean;
    setTx(tx: Transaction): void;
    setPrevOuts(prevOuts: Output[] | undefined): void;
    setNin(nin: number): void;
    setFlags(flags: number): void;
    setStack(stack: Uint8Array[]): void;
    setSigversion(sigversion: SignatureVersion): void;
    setSatoshis(satoshis: number): void;
    setExecdata(execdata: any): void;
    verify(scriptSig: Uint8Array, scriptPubkey: Uint8Array, tx?: Transaction, nin?: number, flags?: number, witness?: Uint8Array[], satoshis?: number, prevOuts?: Output[]): boolean;
    verifyWitnessProgram(version: number, program: Uint8Array, witness: Uint8Array[], satoshis: number, flags: number, isP2SH?: boolean): boolean;
    executeWitnessScript(scriptPubKey: Array<number | Uint8Array>, stack: Array<Uint8Array>, sigversion: SignatureVersion, satoshis: number, flags: number, execdata: any): boolean;
    /**
     * Based on bitcoind's EvalScript function, with the inner loop moved to
     * static readonly prototype.step()
     * bitcoind commit: b5d1b1092998bc95313856d535c632ea5a8f9104
     */
    evaluate(): boolean;
    static castToBool(buf: Uint8Array): boolean;
    step(): boolean;
    /**
     * Checks a locktime parameter with the transaction's locktime.
     * There are two times of nLockTime: lock-by-blockheight and lock-by-blocktime,
     * distinguished by whether nLockTime < LOCKTIME_THRESHOLD = 500000000
     *
     * See the corresponding code on bitcoin core:
     * https://github.com/bitcoin/bitcoin/blob/ffd75adce01a78b3461b3ff05bcc2b530a9ce994/src/script/interpreter.cpp#L1129
     *
     * @param {BN} nLockTime the locktime read from the script
     * @return {boolean} true if the transaction's locktime is less than or equal to
     *                   the transaction's locktime
     */
    checkLockTime(nLockTime: bigint): boolean;
    /**
     * Checks a sequence parameter with the transaction's sequence.
     * @param {BN} nSequence the sequence read from the script
     * @return {boolean} true if the transaction's sequence is less than or equal to
     *                   the transaction's sequence
     */
    checkSequence(nSequence: bigint): boolean;
    /**
     * Based on bitcoind's EvalChecksig function
     * bitcoind commit: a0988140b71485ad12c3c3a4a9573f7c21b1eff8
     * @returns {{ success: Boolean, verified: Boolean }}
     */
    _evalCheckSig(bufSig: Uint8Array, bufPubkey: Uint8Array): {
        success: boolean;
        result: boolean;
    };
    /**
     * Based on bitcoind's EvalChecksigPreTapscript function
     * bitcoind commit: a0988140b71485ad12c3c3a4a9573f7c21b1eff8
     */
    _evalChecksigPreTapscript(bufSig: Uint8Array, bufPubkey: Uint8Array): {
        success: boolean;
        result: boolean;
    };
    /**
     * Based on bitcoind's EvalChecksigTapscript function
     * bitcoind commit: a0988140b71485ad12c3c3a4a9573f7c21b1eff8
     */
    _evalChecksigTapscript(bufSig: Uint8Array, bufPubkey: Uint8Array): {
        success: boolean;
        result: boolean;
    };
    /**
     * Verifies Schnorr signature
     * @param {Signature|Buffer} sig
     * @param {PublicKey|Buffer} pubkey
     * @param {Number} sigversion
     * @param {Object} execdata
     * @returns {Boolean}
     */
    checkSchnorrSignature(sig: Uint8Array, pubkey: Uint8Array, sigversion: SignatureVersion, execdata: any): boolean;
    static computeTapleafHash(leafVersion: number, scriptBuf: Uint8Array): Uint8Array;
    static verifyTaprootCommitment(control: Uint8Array, program: Uint8Array, tapleafHash: Uint8Array): boolean;
    /**
     * Translated from bitcoind's CheckSignatureEncoding
     */
    checkSignatureEncoding(buf: Uint8Array): boolean;
    /**
     * Translated from bitcoind's CheckPubKeyEncoding
     */
    checkPubkeyEncoding(buf: Uint8Array): boolean;
    isInitialized(): boolean;
    /**
     * This is here largely for legacy reasons. However, if the sig type
     * is already known (via sigversion), then it would be better to call
     * checkEcdsaSignature or checkSchnorrSignature directly.
     * @param {Signature|Buffer} sig Signature to verify
     * @param {PublicKey|Buffer} pubkey Public key used to verify sig
     * @param {Number} nin Tx input index to verify signature against
     * @param {Script} subscript ECDSA only
     * @param {Number} sigversion See Signature.Version for valid versions (default: 0 or Signature.Version.BASE)
     * @param {Number} satoshis ECDSA only
     * @param {Object} execdata Schnorr only
     * @returns {Boolean} whether the signature is valid for this transaction input
     */
    verifySignature(sig: Uint8Array, pubkey: Uint8Array, subscript: Array<number | Uint8Array>, sigversion: SignatureVersion, execdata: any): boolean;
    /**
     * Verify ECDSA signature
     * @param {Signature} _sig
     * @param {PublicKey} _pubkey
     * @param {Number} _nin
     * @param {Script} _subscript
     * @param {Number} _satoshis
     * @returns {Boolean}
     */
    checkEcdsaSignature(sig: Uint8Array, pubkey: Uint8Array, subscript: Array<number | Uint8Array>): boolean;
}
