types

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: LGPL-3.0 Imports: 9 Imported by: 4 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MAX_TX_SIZE = 1024 * 1024 // The max size of a transaction to prevent DOS attacks

Variables

This section is empty.

Functions

func AddressFromBookkeepers

func AddressFromBookkeepers(bookkeepers []keypair.PublicKey) (common.Address, error)

func AddressFromMultiPubKeys

func AddressFromMultiPubKeys(pubkeys []keypair.PublicKey, m int) (common.Address, error)

func AddressFromPubKey

func AddressFromPubKey(pubkey keypair.PublicKey) common.Address

func IsValidAttributeType

func IsValidAttributeType(usage TransactionAttributeUsage) bool

Types

type Block

type Block struct {
	Header       *Header
	Transactions []*Transaction
}

func BlockFromRawBytes

func BlockFromRawBytes(raw []byte) (*Block, error)

if no error, ownership of param raw is transfered to Transaction

func (*Block) Deserialization

func (self *Block) Deserialization(source *common.ZeroCopySource) error

func (*Block) Hash

func (b *Block) Hash() common.Uint256

func (*Block) RebuildMerkleRoot

func (b *Block) RebuildMerkleRoot()

func (*Block) Serialization

func (b *Block) Serialization(sink *common.ZeroCopySink)

func (*Block) ToArray

func (b *Block) ToArray() []byte

func (*Block) Type

func (b *Block) Type() common.InventoryType
type Header struct {
	Version          uint32
	PrevBlockHash    common.Uint256
	TransactionsRoot common.Uint256
	BlockRoot        common.Uint256
	Timestamp        uint32
	Height           uint32
	ConsensusData    uint64
	ConsensusPayload []byte
	NextBookkeeper   common.Address

	//Program *program.Program
	Bookkeepers []keypair.PublicKey
	SigData     [][]byte
	// contains filtered or unexported fields
}

func HeaderFromRawBytes

func HeaderFromRawBytes(raw []byte) (*Header, error)

func (*Header) Deserialization

func (bd *Header) Deserialization(source *common.ZeroCopySource) error

func (*Header) GetMessage

func (bd *Header) GetMessage() []byte

func (*Header) GetRawHeader

func (hd *Header) GetRawHeader() *RawHeader

func (*Header) Hash

func (bd *Header) Hash() common.Uint256

func (*Header) Serialization

func (bd *Header) Serialization(sink *common.ZeroCopySink)

func (*Header) ToArray

func (bd *Header) ToArray() []byte

type MutableTransaction

type MutableTransaction struct {
	Version  byte
	TxType   TransactionType
	Nonce    uint32
	GasPrice uint64
	GasLimit uint64
	Payer    common.Address
	Payload  Payload

	Sigs []Sig
	// contains filtered or unexported fields
}

func (*MutableTransaction) GetSignatureAddresses

func (self *MutableTransaction) GetSignatureAddresses() []common.Address

func (*MutableTransaction) Hash

func (self *MutableTransaction) Hash() common.Uint256

func (*MutableTransaction) IntoImmutable

func (self *MutableTransaction) IntoImmutable() (*Transaction, error)

output has no reference to self

type Payload

type Payload interface {
	//Serialize payload data
	Serialization(sink *common.ZeroCopySink)
	Deserialization(source *common.ZeroCopySource) error
}

Payload define the func for loading the payload data base on payload type which have different struture

type RawHeader

type RawHeader struct {
	Height  uint32
	Payload []byte
}

func (*RawHeader) Deserialization

func (self *RawHeader) Deserialization(source *common.ZeroCopySource) error

note: can only be called when source is trusted, like data from local ledger store

func (*RawHeader) Serialization

func (self *RawHeader) Serialization(sink *common.ZeroCopySink)

type RawSig

type RawSig struct {
	Invoke []byte
	Verify []byte
}

func (*RawSig) Deserialization

func (self *RawSig) Deserialization(source *common.ZeroCopySource) error

func (*RawSig) GetSig

func (self *RawSig) GetSig() (Sig, error)

func (*RawSig) Serialization

func (self *RawSig) Serialization(sink *common.ZeroCopySink) error

type Sig

type Sig struct {
	SigData [][]byte
	PubKeys []keypair.PublicKey
	M       uint16
}

func (*Sig) GetRawSig

func (self *Sig) GetRawSig() (*RawSig, error)

func (*Sig) Serialization

func (self *Sig) Serialization(sink *common.ZeroCopySink) error

type SmartCodeEvent

type SmartCodeEvent struct {
	TxHash common.Uint256
	Action string
	Result interface{}
	Error  int64
}

type Transaction

type Transaction struct {
	Version  byte
	TxType   TransactionType
	Nonce    uint32
	GasPrice uint64
	GasLimit uint64
	Payer    common.Address
	Payload  Payload

	Sigs []RawSig

	Raw []byte // raw transaction data

	SignedAddr []common.Address // this is assigned when passed signature verification
	// contains filtered or unexported fields
}

func TransactionFromRawBytes

func TransactionFromRawBytes(raw []byte) (*Transaction, error)

if no error, ownership of param raw is transfered to Transaction

func (*Transaction) Deserialization

func (tx *Transaction) Deserialization(source *common.ZeroCopySource) error

Transaction has internal reference of param `source`

func (*Transaction) GetSignatureAddresses

func (self *Transaction) GetSignatureAddresses() ([]common.Address, error)

func (*Transaction) Hash

func (tx *Transaction) Hash() common.Uint256

func (*Transaction) IntoMutable

func (tx *Transaction) IntoMutable() (*MutableTransaction, error)

note: ownership transfered to output

func (*Transaction) Serialization

func (tx *Transaction) Serialization(sink *common.ZeroCopySink)

func (*Transaction) ToArray

func (tx *Transaction) ToArray() []byte

func (*Transaction) Type

func (tx *Transaction) Type() common.InventoryType

func (*Transaction) Verify

func (tx *Transaction) Verify() error

type TransactionAttributeUsage

type TransactionAttributeUsage byte
const (
	Nonce          TransactionAttributeUsage = 0x00
	Script         TransactionAttributeUsage = 0x20
	DescriptionUrl TransactionAttributeUsage = 0x81
	Description    TransactionAttributeUsage = 0x90
)

type TransactionType

type TransactionType byte
const (
	Bookkeeper TransactionType = 0x02
	Deploy     TransactionType = 0xd0
	InvokeNeo  TransactionType = 0xd1
	InvokeWasm TransactionType = 0xd2 //add for wasm invoke
)

type TxAttribute

type TxAttribute struct {
	Usage TransactionAttributeUsage
	Data  []byte
	Size  uint32
}

func NewTxAttribute

func NewTxAttribute(u TransactionAttributeUsage, d []byte) TxAttribute

func (*TxAttribute) Deserialization

func (tx *TxAttribute) Deserialization(source *common.ZeroCopySource) error

func (*TxAttribute) GetSize

func (u *TxAttribute) GetSize() uint32

func (*TxAttribute) Serialization

func (tx *TxAttribute) Serialization(sink *common.ZeroCopySink) error

func (*TxAttribute) ToArray

func (tx *TxAttribute) ToArray() []byte

Jump to

Keyboard shortcuts

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