program

package
v1.1.7-beta Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 7 Imported by: 7

Documentation

Index

Constants

View Source
const (
	Signature ProgramContextParameterType = 0
	CHECKSIG  byte                        = 0xAC
)

Variables

This section is empty.

Functions

func CreateProgramHash

func CreateProgramHash(pubKey []byte) (Uint160, error)

func CreateSignatureProgramCode

func CreateSignatureProgramCode(pubKey []byte) ([]byte, error)

CODE: len(publickey) + publickey + CHECKSIG

func GetPublicKeyFromCode

func GetPublicKeyFromCode(code []byte) ([]byte, error)

CODE: len(publickey) + publickey + CHECKSIG -------------------------------------------- Size: 1 32 1

func GetSignatureFromParameter

func GetSignatureFromParameter(parameter []byte) ([]byte, error)

Parameter: len(signature) + signature -------------------------------------------- Size: 1 64

func ProgramContextParameterTypeToByte

func ProgramContextParameterTypeToByte(c []ProgramContextParameterType) []byte

Types

type ProgramContext

type ProgramContext struct {

	//the program code,which will be run on VM or specific environment
	Code []byte

	//the ProgramContext Parameter type list
	// describe the number of program parameters and the parameter type
	Parameters []ProgramContextParameterType

	//The program hash as address
	ProgramHash Uint160

	//owner's pubkey hash indicate the owner of program
	OwnerPubkeyHash Uint160
}

func CreateSignatureProgramContext

func CreateSignatureProgramContext(ownerPubKey []byte) (*ProgramContext, error)

create a single signature program context for owner

func (*ProgramContext) Deserialize

func (c *ProgramContext) Deserialize(r io.Reader) error

func (*ProgramContext) NewProgram

func (c *ProgramContext) NewProgram(signature []byte) *pb.Program

Parameter: len(signature) + signature

func (*ProgramContext) Serialize

func (c *ProgramContext) Serialize(w io.Writer) error

func (*ProgramContext) ToArray

func (c *ProgramContext) ToArray() []byte

type ProgramContextParameterType

type ProgramContextParameterType byte

func ByteToProgramContextParameterType

func ByteToProgramContextParameterType(b []byte) []ProgramContextParameterType

Jump to

Keyboard shortcuts

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