nom

package
v0.0.7-alphanet Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 14 Imported by: 11

Documentation

Overview

Package nom is a generated protocol buffer package.

It is generated from these files:

chain/nom/protobuf.proto

It has these top-level messages:

AccountBlockProto
MomentumProto

Index

Constants

View Source
const (
	BlockTypeGenesisReceive = 1 // receive

	BlockTypeUserSend    = 2 // send
	BlockTypeUserReceive = 3 // receive

	BlockTypeContractSend    = 4 // send
	BlockTypeContractReceive = 5 // receive
)
View Source
const AccountBlockHeaderRawLen = types.AddressSize + types.HashSize + 8 // (+8 from height)

Variables

This section is empty.

Functions

func AccountBlockHeaderComparer

func AccountBlockHeaderComparer(list []*types.AccountHeader) func(a, b int) bool

func DeProtoMomentumContent

func DeProtoMomentumContent(content []*types.AccountHeaderProto) []*types.AccountHeader

func IsReceiveBlock

func IsReceiveBlock(blockType uint64) bool

func IsSendBlock

func IsSendBlock(blockType uint64) bool

Types

type AccountBlock

type AccountBlock struct {
	Version         uint64 `json:"version"`
	ChainIdentifier uint64 `json:"chainIdentifier"`
	BlockType       uint64 `json:"blockType"`

	Hash                 types.Hash       `json:"hash"`
	PreviousHash         types.Hash       `json:"previousHash"`
	Height               uint64           `json:"height"`
	MomentumAcknowledged types.HashHeight `json:"momentumAcknowledged"`

	Address types.Address `json:"address"`

	// Send information
	ToAddress     types.Address            `json:"toAddress"`
	Amount        *big.Int                 `json:"amount"`
	TokenStandard types.ZenonTokenStandard `json:"tokenStandard"`

	// Receive information
	FromBlockHash types.Hash `json:"fromBlockHash"`

	// Batch information
	DescendantBlocks []*AccountBlock `json:"descendantBlocks"` // hash of DescendantBlocks is included in hash

	Data []byte `json:"data"` // hash of Data is included in hash

	FusedPlasma uint64 `json:"fusedPlasma"`
	Difficulty  uint64 `json:"difficulty"`
	Nonce       Nonce  `json:"nonce"`
	BasePlasma  uint64 `json:"basePlasma"` // not included in hash, the smallest value of TotalPlasma required for block
	TotalPlasma uint64 `json:"usedPlasma"` // not included in hash, TotalPlasma = FusedPlasma + PowPlasma

	ChangesHash types.Hash `json:"changesHash"` // not included in hash

	PublicKey ed25519.PublicKey `json:"publicKey"` // not included in hash
	Signature []byte            `json:"signature"` // not included in hash
	// contains filtered or unexported fields
}

func DeProtoAccountBlock

func DeProtoAccountBlock(pb *AccountBlockProto) *AccountBlock

func DeserializeAccountBlock

func DeserializeAccountBlock(data []byte) (*AccountBlock, error)

func (*AccountBlock) ComputeHash

func (ab *AccountBlock) ComputeHash() types.Hash

func (*AccountBlock) Copy

func (ab *AccountBlock) Copy() *AccountBlock

func (*AccountBlock) DescendantBlocksHash

func (ab *AccountBlock) DescendantBlocksHash() types.Hash

func (*AccountBlock) Header

func (ab *AccountBlock) Header() types.AccountHeader

func (*AccountBlock) Identifier

func (ab *AccountBlock) Identifier() types.HashHeight

func (*AccountBlock) IsReceiveBlock

func (ab *AccountBlock) IsReceiveBlock() bool

func (*AccountBlock) IsSendBlock

func (ab *AccountBlock) IsSendBlock() bool

func (*AccountBlock) MarshalJSON

func (ab *AccountBlock) MarshalJSON() ([]byte, error)

func (*AccountBlock) Previous

func (ab *AccountBlock) Previous() types.HashHeight

func (*AccountBlock) Producer

func (ab *AccountBlock) Producer() types.Address

func (*AccountBlock) Proto

func (ab *AccountBlock) Proto() *AccountBlockProto

func (*AccountBlock) Serialize

func (ab *AccountBlock) Serialize() ([]byte, error)

func (*AccountBlock) ToNomMarshalJson

func (ab *AccountBlock) ToNomMarshalJson() *AccountBlockMarshal

func (*AccountBlock) UnmarshalJSON

func (ab *AccountBlock) UnmarshalJSON(data []byte) error

type AccountBlockMarshal

type AccountBlockMarshal struct {
	Version         uint64 `json:"version"`
	ChainIdentifier uint64 `json:"chainIdentifier"`
	BlockType       uint64 `json:"blockType"`

	Hash                 types.Hash       `json:"hash"`
	PreviousHash         types.Hash       `json:"previousHash"`
	Height               uint64           `json:"height"`
	MomentumAcknowledged types.HashHeight `json:"momentumAcknowledged"`

	Address types.Address `json:"address"`

	// Send information
	ToAddress     types.Address            `json:"toAddress"`
	Amount        string                   `json:"amount"`
	TokenStandard types.ZenonTokenStandard `json:"tokenStandard"`

	// Receive information
	FromBlockHash types.Hash `json:"fromBlockHash"`

	// Batch information
	DescendantBlocks []*AccountBlock `json:"descendantBlocks"` // hash of DescendantBlocks is included in hash

	Data []byte `json:"data"` // hash of Data is included in hash

	FusedPlasma uint64 `json:"fusedPlasma"`
	Difficulty  uint64 `json:"difficulty"`
	Nonce       string `json:"nonce"`
	BasePlasma  uint64 `json:"basePlasma"` // not included in hash, the smallest value of TotalPlasma required for block
	TotalPlasma uint64 `json:"usedPlasma"` // not included in hash, TotalPlasma = FusedPlasma + PowPlasma

	ChangesHash types.Hash `json:"changesHash"` // not included in hash

	PublicKey ed25519.PublicKey `json:"publicKey"` // not included in hash
	Signature []byte            `json:"signature"` // not included in hash
	// contains filtered or unexported fields
}

func (*AccountBlockMarshal) FromNomMarshalJson

func (ab *AccountBlockMarshal) FromNomMarshalJson() *AccountBlock

type AccountBlockProto

type AccountBlockProto struct {
	Version              uint64                 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	ChainIdentifier      uint64                 `protobuf:"varint,2,opt,name=chainIdentifier" json:"chainIdentifier,omitempty"`
	BlockType            uint64                 `protobuf:"varint,3,opt,name=blockType" json:"blockType,omitempty"`
	Hash                 *types.HashProto       `protobuf:"bytes,4,opt,name=hash" json:"hash,omitempty"`
	PreviousHash         *types.HashProto       `protobuf:"bytes,5,opt,name=previousHash" json:"previousHash,omitempty"`
	Height               uint64                 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"`
	MomentumAcknowledged *types.HashHeightProto `protobuf:"bytes,7,opt,name=momentumAcknowledged" json:"momentumAcknowledged,omitempty"`
	Address              *types.AddressProto    `protobuf:"bytes,8,opt,name=address" json:"address,omitempty"`
	ToAddress            *types.AddressProto    `protobuf:"bytes,9,opt,name=toAddress" json:"toAddress,omitempty"`
	Amount               []byte                 `protobuf:"bytes,10,opt,name=amount,proto3" json:"amount,omitempty"`
	TokenStandard        []byte                 `protobuf:"bytes,11,opt,name=tokenStandard,proto3" json:"tokenStandard,omitempty"`
	FromBlockHash        *types.HashProto       `protobuf:"bytes,12,opt,name=fromBlockHash" json:"fromBlockHash,omitempty"`
	DescendantBlocks     []*AccountBlockProto   `protobuf:"bytes,13,rep,name=descendantBlocks" json:"descendantBlocks,omitempty"`
	Data                 []byte                 `protobuf:"bytes,14,opt,name=data,proto3" json:"data,omitempty"`
	FusedPlasma          uint64                 `protobuf:"varint,15,opt,name=fusedPlasma" json:"fusedPlasma,omitempty"`
	Difficulty           uint64                 `protobuf:"varint,17,opt,name=difficulty" json:"difficulty,omitempty"`
	Nonce                []byte                 `protobuf:"bytes,18,opt,name=nonce,proto3" json:"nonce,omitempty"`
	BasePlasma           uint64                 `protobuf:"varint,19,opt,name=basePlasma" json:"basePlasma,omitempty"`
	TotalPlasma          uint64                 `protobuf:"varint,20,opt,name=totalPlasma" json:"totalPlasma,omitempty"`
	ChangesHash          *types.HashProto       `protobuf:"bytes,21,opt,name=changesHash" json:"changesHash,omitempty"`
	PublicKey            []byte                 `protobuf:"bytes,22,opt,name=publicKey,proto3" json:"publicKey,omitempty"`
	Signature            []byte                 `protobuf:"bytes,23,opt,name=signature,proto3" json:"signature,omitempty"`
}

func (*AccountBlockProto) Descriptor

func (*AccountBlockProto) Descriptor() ([]byte, []int)

func (*AccountBlockProto) GetAddress

func (m *AccountBlockProto) GetAddress() *types.AddressProto

func (*AccountBlockProto) GetAmount

func (m *AccountBlockProto) GetAmount() []byte

func (*AccountBlockProto) GetBasePlasma

func (m *AccountBlockProto) GetBasePlasma() uint64

func (*AccountBlockProto) GetBlockType

func (m *AccountBlockProto) GetBlockType() uint64

func (*AccountBlockProto) GetChainIdentifier

func (m *AccountBlockProto) GetChainIdentifier() uint64

func (*AccountBlockProto) GetChangesHash

func (m *AccountBlockProto) GetChangesHash() *types.HashProto

func (*AccountBlockProto) GetData

func (m *AccountBlockProto) GetData() []byte

func (*AccountBlockProto) GetDescendantBlocks

func (m *AccountBlockProto) GetDescendantBlocks() []*AccountBlockProto

func (*AccountBlockProto) GetDifficulty

func (m *AccountBlockProto) GetDifficulty() uint64

func (*AccountBlockProto) GetFromBlockHash

func (m *AccountBlockProto) GetFromBlockHash() *types.HashProto

func (*AccountBlockProto) GetFusedPlasma

func (m *AccountBlockProto) GetFusedPlasma() uint64

func (*AccountBlockProto) GetHash

func (m *AccountBlockProto) GetHash() *types.HashProto

func (*AccountBlockProto) GetHeight

func (m *AccountBlockProto) GetHeight() uint64

func (*AccountBlockProto) GetMomentumAcknowledged

func (m *AccountBlockProto) GetMomentumAcknowledged() *types.HashHeightProto

func (*AccountBlockProto) GetNonce

func (m *AccountBlockProto) GetNonce() []byte

func (*AccountBlockProto) GetPreviousHash

func (m *AccountBlockProto) GetPreviousHash() *types.HashProto

func (*AccountBlockProto) GetPublicKey

func (m *AccountBlockProto) GetPublicKey() []byte

func (*AccountBlockProto) GetSignature

func (m *AccountBlockProto) GetSignature() []byte

func (*AccountBlockProto) GetToAddress

func (m *AccountBlockProto) GetToAddress() *types.AddressProto

func (*AccountBlockProto) GetTokenStandard

func (m *AccountBlockProto) GetTokenStandard() []byte

func (*AccountBlockProto) GetTotalPlasma

func (m *AccountBlockProto) GetTotalPlasma() uint64

func (*AccountBlockProto) GetVersion

func (m *AccountBlockProto) GetVersion() uint64

func (*AccountBlockProto) ProtoMessage

func (*AccountBlockProto) ProtoMessage()

func (*AccountBlockProto) Reset

func (m *AccountBlockProto) Reset()

func (*AccountBlockProto) String

func (m *AccountBlockProto) String() string

type AccountBlockTransaction

type AccountBlockTransaction struct {
	Block   *AccountBlock
	Changes db.Patch
}

func (*AccountBlockTransaction) GetCommits

func (t *AccountBlockTransaction) GetCommits() []db.Commit

func (*AccountBlockTransaction) StealChanges

func (t *AccountBlockTransaction) StealChanges() db.Patch

type DetailedMomentum

type DetailedMomentum struct {
	Momentum      *Momentum       `json:"momentum"`
	AccountBlocks []*AccountBlock `json:"accountBlocks"`
}

type Momentum

type Momentum struct {
	Version         uint64 `json:"version"`
	ChainIdentifier uint64 `json:"chainIdentifier"`

	Hash         types.Hash `json:"hash"`
	PreviousHash types.Hash `json:"previousHash"`
	Height       uint64     `json:"height"`

	TimestampUnix uint64     `json:"timestamp"` // hash item 3
	Timestamp     *time.Time `json:"-" rlp:"-"` // not included in hash, for caching purpose only

	Data    []byte          `json:"data"`    // hash of Data is included in hash
	Content MomentumContent `json:"content"` // hash of Content is included in hash

	ChangesHash types.Hash `json:"changesHash"`

	PublicKey ed25519.PublicKey `json:"publicKey"` // not included in hash
	Signature []byte            `json:"signature"` // not included in hash
	// contains filtered or unexported fields
}

func DeProtoMomentum

func DeProtoMomentum(pb *MomentumProto) *Momentum

func DeserializeMomentum

func DeserializeMomentum(data []byte) (*Momentum, error)

func (*Momentum) ComputeHash

func (m *Momentum) ComputeHash() types.Hash

func (*Momentum) EnsureCache

func (m *Momentum) EnsureCache()

func (*Momentum) Identifier

func (m *Momentum) Identifier() types.HashHeight

func (*Momentum) Previous

func (m *Momentum) Previous() types.HashHeight

func (*Momentum) Producer

func (m *Momentum) Producer() types.Address

func (*Momentum) Proto

func (m *Momentum) Proto() *MomentumProto

func (*Momentum) Serialize

func (m *Momentum) Serialize() ([]byte, error)

type MomentumContent

type MomentumContent []*types.AccountHeader

func NewMomentumContent

func NewMomentumContent(blocks []*AccountBlock) MomentumContent

func (*MomentumContent) Bytes

func (mc *MomentumContent) Bytes() []byte

func (*MomentumContent) Hash

func (mc *MomentumContent) Hash() types.Hash

func (*MomentumContent) Proto

func (mc *MomentumContent) Proto() []*types.AccountHeaderProto

type MomentumProto

type MomentumProto struct {
	Version         uint64                      `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	ChainIdentifier uint64                      `protobuf:"varint,2,opt,name=chainIdentifier" json:"chainIdentifier,omitempty"`
	Hash            *types.HashProto            `protobuf:"bytes,3,opt,name=hash" json:"hash,omitempty"`
	PreviousHash    *types.HashProto            `protobuf:"bytes,4,opt,name=previousHash" json:"previousHash,omitempty"`
	Height          uint64                      `protobuf:"varint,5,opt,name=height" json:"height,omitempty"`
	Timestamp       uint64                      `protobuf:"varint,6,opt,name=timestamp" json:"timestamp,omitempty"`
	Data            []byte                      `protobuf:"bytes,7,opt,name=data,proto3" json:"data,omitempty"`
	Content         []*types.AccountHeaderProto `protobuf:"bytes,8,rep,name=content" json:"content,omitempty"`
	ChangesHash     *types.HashProto            `protobuf:"bytes,9,opt,name=changesHash" json:"changesHash,omitempty"`
	PublicKey       []byte                      `protobuf:"bytes,10,opt,name=publicKey,proto3" json:"publicKey,omitempty"`
	Signature       []byte                      `protobuf:"bytes,11,opt,name=signature,proto3" json:"signature,omitempty"`
}

func (*MomentumProto) Descriptor

func (*MomentumProto) Descriptor() ([]byte, []int)

func (*MomentumProto) GetChainIdentifier

func (m *MomentumProto) GetChainIdentifier() uint64

func (*MomentumProto) GetChangesHash

func (m *MomentumProto) GetChangesHash() *types.HashProto

func (*MomentumProto) GetContent

func (m *MomentumProto) GetContent() []*types.AccountHeaderProto

func (*MomentumProto) GetData

func (m *MomentumProto) GetData() []byte

func (*MomentumProto) GetHash

func (m *MomentumProto) GetHash() *types.HashProto

func (*MomentumProto) GetHeight

func (m *MomentumProto) GetHeight() uint64

func (*MomentumProto) GetPreviousHash

func (m *MomentumProto) GetPreviousHash() *types.HashProto

func (*MomentumProto) GetPublicKey

func (m *MomentumProto) GetPublicKey() []byte

func (*MomentumProto) GetSignature

func (m *MomentumProto) GetSignature() []byte

func (*MomentumProto) GetTimestamp

func (m *MomentumProto) GetTimestamp() uint64

func (*MomentumProto) GetVersion

func (m *MomentumProto) GetVersion() uint64

func (*MomentumProto) ProtoMessage

func (*MomentumProto) ProtoMessage()

func (*MomentumProto) Reset

func (m *MomentumProto) Reset()

func (*MomentumProto) String

func (m *MomentumProto) String() string

type MomentumTransaction

type MomentumTransaction struct {
	Momentum *Momentum
	Changes  db.Patch
}

func (*MomentumTransaction) GetCommits

func (t *MomentumTransaction) GetCommits() []db.Commit

func (*MomentumTransaction) StealChanges

func (t *MomentumTransaction) StealChanges() db.Patch

type Nonce

type Nonce struct {
	Data [8]byte
}

func DeSerializeNonce

func DeSerializeNonce(bytes []byte) Nonce

func (*Nonce) Copy

func (n *Nonce) Copy() Nonce

func (*Nonce) MarshalText

func (n *Nonce) MarshalText() ([]byte, error)

func (*Nonce) Serialize

func (n *Nonce) Serialize() []byte

func (*Nonce) UnmarshalText

func (n *Nonce) UnmarshalText(input []byte) error

Jump to

Keyboard shortcuts

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