Versions in this module Expand all Collapse all v0 v0.0.2 May 5, 2024 v0.0.1 Apr 8, 2023 Changes in this version + const LockTimeThreshold + const MaxDataCarrierSize + const MaxOpsPerScript + const MaxPubKeysPerMultiSig + const MaxScriptElementSize + const MaxScriptSize + const MaxStackSize + const OP_0 + const OP_0NOTEQUAL + const OP_1 + const OP_10 + const OP_11 + const OP_12 + const OP_13 + const OP_14 + const OP_15 + const OP_16 + const OP_1ADD + const OP_1NEGATE + const OP_1SUB + const OP_2 + const OP_2DIV + const OP_2DROP + const OP_2DUP + const OP_2MUL + const OP_2OVER + const OP_2ROT + const OP_2SWAP + const OP_3 + const OP_3DUP + const OP_4 + const OP_5 + const OP_6 + const OP_7 + const OP_8 + const OP_9 + const OP_ABS + const OP_ACTIVEBYTECODE + const OP_ADD + const OP_AND + const OP_BIN2NUM + const OP_BOOLAND + const OP_BOOLOR + const OP_CAT + const OP_CHECKDATASIG + const OP_CHECKDATASIGVERIFY + const OP_CHECKLOCKTIMEVERIFY + const OP_CHECKMULTISIG + const OP_CHECKMULTISIGVERIFY + const OP_CHECKSEQUENCEVERIFY + const OP_CHECKSIG + const OP_CHECKSIGVERIFY + const OP_CODESEPARATOR + const OP_DATA_1 + const OP_DATA_10 + const OP_DATA_11 + const OP_DATA_12 + const OP_DATA_13 + const OP_DATA_14 + const OP_DATA_15 + const OP_DATA_16 + const OP_DATA_17 + const OP_DATA_18 + const OP_DATA_19 + const OP_DATA_2 + const OP_DATA_20 + const OP_DATA_21 + const OP_DATA_22 + const OP_DATA_23 + const OP_DATA_24 + const OP_DATA_25 + const OP_DATA_26 + const OP_DATA_27 + const OP_DATA_28 + const OP_DATA_29 + const OP_DATA_3 + const OP_DATA_30 + const OP_DATA_31 + const OP_DATA_32 + const OP_DATA_33 + const OP_DATA_34 + const OP_DATA_35 + const OP_DATA_36 + const OP_DATA_37 + const OP_DATA_38 + const OP_DATA_39 + const OP_DATA_4 + const OP_DATA_40 + const OP_DATA_41 + const OP_DATA_42 + const OP_DATA_43 + const OP_DATA_44 + const OP_DATA_45 + const OP_DATA_46 + const OP_DATA_47 + const OP_DATA_48 + const OP_DATA_49 + const OP_DATA_5 + const OP_DATA_50 + const OP_DATA_51 + const OP_DATA_52 + const OP_DATA_53 + const OP_DATA_54 + const OP_DATA_55 + const OP_DATA_56 + const OP_DATA_57 + const OP_DATA_58 + const OP_DATA_59 + const OP_DATA_6 + const OP_DATA_60 + const OP_DATA_61 + const OP_DATA_62 + const OP_DATA_63 + const OP_DATA_64 + const OP_DATA_65 + const OP_DATA_66 + const OP_DATA_67 + const OP_DATA_68 + const OP_DATA_69 + const OP_DATA_7 + const OP_DATA_70 + const OP_DATA_71 + const OP_DATA_72 + const OP_DATA_73 + const OP_DATA_74 + const OP_DATA_75 + const OP_DATA_8 + const OP_DATA_9 + const OP_DEPTH + const OP_DIV + const OP_DROP + const OP_DUP + const OP_ELSE + const OP_ENDIF + const OP_EQUAL + const OP_EQUALVERIFY + const OP_FALSE + const OP_FROMALTSTACK + const OP_GREATERTHAN + const OP_GREATERTHANOREQUAL + const OP_HASH160 + const OP_HASH256 + const OP_IF + const OP_IFDUP + const OP_INPUTBYTECODE + const OP_INPUTINDEX + const OP_INPUTSEQUENCENUMBER + const OP_INVALIDOPCODE + const OP_INVERT + const OP_LESSTHAN + const OP_LESSTHANOREQUAL + const OP_LSHIFT + const OP_MAX + const OP_MIN + const OP_MOD + const OP_MUL + const OP_NEGATE + const OP_NIP + const OP_NOP + const OP_NOP1 + const OP_NOP10 + const OP_NOP2 + const OP_NOP3 + const OP_NOP4 + const OP_NOP5 + const OP_NOP6 + const OP_NOP7 + const OP_NOP8 + const OP_NOP9 + const OP_NOT + const OP_NOTIF + const OP_NUM2BIN + const OP_NUMEQUAL + const OP_NUMEQUALVERIFY + const OP_NUMNOTEQUAL + const OP_OR + const OP_OUTPOINTINDEX + const OP_OUTPOINTTXHASH + const OP_OUTPUTBYTECODE + const OP_OUTPUTVALUE + const OP_OVER + const OP_PICK + const OP_PUBKEY + const OP_PUBKEYHASH + const OP_PUBKEYS + const OP_PUSHDATA1 + const OP_PUSHDATA2 + const OP_PUSHDATA4 + const OP_RESERVED + const OP_RESERVED1 + const OP_RESERVED2 + const OP_RETURN + const OP_REVERSEBYTES + const OP_RIPEMD160 + const OP_ROLL + const OP_ROT + const OP_RSHIFT + const OP_SHA1 + const OP_SHA256 + const OP_SIZE + const OP_SMALLINTEGER + const OP_SPLIT + const OP_SUB + const OP_SWAP + const OP_TOALTSTACK + const OP_TRUE + const OP_TUCK + const OP_TXINPUTCOUNT + const OP_TXLOCKTIME + const OP_TXOUTPUTCOUNT + const OP_TXVERSION + const OP_UNKNOWN189 + const OP_UNKNOWN190 + const OP_UNKNOWN191 + const OP_UNKNOWN206 + const OP_UNKNOWN207 + const OP_UNKNOWN208 + const OP_UNKNOWN209 + const OP_UNKNOWN210 + const OP_UNKNOWN211 + const OP_UNKNOWN212 + const OP_UNKNOWN213 + const OP_UNKNOWN214 + const OP_UNKNOWN215 + const OP_UNKNOWN216 + const OP_UNKNOWN217 + const OP_UNKNOWN218 + const OP_UNKNOWN219 + const OP_UNKNOWN220 + const OP_UNKNOWN221 + const OP_UNKNOWN222 + const OP_UNKNOWN223 + const OP_UNKNOWN224 + const OP_UNKNOWN225 + const OP_UNKNOWN226 + const OP_UNKNOWN227 + const OP_UNKNOWN228 + const OP_UNKNOWN229 + const OP_UNKNOWN230 + const OP_UNKNOWN231 + const OP_UNKNOWN232 + const OP_UNKNOWN233 + const OP_UNKNOWN234 + const OP_UNKNOWN235 + const OP_UNKNOWN236 + const OP_UNKNOWN237 + const OP_UNKNOWN238 + const OP_UNKNOWN239 + const OP_UNKNOWN240 + const OP_UNKNOWN241 + const OP_UNKNOWN242 + const OP_UNKNOWN243 + const OP_UNKNOWN244 + const OP_UNKNOWN245 + const OP_UNKNOWN246 + const OP_UNKNOWN247 + const OP_UNKNOWN248 + const OP_UNKNOWN249 + const OP_UNKNOWN252 + const OP_UTXOBYTECODE + const OP_UTXOVALUE + const OP_VER + const OP_VERIF + const OP_VERIFY + const OP_VERNOTIF + const OP_WITHIN + const OP_XOR + const OpCondFalse + const OpCondSkip + const OpCondTrue + const StandardVerifyFlags + var Bip16Activation = time.Unix(1333238400, 0) + var ErrUnsupportedScriptType = errors.New("unsupported script type") + var OpcodeByName = make(map[string]byte) + func CalcMultiSigStats(script []byte) (int, int, error) + func CalcSignatureHash(script []byte, sigHashes *TxSigHashes, hType SigHashType, tx *wire.MsgTx, ...) ([]byte, error) + func DisableLog() + func DisasmString(buf []byte) (string, error) + func ExtractDataElements(script []byte) ([][]byte, error) + func ExtractRedeemScript(script []byte) ([]byte, error) + func IsErrorCode(err error, c ErrorCode) bool + func IsPayToScriptHash(script []byte) bool + func IsPushOnlyScript(script []byte) bool + func IsUnspendable(pkScript []byte) bool + func LegacySignatureScript(tx *wire.MsgTx, idx int, subscript []byte, hashType SigHashType, ...) ([]byte, error) + func LegacyTxInSignature(tx *wire.MsgTx, idx int, subScript []byte, hashType SigHashType, ...) ([]byte, error) + func MultiSigScript(pubkeys []*bchutil.AddressPubKey, nrequired int) ([]byte, error) + func NullDataScript(data []byte) ([]byte, error) + func PayToAddrScript(addr bchutil.Address) ([]byte, error) + func PushedData(script []byte) ([][]byte, error) + func RawTxInECDSASignature(tx *wire.MsgTx, idx int, subScript []byte, hashType SigHashType, ...) ([]byte, error) + func RawTxInSchnorrSignature(tx *wire.MsgTx, idx int, subScript []byte, hashType SigHashType, ...) ([]byte, error) + func SignTxOutput(chainParams *chaincfg.Params, tx *wire.MsgTx, idx int, amt int64, ...) ([]byte, error) + func SignatureScript(tx *wire.MsgTx, idx int, amt int64, subscript []byte, hashType SigHashType, ...) ([]byte, error) + func UseLogger(logger bchlog.Logger) + type AtomicSwapDataPushes struct + LockTime int64 + RecipientHash160 [20]byte + RefundHash160 [20]byte + SecretHash [32]byte + SecretSize int64 + func ExtractAtomicSwapDataPushes(version uint16, pkScript []byte) (*AtomicSwapDataPushes, error) + type Engine struct + func NewEngine(scriptPubKey []byte, tx *wire.MsgTx, txIdx int, flags ScriptFlags, ...) (*Engine, error) + func (vm *Engine) CheckErrorCondition(finalScript bool) error + func (vm *Engine) Clone() *Engine + func (vm *Engine) DisasmPC() (string, error) + func (vm *Engine) DisasmScript(idx int) (string, error) + func (vm *Engine) Execute() (err error) + func (vm *Engine) GetAltStack() [][]byte + func (vm *Engine) GetStack() [][]byte + func (vm *Engine) IsBranchExecuting() bool + func (vm *Engine) SetAltStack(data [][]byte) + func (vm *Engine) SetStack(data [][]byte) + func (vm *Engine) SigChecks() int + func (vm *Engine) Step() (done bool, err error) + type ErrScriptNotCanonical string + func (e ErrScriptNotCanonical) Error() string + type Error struct + Description string + ErrorCode ErrorCode + func (e Error) Error() string + type ErrorCode int + const ErrCheckDataSigVerify + const ErrCheckMultiSigVerify + const ErrCheckSigVerify + const ErrCleanStack + const ErrDisabledOpcode + const ErrDiscourageUpgradableNOPs + const ErrEarlyReturn + const ErrElementTooBig + const ErrEmptyStack + const ErrEqualVerify + const ErrEvalFalse + const ErrInputSigChecks + const ErrIntegerOverflow + const ErrInternal + const ErrInvalidBitCount + const ErrInvalidDummy + const ErrInvalidFlags + const ErrInvalidIndex + const ErrInvalidInputLength + const ErrInvalidProgramCounter + const ErrInvalidPubKeyCount + const ErrInvalidSigHashType + const ErrInvalidSignatureCount + const ErrInvalidStackOperation + const ErrMalformedPush + const ErrMinimalData + const ErrMinimalIf + const ErrNegativeLockTime + const ErrNotMultisigScript + const ErrNotPushOnly + const ErrNullFail + const ErrNumEqualVerify + const ErrNumberTooBig + const ErrNumberTooSmall + const ErrPubKeyType + const ErrReservedOpcode + const ErrScriptTooBig + const ErrScriptUnfinished + const ErrSigHighS + const ErrSigInvalidDataLen + const ErrSigInvalidRIntID + const ErrSigInvalidSIntID + const ErrSigInvalidSLen + const ErrSigInvalidSeqID + const ErrSigMissingSLen + const ErrSigMissingSTypeID + const ErrSigNegativeR + const ErrSigNegativeS + const ErrSigNullDummy + const ErrSigTooLong + const ErrSigTooMuchRPadding + const ErrSigTooMuchSPadding + const ErrSigTooShort + const ErrSigZeroRLen + const ErrSigZeroSLen + const ErrStackOverflow + const ErrTooManyOperations + const ErrTooManyRequiredSigs + const ErrTooMuchNullData + const ErrUnbalancedConditional + const ErrUnsatisfiedLockTime + const ErrUnsupportedAddress + const ErrVerify + func (e ErrorCode) String() string + type HashCache struct + func NewHashCache(maxSize uint) *HashCache + func (h *HashCache) AddSigHashes(tx *wire.MsgTx) + func (h *HashCache) ContainsHashes(txid *chainhash.Hash) bool + func (h *HashCache) GetSigHashes(txid *chainhash.Hash) (*TxSigHashes, bool) + func (h *HashCache) PurgeSigHashes(txid *chainhash.Hash) + type KeyClosure func(bchutil.Address) (*bchec.PrivateKey, bool, error) + func (kc KeyClosure) GetKey(address bchutil.Address) (*bchec.PrivateKey, bool, error) + type KeyDB interface + GetKey func(bchutil.Address) (*bchec.PrivateKey, bool, error) + type PkScript struct + func ComputePkScript(sigScript []byte) (PkScript, error) + func ParsePkScript(pkScript []byte, chainParams *chaincfg.Params) (PkScript, error) + func (s PkScript) Address(chainParams *chaincfg.Params) (bchutil.Address, error) + func (s PkScript) Class() ScriptClass + func (s PkScript) Script() []byte + func (s PkScript) String() string + type ScriptBuilder struct + func NewScriptBuilder() *ScriptBuilder + func (b *ScriptBuilder) AddData(data []byte) *ScriptBuilder + func (b *ScriptBuilder) AddFullData(data []byte) *ScriptBuilder + func (b *ScriptBuilder) AddInt64(val int64) *ScriptBuilder + func (b *ScriptBuilder) AddOp(opcode byte) *ScriptBuilder + func (b *ScriptBuilder) AddOps(opcodes []byte) *ScriptBuilder + func (b *ScriptBuilder) Reset() *ScriptBuilder + func (b *ScriptBuilder) Script() ([]byte, error) + type ScriptClass byte + const MultiSigTy + const NonStandardTy + const NullDataTy + const PubKeyHashTy + const PubKeyTy + const ScriptHashTy + func ExtractPkScriptAddrs(pkScript []byte, chainParams *chaincfg.Params) (ScriptClass, []bchutil.Address, int, error) + func GetScriptClass(script []byte) ScriptClass + func (t ScriptClass) String() string + type ScriptClosure func(bchutil.Address) ([]byte, error) + func (sc ScriptClosure) GetScript(address bchutil.Address) ([]byte, error) + type ScriptDB interface + GetScript func(bchutil.Address) ([]byte, error) + type ScriptFlags uint32 + const ScriptBip16 + const ScriptDiscourageUpgradableNops + const ScriptReportSigChecks + const ScriptStrictMultiSig + const ScriptVerify64BitIntegers + const ScriptVerifyAllowSegwitRecovery + const ScriptVerifyBip143SigHash + const ScriptVerifyCheckDataSig + const ScriptVerifyCheckLockTimeVerify + const ScriptVerifyCheckSequenceVerify + const ScriptVerifyCleanStack + const ScriptVerifyCompressedPubkey + const ScriptVerifyDERSignatures + const ScriptVerifyInputSigChecks + const ScriptVerifyLowS + const ScriptVerifyMinimalData + const ScriptVerifyMinimalIf + const ScriptVerifyNativeIntrospection + const ScriptVerifyNullFail + const ScriptVerifyReverseBytes + const ScriptVerifySchnorr + const ScriptVerifySchnorrMultisig + const ScriptVerifySigPushOnly + const ScriptVerifyStrictEncoding + func (scriptFlags ScriptFlags) HasFlag(flag ScriptFlags) bool + type ScriptInfo struct + ExpectedInputs int + NumInputs int + PkScriptClass ScriptClass + func CalcScriptInfo(sigScript, pkScript []byte, scriptFlags ScriptFlags) (*ScriptInfo, error) + type SigCache struct + func NewSigCache(maxEntries uint) *SigCache + func (s *SigCache) Add(sigHash chainhash.Hash, sig *bchec.Signature, pubKey *bchec.PublicKey) + func (s *SigCache) Exists(sigHash chainhash.Hash, sig *bchec.Signature, pubKey *bchec.PublicKey) bool + type SigHashType uint32 + const SigHashAll + const SigHashAnyOneCanPay + const SigHashForkID + const SigHashNone + const SigHashOld + const SigHashSingle + type TxSigHashes struct + HashOutputs chainhash.Hash + HashPrevOuts chainhash.Hash + HashSequence chainhash.Hash + func NewTxSigHashes(tx *wire.MsgTx) *TxSigHashes + type UtxoCache struct + func NewUtxoCache() *UtxoCache + func (u *UtxoCache) AddEntry(i int, output wire.TxOut) + func (u *UtxoCache) GetEntry(i int) (wire.TxOut, error)