program

package
v2.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func CreateProgramHash

func CreateProgramHash(pubKey []byte) (common.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 common.Uint160

	//owner's pubkey hash indicate the owner of program
	OwnerPubkeyHash common.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