Documentation ¶
Index ¶
Constants ¶
const ( Op0 = iota OpData1 OpData2 OpData3 OpData20 = 0x14 OpData32 = 0x20 OpData64 = 0x40 )
Enumerate of opcodes
const ( OpIf = iota + 0x61 OpElse OpEndIf OpNope OpDup )
Enumerate of opcodes
const ( OpVerify = iota + 0xa0 OpEqualVerify OpScriptHashVerifyPop )
Verify
const ( OpHash160 = iota + 0xb0 OpCheckSig )
Hash
const ( OpCheckLockTime = iota + 0xc0 OpOtherSPVVerify )
External Call
const (
OpUnused = iota + 0xd0
)
Enumerate unused opcodes
Variables ¶
This section is empty.
Functions ¶
func PayToAddrScript ¶
PayToAddrScript creates a new script to pay a transaction output to a given address.
Types ¶
type ConstructFunc ¶
ConstructFunc takes an array of bytecodes to build an opnode. Note that: 1. The bytecodes must start with a valid opcode byte. 2. The bytecodes must be longer than required. 3. If it is insufficient to constructing an OpNode, e.g., data length not met, OpEndIf not found, error is thrown. 4. If an OpNode is successfully created, an int offset tells how many bytes it consumes.
type ErrorCode ¶
type ErrorCode int
ErrorCode identifies a kind of txvm error.
const ( // ErrInternal is returned if internal consistency checks fail. ErrInternal ErrorCode = iota // Errors emitted by builder // ErrUnsupportedOpcode ... ErrUnsupportedOpcode // ErrInvalidOpcode ... ErrInvalidOpcode // ErrInvalidOpdata ... ErrInvalidOpdata // Errors emitted by IVM // ErrEqualVerify... ErrEqualVerify // ErrInvalidStackOperation ... ErrInvalidStackOperation )
These constants are used to identify a specific Error.
type IAST ¶
type IAST struct {
// contains filtered or unexported fields
}
IAST is a Abstract Syntax Tree.
type IVM ¶
type IVM struct {
// contains filtered or unexported fields
}
IVM defines the struct of IoTeX Virtual Machine
type OpNode ¶
type OpNode struct {
// contains filtered or unexported fields
}
OpNode defines the struct of operation node
type ScriptBuilder ¶
type ScriptBuilder interface { // AddOp adds one opcode AddOp(op byte) error // AddOps adds several opcodes AddOps(op []byte) error // AddData adds data AddData(data []byte) error // Bytecodes returns byte codes built Bytecodes() []byte // Reset resets all internal states of the builder. Reset() error }
ScriptBuilder builds a script using opcodes
func NewScriptBuilder ¶
func NewScriptBuilder() ScriptBuilder
NewScriptBuilder creates an ScriptBuilder
type ScriptError ¶
ScriptError defines the struct of script error
func (ScriptError) Error ¶
func (e ScriptError) Error() string