script

package
v0.0.0-...-79d14b3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2015 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	OP_0              = 0x00
	OP_LENGTH_1       = 0x01
	OP_LENGTH_MAX     = 0x4b
	OP_VERIFY         = 0x69
	OP_RETURN         = 0x6a
	OP_DUP            = 0x76
	OP_XOR            = 0x86
	OP_EQUAL          = 0x87
	OP_EQUALVERIFY    = 0x88
	OP_RIPEMD160      = 0xa6
	OP_HASH160        = 0xa9
	OP_CODESEPARATOR  = 0xab
	OP_CHECKSIG       = 0xac
	OP_CHECKSIGVERIFY = 0xad
)
View Source
const (
	StandardPayToPubKeyHash = 1
)

Variables

This section is empty.

Functions

func ArbitraryData

func ArbitraryData(data []byte) ([]byte, error)

func FuncOP_CHECKSIG

func FuncOP_CHECKSIG(s *Stack, data *Data) error

func FuncOP_CHECKSIGVERIFY

func FuncOP_CHECKSIGVERIFY(s *Stack, data *Data) error

func FuncOP_DUP

func FuncOP_DUP(s *Stack) error

func FuncOP_EQUAL

func FuncOP_EQUAL(s *Stack) error

func FuncOP_EQUALVERIFY

func FuncOP_EQUALVERIFY(s *Stack) error

func FuncOP_HASH160

func FuncOP_HASH160(s *Stack) error

func FuncOP_VERIFY

func FuncOP_VERIFY(s *Stack) error

func LastSplit

func LastSplit(script []byte, opCode byte) []byte

LastSplit splits the script on every occurance of opCode and returns the last part, not including the opCode.

func ParseScript

func ParseScript(script []byte) string

func ParseStandard

func ParseStandard(s []byte) []byte

ParseStandard parses standard payments scripts and returns true and the destination hash if the script is standard.

func PayToPubKeyHash

func PayToPubKeyHash(hash []byte) ([]byte, error)

func RIPEMD160Hash

func RIPEMD160Hash(data []byte) []byte

func SigScriptEncode

func SigScriptEncode(sig, pubKey []byte) []byte

func StripOpCode

func StripOpCode(script []byte, opCode byte) []byte

StripOpCode will remove all occurences of opCode from the the script.

Types

type Data

type Data struct {
	Hasher HashFunc
}

type HashFunc

type HashFunc func(hashType uint32) []byte

type Object

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

func ParseOneElement

func ParseOneElement(r *bytes.Buffer) (Object, error)

func ParseScriptObject

func ParseScriptObject(script []byte) []Object

func (Object) Data

func (o Object) Data() []byte

func (Object) String

func (o Object) String() string

func (Object) True

func (o Object) True() bool

type OpCode

type OpCode byte

func (OpCode) String

func (o OpCode) String() string

type Script

type Script struct {
	Type int
	Hash []byte
}

type Stack

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

func (*Stack) CheckSuccess

func (s *Stack) CheckSuccess() bool

func (*Stack) Execute

func (s *Stack) Execute(script []byte, data *Data) error

func (*Stack) Peek

func (s *Stack) Peek() (Object, error)

func (*Stack) Pop

func (s *Stack) Pop() (Object, error)

func (*Stack) PopData

func (s *Stack) PopData() ([]byte, error)

func (*Stack) Push

func (s *Stack) Push(o Object)

func (*Stack) PushBool

func (s *Stack) PushBool(b bool)

func (Stack) String

func (s Stack) String() string

Jump to

Keyboard shortcuts

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