program

package
v0.0.0-...-0c41aae Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func CreateProgramHash

func CreateProgramHash(pubkey *crypto.PubKey) (Uint160, error)

func CreateSignatureProgramCode

func CreateSignatureProgramCode(pubkey *crypto.PubKey) ([]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 *crypto.PubKey) (*ProgramContext, error)

create a Single Singature 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