contracts

package
v0.0.0-...-00d5616 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contract

type Contract struct {
	Version         uint16
	SenderPubKey    *ecdsa.PublicKey
	SigLen          uint8
	Signature       []byte
	RecipPubKeyHash []byte
	Value           uint64
	StateNonce      uint64
}

func ContractMessageFromInput

func ContractMessageFromInput(version uint16, value string, recipient string) (*Contract, error)

Convert value to uint64; if unsuccessful output an error If value is zero, output error GetBalance(), if value is > than wallet balance, output an error GetStateNonce(), GetPrivateKey() Convert recipient to []byte; if unsuccessful output an error MakeContract(...) (use version global), SignContract(...) Output a contract message, with the following structure: producer.SecretBytes + uint8(1) + serializedContract NOTE: The uint8(1) here will let the producer know that this is a contract message

func MakeContract

func MakeContract(version uint16, sender *ecdsa.PrivateKey, recipient []byte, value uint64, nextStateNonce uint64) (*Contract, error)

func (*Contract) Equals

func (contract1 *Contract) Equals(contract2 Contract) bool

compare two contracts and return true only if all fields match

func (*Contract) Serialize

func (c *Contract) Serialize() ([]byte, error)

// Serialize all fields of the contract

func (*Contract) SignContract

func (c *Contract) SignContract(sender *ecdsa.PrivateKey) error

Jump to

Keyboard shortcuts

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