Versions in this module Expand all Collapse all v0 v0.0.1 Dec 19, 2019 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_ADD + const OP_AND + const OP_BOOLAND + const OP_BOOLOR + const OP_CAT + 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_INVALIDOPCODE + const OP_INVERT + const OP_LEFT + 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_NUMEQUAL + const OP_NUMEQUALVERIFY + const OP_NUMNOTEQUAL + const OP_OR + 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_RIGHT + 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_SUB + const OP_SUBSTR + const OP_SWAP + const OP_TOALTSTACK + const OP_TRUE + const OP_TUCK + const OP_UNKNOWN186 + const OP_UNKNOWN187 + const OP_UNKNOWN188 + const OP_UNKNOWN189 + const OP_UNKNOWN190 + const OP_UNKNOWN191 + const OP_UNKNOWN192 + const OP_UNKNOWN193 + const OP_UNKNOWN194 + const OP_UNKNOWN195 + const OP_UNKNOWN196 + const OP_UNKNOWN197 + const OP_UNKNOWN198 + const OP_UNKNOWN199 + const OP_UNKNOWN200 + const OP_UNKNOWN201 + const OP_UNKNOWN202 + const OP_UNKNOWN203 + const OP_UNKNOWN204 + const OP_UNKNOWN205 + 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_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, hashType SigHashType, tx *wire.MsgTx, idx int) ([]byte, error) + func CalcWitnessSigHash(script []byte, sigHashes *TxSigHashes, hType SigHashType, tx *wire.MsgTx, ...) ([]byte, error) + func DisableLog() + func DisasmString(buf []byte) (string, error) + func ExtractWitnessProgramInfo(script []byte) (int, []byte, error) + func GetPreciseSigOpCount(scriptSig, scriptPubKey []byte, bip16 bool) int + func GetSigOpCount(script []byte) int + func GetWitnessSigOpCount(sigScript, pkScript []byte, witness wire.TxWitness) int + func IsErrorCode(err error, c ErrorCode) bool + func IsPayToScriptHash(script []byte) bool + func IsPayToWitnessPubKeyHash(script []byte) bool + func IsPayToWitnessScriptHash(script []byte) bool + func IsPushOnlyScript(script []byte) bool + func IsUnspendable(pkScript []byte) bool + func IsWitnessProgram(script []byte) bool + func MultiSigScript(pubkeys []*btcutil.AddressPubKey, nrequired int) ([]byte, error) + func NullDataScript(data []byte) ([]byte, error) + func PayToAddrScript(addr btcutil.Address) ([]byte, error) + func PushedData(script []byte) ([][]byte, error) + func RawTxInSignature(tx *wire.MsgTx, idx int, subScript []byte, hashType SigHashType, ...) ([]byte, error) + func RawTxInWitnessSignature(tx *wire.MsgTx, sigHashes *TxSigHashes, idx int, amt int64, subScript []byte, ...) ([]byte, error) + func SignTxOutput(chainParams *chaincfg.Params, tx *wire.MsgTx, idx int, pkScript []byte, ...) ([]byte, error) + func SignatureScript(tx *wire.MsgTx, idx int, subscript []byte, hashType SigHashType, ...) ([]byte, error) + func UseLogger(logger btclog.Logger) + func WitnessSignature(tx *wire.MsgTx, sigHashes *TxSigHashes, idx int, amt int64, subscript []byte, ...) (wire.TxWitness, error) + 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) 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) SetAltStack(data [][]byte) + func (vm *Engine) SetStack(data [][]byte) + 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 ErrCheckMultiSigVerify + const ErrCheckSigVerify + const ErrCleanStack + const ErrDisabledOpcode + const ErrDiscourageUpgradableNOPs + const ErrDiscourageUpgradableWitnessProgram + const ErrEarlyReturn + const ErrElementTooBig + const ErrEmptyStack + const ErrEqualVerify + const ErrEvalFalse + const ErrInternal + const ErrInvalidFlags + const ErrInvalidIndex + 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 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 + const ErrWitnessMalleated + const ErrWitnessMalleatedP2SH + const ErrWitnessProgramEmpty + const ErrWitnessProgramMismatch + const ErrWitnessProgramWrongLength + const ErrWitnessPubKeyType + const ErrWitnessUnexpected + 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(btcutil.Address) (*btcec.PrivateKey, bool, error) + func (kc KeyClosure) GetKey(address btcutil.Address) (*btcec.PrivateKey, bool, error) + type KeyDB interface + GetKey func(btcutil.Address) (*btcec.PrivateKey, bool, error) + type PkScript struct + func ComputePkScript(sigScript []byte, witness wire.TxWitness) (PkScript, error) + func ParsePkScript(pkScript []byte) (PkScript, error) + func (s PkScript) Address(chainParams *chaincfg.Params) (btcutil.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 + const WitnessV0PubKeyHashTy + const WitnessV0ScriptHashTy + func ExtractPkScriptAddrs(pkScript []byte, chainParams *chaincfg.Params) (ScriptClass, []btcutil.Address, int, error) + func GetScriptClass(script []byte) ScriptClass + func (t ScriptClass) String() string + type ScriptClosure func(btcutil.Address) ([]byte, error) + func (sc ScriptClosure) GetScript(address btcutil.Address) ([]byte, error) + type ScriptDB interface + GetScript func(btcutil.Address) ([]byte, error) + type ScriptFlags uint32 + const ScriptBip16 + const ScriptDiscourageUpgradableNops + const ScriptStrictMultiSig + const ScriptVerifyCheckLockTimeVerify + const ScriptVerifyCheckSequenceVerify + const ScriptVerifyCleanStack + const ScriptVerifyDERSignatures + const ScriptVerifyDiscourageUpgradeableWitnessProgram + const ScriptVerifyLowS + const ScriptVerifyMinimalData + const ScriptVerifyMinimalIf + const ScriptVerifyNullFail + const ScriptVerifySigPushOnly + const ScriptVerifyStrictEncoding + const ScriptVerifyWitness + const ScriptVerifyWitnessPubKeyType + type ScriptInfo struct + ExpectedInputs int + NumInputs int + PkScriptClass ScriptClass + SigOps int + func CalcScriptInfo(sigScript, pkScript []byte, witness wire.TxWitness, bip16, segwit bool) (*ScriptInfo, error) + type SigCache struct + func NewSigCache(maxEntries uint) *SigCache + func (s *SigCache) Add(sigHash chainhash.Hash, sig *btcec.Signature, pubKey *btcec.PublicKey) + func (s *SigCache) Exists(sigHash chainhash.Hash, sig *btcec.Signature, pubKey *btcec.PublicKey) bool + type SigHashType uint32 + const SigHashAll + const SigHashAnyOneCanPay + const SigHashNone + const SigHashOld + const SigHashSingle + type TxSigHashes struct + HashOutputs chainhash.Hash + HashPrevOuts chainhash.Hash + HashSequence chainhash.Hash + func NewTxSigHashes(tx *wire.MsgTx) *TxSigHashes