script

package
v0.0.0-...-28401ee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidOpCode = errors.New("invalid OpCode")

Functions

func IsErrorCode

func IsErrorCode(err error, c ErrorCode) bool

IsErrorCode returns whether or not the provided error is a script error with the provided error code.

Types

type Error

type Error struct {
	ErrorCode   ErrorCode
	Description string
}

Error identifies a script-related error. It is used to indicate three classes of errors:

  1. Script execution failures due to violating one of the many requirements imposed by the script engine or evaluating to false
  2. Improper API usage by callers
  3. Internal consistency check failures

The caller can use type assertions on the returned errors to access the ErrorCode field to ascertain the specific reason for the error. As an additional convenience, the caller may make use of the IsErrorCode function to check for a specific error code.

func (Error) Error

func (e Error) Error() string

Error satisfies the error interface and prints human-readable errors.

type ErrorCode

type ErrorCode int

ErrorCode identifies a kind of script error.

const (
	// ErrInternal is returned if internal consistency checks fail.  In
	// practice this error should never be seen as it would mean there is an
	// error in the engine logic.
	ErrInternal ErrorCode = iota

	// ErrInvalidFlags is returned when the passed flags to NewEngine
	// contain an invalid combination.
	ErrInvalidFlags

	// ErrInvalidIndex is returned when an out-of-bounds index is passed to
	// a function.
	ErrInvalidIndex

	// ErrUnsupportedAddress is returned when a concrete type that
	// implements a btcutil.Address is not a supported type.
	ErrUnsupportedAddress

	// ErrNotMultisigScript is returned from CalcMultiSigStats when the
	// provided script is not a multisig script.
	ErrNotMultisigScript

	// ErrTooManyRequiredSigs is returned from MultiSigScript when the
	// specified number of required signatures is larger than the number of
	// provided public keys.
	ErrTooManyRequiredSigs

	// ErrTooMuchNullData is returned from NullDataScript when the length of
	// the provided data exceeds MaxDataCarrierSize.
	ErrTooMuchNullData

	// ErrEarlyReturn is returned when OP_RETURN is executed in the script.
	ErrEarlyReturn

	// ErrEmptyStack is returned when the script evaluated without error,
	// but terminated with an empty top stack element.
	ErrEmptyStack

	// ErrEvalFalse is returned when the script evaluated without error but
	// terminated with a false top stack element.
	ErrEvalFalse

	// ErrScriptUnfinished is returned when CheckErrorCondition is called on
	// a script that has not finished executing.
	ErrScriptUnfinished

	// ErrScriptDone is returned when an attempt to execute an opcode is
	// made once all of them have already been executed.  This can happen
	// due to things such as a second call to Execute or calling Step after
	// all opcodes have already been executed.
	ErrInvalidProgramCounter

	// ErrScriptTooBig is returned if a script is larger than MaxScriptSize.
	ErrScriptTooBig

	// ErrElementTooBig is returned if the size of an element to be pushed
	// to the stack is over MaxScriptElementSize.
	ErrElementTooBig

	// ErrTooManyOperations is returned if a script has more than
	// MaxOpsPerScript opcodes that do not push data.
	ErrTooManyOperations

	// ErrStackOverflow is returned when stack and altstack combined depth
	// is over the limit.
	ErrStackOverflow

	// ErrInvalidPubKeyCount is returned when the number of public keys
	// specified for a multsig is either negative or greater than
	// MaxPubKeysPerMultiSig.
	ErrInvalidPubKeyCount

	// ErrInvalidSignatureCount is returned when the number of signatures
	// specified for a multisig is either negative or greater than the
	// number of public keys.
	ErrInvalidSignatureCount

	// ErrNumberTooBig is returned when the argument for an opcode that
	// expects numeric input is larger than the expected maximum number of
	// bytes.  For the most part, opcodes that deal with stack manipulation
	// via offsets, arithmetic, numeric comparison, and boolean logic are
	// those that this applies to.  However, any opcode that expects numeric
	// input may fail with this code.
	ErrNumberTooBig

	// ErrVerify is returned when OP_VERIFY is encountered in a script and
	// the top item on the data stack does not evaluate to true.
	ErrVerify

	// ErrEqualVerify is returned when OP_EQUALVERIFY is encountered in a
	// script and the top item on the data stack does not evaluate to true.
	ErrEqualVerify

	// ErrNumEqualVerify is returned when OP_NUMEQUALVERIFY is encountered
	// in a script and the top item on the data stack does not evaluate to
	// true.
	ErrNumEqualVerify

	// ErrCheckSigVerify is returned when OP_CHECKSIGVERIFY is encountered
	// in a script and the top item on the data stack does not evaluate to
	// true.
	ErrCheckSigVerify

	// ErrCheckSigVerify is returned when OP_CHECKMULTISIGVERIFY is
	// encountered in a script and the top item on the data stack does not
	// evaluate to true.
	ErrCheckMultiSigVerify

	// ErrDisabledOpcode is returned when a disabled opcode is encountered
	// in a script.
	ErrDisabledOpcode

	// ErrReservedOpcode is returned when an opcode marked as reserved
	// is encountered in a script.
	ErrReservedOpcode

	// ErrMalformedPush is returned when a data push opcode tries to push
	// more bytes than are left in the script.
	ErrMalformedPush

	// ErrInvalidStackOperation is returned when a stack operation is
	// attempted with a number that is invalid for the current stack size.
	ErrInvalidStackOperation

	// ErrUnbalancedConditional is returned when an OP_ELSE or OP_ENDIF is
	// encountered in a script without first having an OP_IF or OP_NOTIF or
	// the end of script is reached without encountering an OP_ENDIF when
	// an OP_IF or OP_NOTIF was previously encountered.
	ErrUnbalancedConditional

	// ErrMinimalData is returned when the ScriptVerifyMinimalData flag
	// is set and the script contains push operations that do not use
	// the minimal opcode required.
	ErrMinimalData

	// ErrInvalidSigHashType is returned when a signature hash type is not
	// one of the supported types.
	ErrInvalidSigHashType

	// ErrSigTooShort is returned when a signature that should be a
	// canonically-encoded DER signature is too short.
	ErrSigTooShort

	// ErrSigTooLong is returned when a signature that should be a
	// canonically-encoded DER signature is too long.
	ErrSigTooLong

	// ErrSigInvalidSeqID is returned when a signature that should be a
	// canonically-encoded DER signature does not have the expected ASN.1
	// sequence ID.
	ErrSigInvalidSeqID

	// ErrSigInvalidDataLen is returned a signature that should be a
	// canonically-encoded DER signature does not specify the correct number
	// of remaining bytes for the R and S portions.
	ErrSigInvalidDataLen

	// ErrSigMissingSTypeID is returned a signature that should be a
	// canonically-encoded DER signature does not provide the ASN.1 type ID
	// for S.
	ErrSigMissingSTypeID

	// ErrSigMissingSLen is returned when a signature that should be a
	// canonically-encoded DER signature does not provide the length of S.
	ErrSigMissingSLen

	// ErrSigInvalidSLen is returned a signature that should be a
	// canonically-encoded DER signature does not specify the correct number
	// of bytes for the S portion.
	ErrSigInvalidSLen

	// ErrSigInvalidRIntID is returned when a signature that should be a
	// canonically-encoded DER signature does not have the expected ASN.1
	// integer ID for R.
	ErrSigInvalidRIntID

	// ErrSigZeroRLen is returned when a signature that should be a
	// canonically-encoded DER signature has an R length of zero.
	ErrSigZeroRLen

	// ErrSigNegativeR is returned when a signature that should be a
	// canonically-encoded DER signature has a negative value for R.
	ErrSigNegativeR

	// ErrSigTooMuchRPadding is returned when a signature that should be a
	// canonically-encoded DER signature has too much padding for R.
	ErrSigTooMuchRPadding

	// ErrSigInvalidSIntID is returned when a signature that should be a
	// canonically-encoded DER signature does not have the expected ASN.1
	// integer ID for S.
	ErrSigInvalidSIntID

	// ErrSigZeroSLen is returned when a signature that should be a
	// canonically-encoded DER signature has an S length of zero.
	ErrSigZeroSLen

	// ErrSigNegativeS is returned when a signature that should be a
	// canonically-encoded DER signature has a negative value for S.
	ErrSigNegativeS

	// ErrSigTooMuchSPadding is returned when a signature that should be a
	// canonically-encoded DER signature has too much padding for S.
	ErrSigTooMuchSPadding

	// ErrSigHighS is returned when the ScriptVerifyLowS flag is set and the
	// script contains any signatures whose S values are higher than the
	// half order.
	ErrSigHighS

	// ErrNotPushOnly is returned when a script that is required to only
	// push data to the stack performs other operations.  A couple of cases
	// where this applies is for a pay-to-script-hash signature script when
	// bip16 is active and when the ScriptVerifySigPushOnly flag is set.
	ErrNotPushOnly

	// ErrSigNullDummy is returned when the ScriptStrictMultiSig flag is set
	// and a multisig script has anything other than 0 for the extra dummy
	// argument.
	ErrSigNullDummy

	// ErrPubKeyType is returned when the ScriptVerifyStrictEncoding
	// flag is set and the script contains invalid public keys.
	ErrPubKeyType

	// ErrCleanStack is returned when the ScriptVerifyCleanStack flag
	// is set, and after evalution, the stack does not contain only a
	// single element.
	ErrCleanStack

	// ErrNullFail is returned when the ScriptVerifyNullFail flag is
	// set and signatures are not empty on failed checksig or checkmultisig
	// operations.
	ErrNullFail

	// ErrWitnessMalleated is returned if ScriptVerifyWitness is set and a
	// native p2wsh program is encountered which has a non-empty sigScript.
	ErrWitnessMalleated

	// ErrWitnessMalleatedP2SH is returned if ScriptVerifyWitness if set
	// and the validation logic for nested p2sh encounters a sigScript
	// which isn't *exactyl* a datapush of the witness program.
	ErrWitnessMalleatedP2SH

	// ErrDiscourageUpgradableNOPs is returned when the
	// ScriptDiscourageUpgradableNops flag is set and a NOP opcode is
	// encountered in a script.
	ErrDiscourageUpgradableNOPs

	// ErrNegativeLockTime is returned when a script contains an opcode that
	// interprets a negative lock time.
	ErrNegativeLockTime

	// ErrUnsatisfiedLockTime is returned when a script contains an opcode
	// that involves a lock time and the required lock time has not been
	// reached.
	ErrUnsatisfiedLockTime

	// ErrMinimalIf is returned if ScriptVerifyWitness is set and the
	// operand of an OP_IF/OP_NOF_IF are not either an empty vector or
	// [0x01].
	ErrMinimalIf

	// ErrDiscourageUpgradableWitnessProgram is returned if
	// ScriptVerifyWitness is set and the versino of an executing witness
	// program is outside the set of currently defined witness program
	// vesions.
	ErrDiscourageUpgradableWitnessProgram

	// ErrWitnessProgramEmpty is returned if ScriptVerifyWitness is set and
	// the witness stack itself is empty.
	ErrWitnessProgramEmpty

	// ErrWitnessProgramMismatch is returned if ScriptVerifyWitness is set
	// and the witness itself for a p2wkh witness program isn't *exactly* 2
	// items or if the witness for a p2wsh isn't the sha255 of the witness
	// script.
	ErrWitnessProgramMismatch

	// ErrWitnessProgramWrongLength is returned if ScriptVerifyWitness is
	// set and the length of the witness program violates the length as
	// dictated by the current witness version.
	ErrWitnessProgramWrongLength

	// ErrWitnessUnexpected is returned if ScriptVerifyWitness is set and a
	// transaction includes witness data but doesn't spend an which is a
	// witness program (nested or native).
	ErrWitnessUnexpected

	// ErrWitnessPubKeyType is returned if ScriptVerifyWitness is set and
	// the public key used in either a check-sig or check-multi-sig isn't
	// serialized in a compressed format.
	ErrWitnessPubKeyType
)

These constants are used to identify a specific Error.

func (ErrorCode) String

func (e ErrorCode) String() string

String returns the ErrorCode as a human-readable name.

type Interpreter

type Interpreter struct {
	// contains filtered or unexported fields
}

func NewInterpreter

func NewInterpreter(vm *VM, instructionSet [256]step) *Interpreter

func (*Interpreter) GetStackElementPool

func (i *Interpreter) GetStackElementPool() *stackElementPool

func (*Interpreter) Run

func (i *Interpreter) Run(code []byte, input []byte) ([]byte, error)

type OpCode

type OpCode byte

swagger:enum

const (
	OP_CODE__0                   OpCode = 0x00 // 0
	OP_CODE__FALSE               OpCode = 0x00 // 0 - AKA OP_0
	OP_CODE__DATA_1              OpCode = 0x01 // 1
	OP_CODE__DATA_2              OpCode = 0x02 // 2
	OP_CODE__DATA_3              OpCode = 0x03 // 3
	OP_CODE__DATA_4              OpCode = 0x04 // 4
	OP_CODE__DATA_5              OpCode = 0x05 // 5
	OP_CODE__DATA_6              OpCode = 0x06 // 6
	OP_CODE__DATA_7              OpCode = 0x07 // 7
	OP_CODE__DATA_8              OpCode = 0x08 // 8
	OP_CODE__DATA_9              OpCode = 0x09 // 9
	OP_CODE__DATA_10             OpCode = 0x0a // 10
	OP_CODE__DATA_11             OpCode = 0x0b // 11
	OP_CODE__DATA_12             OpCode = 0x0c // 12
	OP_CODE__DATA_13             OpCode = 0x0d // 13
	OP_CODE__DATA_14             OpCode = 0x0e // 14
	OP_CODE__DATA_15             OpCode = 0x0f // 15
	OP_CODE__DATA_16             OpCode = 0x10 // 16
	OP_CODE__DATA_17             OpCode = 0x11 // 17
	OP_CODE__DATA_18             OpCode = 0x12 // 18
	OP_CODE__DATA_19             OpCode = 0x13 // 19
	OP_CODE__DATA_20             OpCode = 0x14 // 20
	OP_CODE__DATA_21             OpCode = 0x15 // 21
	OP_CODE__DATA_22             OpCode = 0x16 // 22
	OP_CODE__DATA_23             OpCode = 0x17 // 23
	OP_CODE__DATA_24             OpCode = 0x18 // 24
	OP_CODE__DATA_25             OpCode = 0x19 // 25
	OP_CODE__DATA_26             OpCode = 0x1a // 26
	OP_CODE__DATA_27             OpCode = 0x1b // 27
	OP_CODE__DATA_28             OpCode = 0x1c // 28
	OP_CODE__DATA_29             OpCode = 0x1d // 29
	OP_CODE__DATA_30             OpCode = 0x1e // 30
	OP_CODE__DATA_31             OpCode = 0x1f // 31
	OP_CODE__DATA_32             OpCode = 0x20 // 32
	OP_CODE__DATA_33             OpCode = 0x21 // 33
	OP_CODE__DATA_34             OpCode = 0x22 // 34
	OP_CODE__DATA_35             OpCode = 0x23 // 35
	OP_CODE__DATA_36             OpCode = 0x24 // 36
	OP_CODE__DATA_37             OpCode = 0x25 // 37
	OP_CODE__DATA_38             OpCode = 0x26 // 38
	OP_CODE__DATA_39             OpCode = 0x27 // 39
	OP_CODE__DATA_40             OpCode = 0x28 // 40
	OP_CODE__DATA_41             OpCode = 0x29 // 41
	OP_CODE__DATA_42             OpCode = 0x2a // 42
	OP_CODE__DATA_43             OpCode = 0x2b // 43
	OP_CODE__DATA_44             OpCode = 0x2c // 44
	OP_CODE__DATA_45             OpCode = 0x2d // 45
	OP_CODE__DATA_46             OpCode = 0x2e // 46
	OP_CODE__DATA_47             OpCode = 0x2f // 47
	OP_CODE__DATA_48             OpCode = 0x30 // 48
	OP_CODE__DATA_49             OpCode = 0x31 // 49
	OP_CODE__DATA_50             OpCode = 0x32 // 50
	OP_CODE__DATA_51             OpCode = 0x33 // 51
	OP_CODE__DATA_52             OpCode = 0x34 // 52
	OP_CODE__DATA_53             OpCode = 0x35 // 53
	OP_CODE__DATA_54             OpCode = 0x36 // 54
	OP_CODE__DATA_55             OpCode = 0x37 // 55
	OP_CODE__DATA_56             OpCode = 0x38 // 56
	OP_CODE__DATA_57             OpCode = 0x39 // 57
	OP_CODE__DATA_58             OpCode = 0x3a // 58
	OP_CODE__DATA_59             OpCode = 0x3b // 59
	OP_CODE__DATA_60             OpCode = 0x3c // 60
	OP_CODE__DATA_61             OpCode = 0x3d // 61
	OP_CODE__DATA_62             OpCode = 0x3e // 62
	OP_CODE__DATA_63             OpCode = 0x3f // 63
	OP_CODE__DATA_64             OpCode = 0x40 // 64
	OP_CODE__DATA_65             OpCode = 0x41 // 65
	OP_CODE__DATA_66             OpCode = 0x42 // 66
	OP_CODE__DATA_67             OpCode = 0x43 // 67
	OP_CODE__DATA_68             OpCode = 0x44 // 68
	OP_CODE__DATA_69             OpCode = 0x45 // 69
	OP_CODE__DATA_70             OpCode = 0x46 // 70
	OP_CODE__DATA_71             OpCode = 0x47 // 71
	OP_CODE__DATA_72             OpCode = 0x48 // 72
	OP_CODE__DATA_73             OpCode = 0x49 // 73
	OP_CODE__DATA_74             OpCode = 0x4a // 74
	OP_CODE__DATA_75             OpCode = 0x4b // 75
	OP_CODE__PUSHDATA1           OpCode = 0x4c // 76
	OP_CODE__PUSHDATA2           OpCode = 0x4d // 77
	OP_CODE__PUSHDATA4           OpCode = 0x4e // 78
	OP_CODE__1NEGATE             OpCode = 0x4f // 79
	OP_CODE__RESERVED            OpCode = 0x50 // 80
	OP_CODE__1                   OpCode = 0x51 // 81 - AKA OP_TRUE
	OP_CODE__TRUE                OpCode = 0x51 // 81
	OP_CODE__2                   OpCode = 0x52 // 82
	OP_CODE__3                   OpCode = 0x53 // 83
	OP_CODE__4                   OpCode = 0x54 // 84
	OP_CODE__5                   OpCode = 0x55 // 85
	OP_CODE__6                   OpCode = 0x56 // 86
	OP_CODE__7                   OpCode = 0x57 // 87
	OP_CODE__8                   OpCode = 0x58 // 88
	OP_CODE__9                   OpCode = 0x59 // 89
	OP_CODE__10                  OpCode = 0x5a // 90
	OP_CODE__11                  OpCode = 0x5b // 91
	OP_CODE__12                  OpCode = 0x5c // 92
	OP_CODE__13                  OpCode = 0x5d // 93
	OP_CODE__14                  OpCode = 0x5e // 94
	OP_CODE__15                  OpCode = 0x5f // 95
	OP_CODE__16                  OpCode = 0x60 // 96
	OP_CODE__NOP                 OpCode = 0x61 // 97
	OP_CODE__VER                 OpCode = 0x62 // 98
	OP_CODE__IF                  OpCode = 0x63 // 99
	OP_CODE__NOTIF               OpCode = 0x64 // 100
	OP_CODE__VERIF               OpCode = 0x65 // 101
	OP_CODE__VERNOTIF            OpCode = 0x66 // 102
	OP_CODE__ELSE                OpCode = 0x67 // 103
	OP_CODE__ENDIF               OpCode = 0x68 // 104
	OP_CODE__VERIFY              OpCode = 0x69 // 105
	OP_CODE__RETURN              OpCode = 0x6a // 106
	OP_CODE__TOALTSTACK          OpCode = 0x6b // 107
	OP_CODE__FROMALTSTACK        OpCode = 0x6c // 108
	OP_CODE__2DROP               OpCode = 0x6d // 109
	OP_CODE__2DUP                OpCode = 0x6e // 110
	OP_CODE__3DUP                OpCode = 0x6f // 111
	OP_CODE__2OVER               OpCode = 0x70 // 112
	OP_CODE__2ROT                OpCode = 0x71 // 113
	OP_CODE__2SWAP               OpCode = 0x72 // 114
	OP_CODE__IFDUP               OpCode = 0x73 // 115
	OP_CODE__DEPTH               OpCode = 0x74 // 116
	OP_CODE__DROP                OpCode = 0x75 // 117
	OP_CODE__DUP                 OpCode = 0x76 // 118
	OP_CODE__NIP                 OpCode = 0x77 // 119
	OP_CODE__OVER                OpCode = 0x78 // 120
	OP_CODE__PICK                OpCode = 0x79 // 121
	OP_CODE__ROLL                OpCode = 0x7a // 122
	OP_CODE__ROT                 OpCode = 0x7b // 123
	OP_CODE__SWAP                OpCode = 0x7c // 124
	OP_CODE__TUCK                OpCode = 0x7d // 125
	OP_CODE__CAT                 OpCode = 0x7e // 126
	OP_CODE__SUBSTR              OpCode = 0x7f // 127
	OP_CODE__LEFT                OpCode = 0x80 // 128
	OP_CODE__RIGHT               OpCode = 0x81 // 129
	OP_CODE__SIZE                OpCode = 0x82 // 130
	OP_CODE__INVERT              OpCode = 0x83 // 131
	OP_CODE__AND                 OpCode = 0x84 // 132
	OP_CODE__OR                  OpCode = 0x85 // 133
	OP_CODE__XOR                 OpCode = 0x86 // 134
	OP_CODE__EQUAL               OpCode = 0x87 // 135
	OP_CODE__EQUALVERIFY         OpCode = 0x88 // 136
	OP_CODE__RESERVED1           OpCode = 0x89 // 137
	OP_CODE__RESERVED2           OpCode = 0x8a // 138
	OP_CODE__1ADD                OpCode = 0x8b // 139
	OP_CODE__1SUB                OpCode = 0x8c // 140
	OP_CODE__2MUL                OpCode = 0x8d // 141
	OP_CODE__2DIV                OpCode = 0x8e // 142
	OP_CODE__NEGATE              OpCode = 0x8f // 143
	OP_CODE__ABS                 OpCode = 0x90 // 144
	OP_CODE__NOT                 OpCode = 0x91 // 145
	OP_CODE__0NOTEQUAL           OpCode = 0x92 // 146
	OP_CODE__ADD                 OpCode = 0x93 // 147
	OP_CODE__SUB                 OpCode = 0x94 // 148
	OP_CODE__MUL                 OpCode = 0x95 // 149
	OP_CODE__DIV                 OpCode = 0x96 // 150
	OP_CODE__MOD                 OpCode = 0x97 // 151
	OP_CODE__LSHIFT              OpCode = 0x98 // 152
	OP_CODE__RSHIFT              OpCode = 0x99 // 153
	OP_CODE__BOOLAND             OpCode = 0x9a // 154
	OP_CODE__BOOLOR              OpCode = 0x9b // 155
	OP_CODE__NUMEQUAL            OpCode = 0x9c // 156
	OP_CODE__NUMEQUALVERIFY      OpCode = 0x9d // 157
	OP_CODE__NUMNOTEQUAL         OpCode = 0x9e // 158
	OP_CODE__LESSTHAN            OpCode = 0x9f // 159
	OP_CODE__GREATERTHAN         OpCode = 0xa0 // 160
	OP_CODE__LESSTHANOREQUAL     OpCode = 0xa1 // 161
	OP_CODE__GREATERTHANOREQUAL  OpCode = 0xa2 // 162
	OP_CODE__MIN                 OpCode = 0xa3 // 163
	OP_CODE__MAX                 OpCode = 0xa4 // 164
	OP_CODE__WITHIN              OpCode = 0xa5 // 165
	OP_CODE__RIPEMD160           OpCode = 0xa6 // 166
	OP_CODE__SHA1                OpCode = 0xa7 // 167
	OP_CODE__SHA256              OpCode = 0xa8 // 168
	OP_CODE__HASH160             OpCode = 0xa9 // 169
	OP_CODE__HASH256             OpCode = 0xaa // 170
	OP_CODE__CODESEPARATOR       OpCode = 0xab // 171
	OP_CODE__CHECKSIG            OpCode = 0xac // 172
	OP_CODE__CHECKSIGVERIFY      OpCode = 0xad // 173
	OP_CODE__CHECKMULTISIG       OpCode = 0xae // 174
	OP_CODE__CHECKMULTISIGVERIFY OpCode = 0xaf // 175
	OP_CODE__NOP1                OpCode = 0xb0 // 176
	OP_CODE__NOP2                OpCode = 0xb1 // 177
	OP_CODE__CHECKLOCKTIMEVERIFY OpCode = 0xb1 // 177 - AKA OP_NOP2
	OP_CODE__NOP3                OpCode = 0xb2 // 178
	OP_CODE__CHECKSEQUENCEVERIFY OpCode = 0xb2 // 178 - AKA OP_NOP3
	OP_CODE__NOP4                OpCode = 0xb3 // 179
	OP_CODE__NOP5                OpCode = 0xb4 // 180
	OP_CODE__NOP6                OpCode = 0xb5 // 181
	OP_CODE__NOP7                OpCode = 0xb6 // 182
	OP_CODE__NOP8                OpCode = 0xb7 // 183
	OP_CODE__NOP9                OpCode = 0xb8 // 184
	OP_CODE__NOP10               OpCode = 0xb9 // 185
	OP_CODE__UNKNOWN186          OpCode = 0xba // 186
	OP_CODE__UNKNOWN187          OpCode = 0xbb // 187
	OP_CODE__UNKNOWN188          OpCode = 0xbc // 188
	OP_CODE__UNKNOWN189          OpCode = 0xbd // 189
	OP_CODE__UNKNOWN190          OpCode = 0xbe // 190
	OP_CODE__UNKNOWN191          OpCode = 0xbf // 191
	OP_CODE__UNKNOWN192          OpCode = 0xc0 // 192
	OP_CODE__UNKNOWN193          OpCode = 0xc1 // 193
	OP_CODE__UNKNOWN194          OpCode = 0xc2 // 194
	OP_CODE__UNKNOWN195          OpCode = 0xc3 // 195
	OP_CODE__UNKNOWN196          OpCode = 0xc4 // 196
	OP_CODE__UNKNOWN197          OpCode = 0xc5 // 197
	OP_CODE__UNKNOWN198          OpCode = 0xc6 // 198
	OP_CODE__UNKNOWN199          OpCode = 0xc7 // 199
	OP_CODE__UNKNOWN200          OpCode = 0xc8 // 200
	OP_CODE__UNKNOWN201          OpCode = 0xc9 // 201
	OP_CODE__UNKNOWN202          OpCode = 0xca // 202
	OP_CODE__UNKNOWN203          OpCode = 0xcb // 203
	OP_CODE__UNKNOWN204          OpCode = 0xcc // 204
	OP_CODE__UNKNOWN205          OpCode = 0xcd // 205
	OP_CODE__UNKNOWN206          OpCode = 0xce // 206
	OP_CODE__UNKNOWN207          OpCode = 0xcf // 207
	OP_CODE__UNKNOWN208          OpCode = 0xd0 // 208
	OP_CODE__UNKNOWN209          OpCode = 0xd1 // 209
	OP_CODE__UNKNOWN210          OpCode = 0xd2 // 210
	OP_CODE__UNKNOWN211          OpCode = 0xd3 // 211
	OP_CODE__UNKNOWN212          OpCode = 0xd4 // 212
	OP_CODE__UNKNOWN213          OpCode = 0xd5 // 213
	OP_CODE__UNKNOWN214          OpCode = 0xd6 // 214
	OP_CODE__UNKNOWN215          OpCode = 0xd7 // 215
	OP_CODE__UNKNOWN216          OpCode = 0xd8 // 216
	OP_CODE__UNKNOWN217          OpCode = 0xd9 // 217
	OP_CODE__UNKNOWN218          OpCode = 0xda // 218
	OP_CODE__UNKNOWN219          OpCode = 0xdb // 219
	OP_CODE__UNKNOWN220          OpCode = 0xdc // 220
	OP_CODE__UNKNOWN221          OpCode = 0xdd // 221
	OP_CODE__UNKNOWN222          OpCode = 0xde // 222
	OP_CODE__UNKNOWN223          OpCode = 0xdf // 223
	OP_CODE__UNKNOWN224          OpCode = 0xe0 // 224
	OP_CODE__UNKNOWN225          OpCode = 0xe1 // 225
	OP_CODE__UNKNOWN226          OpCode = 0xe2 // 226
	OP_CODE__UNKNOWN227          OpCode = 0xe3 // 227
	OP_CODE__UNKNOWN228          OpCode = 0xe4 // 228
	OP_CODE__UNKNOWN229          OpCode = 0xe5 // 229
	OP_CODE__UNKNOWN230          OpCode = 0xe6 // 230
	OP_CODE__UNKNOWN231          OpCode = 0xe7 // 231
	OP_CODE__UNKNOWN232          OpCode = 0xe8 // 232
	OP_CODE__UNKNOWN233          OpCode = 0xe9 // 233
	OP_CODE__UNKNOWN234          OpCode = 0xea // 234
	OP_CODE__UNKNOWN235          OpCode = 0xeb // 235
	OP_CODE__UNKNOWN236          OpCode = 0xec // 236
	OP_CODE__UNKNOWN237          OpCode = 0xed // 237
	OP_CODE__UNKNOWN238          OpCode = 0xee // 238
	OP_CODE__UNKNOWN239          OpCode = 0xef // 239
	OP_CODE__UNKNOWN240          OpCode = 0xf0 // 240
	OP_CODE__UNKNOWN241          OpCode = 0xf1 // 241
	OP_CODE__UNKNOWN242          OpCode = 0xf2 // 242
	OP_CODE__UNKNOWN243          OpCode = 0xf3 // 243
	OP_CODE__UNKNOWN244          OpCode = 0xf4 // 244
	OP_CODE__UNKNOWN245          OpCode = 0xf5 // 245
	OP_CODE__UNKNOWN246          OpCode = 0xf6 // 246
	OP_CODE__UNKNOWN247          OpCode = 0xf7 // 247
	OP_CODE__UNKNOWN248          OpCode = 0xf8 // 248
	OP_CODE__UNKNOWN249          OpCode = 0xf9 // 249
	OP_CODE__SMALLINTEGER        OpCode = 0xfa // 250 - bitcoin core internal
	OP_CODE__PUBKEYS             OpCode = 0xfb // 251 - bitcoin core internal
	OP_CODE__UNKNOWN252          OpCode = 0xfc // 252
	OP_CODE__PUBKEYHASH          OpCode = 0xfd // 253 - bitcoin core internal
	OP_CODE__PUBKEY              OpCode = 0xfe // 254 - bitcoin core internal
	OP_CODE__INVALIDOPCODE       OpCode = 0xff // 255 - bitcoin core internal
)

func ParseOpCodeFromLabelString

func ParseOpCodeFromLabelString(s string) (OpCode, error)

func ParseOpCodeFromString

func ParseOpCodeFromString(s string) (OpCode, error)

func (OpCode) Label

func (v OpCode) Label() string

func (OpCode) MarshalText

func (v OpCode) MarshalText() ([]byte, error)

func (OpCode) String

func (v OpCode) String() string

func (*OpCode) UnmarshalText

func (v *OpCode) UnmarshalText(data []byte) (err error)

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

Stack is an object for basic stack operations. Items popped to the stack are expected to be changed and modified. stack does not take care of adding newly initialised objects.

func (*Stack) Back

func (st *Stack) Back(n int) *big.Int

Back returns the n'th item in stack

func (*Stack) Data

func (st *Stack) Data() []*big.Int

Data returns the underlying big.Int array.

func (*Stack) Print

func (st *Stack) Print()

Print dumps the content of the stack

type VM

type VM struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL