core

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Overview

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Copyright (C) 2021 Zilliqa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const ScillaIndexSeparator = 0x16

Variables

View Source
var PendingTxnError = map[int]string{
	0:  "Txn was already processed and confirmed",
	1:  "Pending - nonce too high",
	2:  "Pending - blk gas limit exceeded",
	3:  "Pending - consensus failure",
	4:  "Error - txn not found",
	10: "Dropped - math error",
	11: "Dropped - scilla invocation error",
	12: "Dropped - account init error",
	13: "Dropped - invalid source account",
	14: "Dropped - gas limit too high",
	15: "Dropped - txn type unknown",
	16: "Dropped - txn in wrong shard",
	17: "Dropped - account in wrong shard",
	18: "Dropped - code size too large",
	19: "Dropped - txn verification error",
	20: "Dropped - gas limit too low",
	21: "Dropped - insuff balance",
	22: "Dropped - insuff gas for checker",
	23: "Dropped - duplicate txn found",
	24: "Dropped - txn w/ higher gas found",
	25: "Dropped - invalid dest account",
	26: "Dropped - state addition error",
}

Functions

func ByteArrayToUint

func ByteArrayToUint(src []byte, offset uint, numericTypeLen uint) *big.Int

extract a number from the source byte stream at the specific offset. Uint128 -> 16 (bytes) Uint64 -> 8 (bytes) Uint32 -> 4 (bytes)

func GenerateStorageKey

func GenerateStorageKey(addr, vname string, indices []string) []byte

func IP2Long

func IP2Long(ip string) uint32

func SkipIfCI

func SkipIfCI(t *testing.T)

func UintToByteArray

func UintToByteArray(dst []byte, offset uint, num *big.Int, numericTypeLen uint) []byte

place a number into the destination byte stream at the specified offset caller should make sure that the value of numericTypeLen following rules Uint128 -> 16 (bytes) Uint64 -> 8 (bytes) Uint32 -> 4 (bytes)

Types

type AccountBase

type AccountBase struct {
	Version     uint32
	Balance     uint64
	Nonce       uint64
	StorageRoot []byte
	CodeHash    []byte
}

func AccountBaseFromBytes

func AccountBaseFromBytes(bytes []byte) (*AccountBase, error)

type BIGNumSerialize

type BIGNumSerialize struct{}

func (*BIGNumSerialize) SetNumber

func (bn *BIGNumSerialize) SetNumber(dst []byte, offset uint, size uint, value *big.Int) []byte

type BalanceAndNonce

type BalanceAndNonce struct {
	Balance string `json:"balance"`
	Nonce   int64  `json:"nonce"`
}

type BitVector

type BitVector struct{}

func (*BitVector) GetBitVectorLengthInBytes

func (b *BitVector) GetBitVectorLengthInBytes(lengthInBits uint) uint

func (*BitVector) GetBitVectorSerializedSize

func (b *BitVector) GetBitVectorSerializedSize(lengthInBits uint) uint

func (*BitVector) SetBitVector

func (b *BitVector) SetBitVector(dst []byte, offset uint, value []bool) []byte

type BlockBase

type BlockBase struct {
	BlockHash [32]byte
	Cosigs    CoSignatures
	Timestamp uint64
}

func (*BlockBase) ToProtobuf

func (b *BlockBase) ToProtobuf() *protobuf.ProtoBlockBase

type BlockHeaderBase

type BlockHeaderBase struct {
	Version uint32
	// Hash for the committee that generated the block
	CommitteeHash [32]byte
	PrevHash      [32]byte
}

func (*BlockHeaderBase) ToProtobuf

type BlockList

type BlockList struct {
	Data     []HashAndNum `json:"data"`
	MaxPages int          `json:"maxPages"`
}

type BlockchainInfo

type BlockchainInfo struct {
	CurrentDSEpoch    string
	CurrentMiniEpoch  string
	DSBlockRate       float64
	NumDSBlocks       string
	NumPeers          int
	NumTransactions   string
	NumTxBlocks       string
	NumTxnsDSEpoch    string
	NumTxnsTxEpoch    string
	ShardingStructure ShardingStructure
	TransactionRate   float64
	TxBlockRate       float64
}

type CoSignatures

type CoSignatures struct {
	CS1 *Signature
	B1  []bool
	CS2 *Signature
	B2  []bool
}

type ContractValue

type ContractValue struct {
	VName string      `json:"vname"`
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

type DSBlock

type DSBlock struct {
	Header    DsHeader `json:"header"`
	Signature string   `json:"signature"`
}

type DSBlockHashSet

type DSBlockHashSet struct {
	// should be 32 bytes
	ShardingHash  []byte
	ReservedField [128]byte
}

type DSComm

type DSComm struct {
	CurrentDSEpoch string
	CurrentTxEpoch string
	NumOfDSGuard   int
	DSComm         []string `json:"dscomm"`
}

type DsBlock

type DsBlock struct {
	BlockBase
	BlockHeader *DsBlockHeader
	PrevDSHash  string
}

func NewDsBlockFromDsBlockT

func NewDsBlockFromDsBlockT(dst *DsBlockT) *DsBlock

func (*DsBlock) GetRandS

func (dst *DsBlock) GetRandS() ([]byte, []byte)

func (*DsBlock) Serialize

func (dst *DsBlock) Serialize() []byte

func (*DsBlock) ToProtobuf

func (dst *DsBlock) ToProtobuf() []byte

type DsBlockHeader

type DsBlockHeader struct {
	BlockHeaderBase BlockHeaderBase
	DsDifficulty    uint32
	Difficulty      uint32
	// The one who proposed this DS block
	// base16 string
	LeaderPubKey string
	// Block index, starting from 0 in the genesis block
	BlockNum uint64
	// Tx Epoch Num then the DS block was generated
	EpochNum         uint64
	GasPrice         string
	SwInfo           SWInfo
	PowDSWinnersList []string
	// key is (base16) public key
	PoWDSWinners map[string]Peer
	// (base16) public key
	RemoveDSNodePubKeys []string
	// todo concrete data type
	DSBlockHashSet DSBlockHashSet

	ProposalIds        []uint32
	GovDSShardVotesMap map[uint32]Pair
}

https://github.com/Zilliqa/Zilliqa/blob/04162ef0c3c1787ebbd940b7abd6b7ff1d4714ed/src/libData/BlockData/BlockHeader/DSBlockHeader.h

func NewDsBlockHeaderFromDsBlockT

func NewDsBlockHeaderFromDsBlockT(dst *DsBlockT) *DsBlockHeader

func (*DsBlockHeader) Serialize

func (d *DsBlockHeader) Serialize() []byte

func (*DsBlockHeader) ToProtobuf

func (d *DsBlockHeader) ToProtobuf(concreteVarsOnly bool) *protobuf.ProtoDSBlock_DSBlockHeader

the default value of concreteVarsOnly should be false

type DsBlockHeaderT

type DsBlockHeaderT struct {
	BlockNum       string
	CommitteeHash  string
	Difficulty     uint32
	DifficultyDS   uint32
	EpochNum       string
	GasPrice       string
	LeaderPubKey   string
	MembersEjected []string
	PoWWinners     []string
	PoWWinnersIP   []IPAndPort
	PrevHash       string
	ReservedField  string
	SWInfo         *SWInfoT
	ShardingHash   string
	Governance     []GovernanceElementT
	Timestamp      string
	Version        uint32
}

type DsBlockT

type DsBlockT struct {
	B1         []bool         `json:"B1"`
	B2         []bool         `json:"B2"`
	CS1        string         `json:"CS1"`
	PrevDSHash string         `json:"PrevDSHash"`
	Header     DsBlockHeaderT `json:"header"`
	Serialized SerializedT    `json:"serialized"`
	Signatures string         `json:"signature"`
}

ds block transfer struct (via rpc)

type DsHeader

type DsHeader struct {
	BlockNum     string
	Difficulty   int
	DifficultyDS int
	GasPrice     string
	LeaderPubKey string
	PoWWinners   []interface{}
	PrevHash     string
	Timestamp    string
}

type ECPointSerialize

type ECPointSerialize struct {
	BIGNumSerialize
}

func (*ECPointSerialize) SetNumber

func (ec *ECPointSerialize) SetNumber(dst []byte, offset uint, size uint, x, y *big.Int)

x and y represent the point on the curve

type EventLog

type EventLog struct {
	EventName string          `json:"_eventname"`
	Address   string          `json:"address"`
	Params    []ContractValue `json:"params"`
}

type GovernanceElementT

type GovernanceElementT struct {
	DSVotes    []VoteT
	ShardVotes []VoteT
	ProposalId uint32
}

type HashAndNum

type HashAndNum struct {
	BlockNum int64
	Hash     string
}

type IPAndPort

type IPAndPort struct {
	IP   string `json:"IP"`
	Port uint32 `json:"port"`
}

type MicroBlockInfo

type MicroBlockInfo struct {
	MicroBlockHash        string
	MicroBlockShardId     int
	MicroBlockTxnRootHash string
}

type MinerInfo

type MinerInfo struct {
	DsCommittee []string    `json:"dscommittee"`
	Shards      []ShardInfo `json:"shards"`
}

type MinerInfoDSComm

type MinerInfoDSComm struct {
	// inner type is string
	DSNodes        *list.List
	DSNodesEjected []string
}

type Pair

type Pair struct {
	FirstList  []uint32
	First      map[uint32]uint32
	SecondList []uint32
	Second     map[uint32]uint32
}

type PairOfNode

type PairOfNode struct {
	PubKey string
	Peer
}

type ParamConstructor

type ParamConstructor struct {
	Constructor string        `json:"constructor"`
	ArgTypes    []interface{} `json:"argtypes"`
	Arguments   []interface{} `json:"arguments"`
}

type Peer

type Peer struct {
	// Peer IP address (net-encoded)
	// size is 128bits (16 bytes)
	IpAddress *big.Int
	// Peer listen port (host-encoded)
	ListenPortHost uint32
	HostName       string
}

func (*Peer) Serialize

func (p *Peer) Serialize() []byte

type PendingStatus

type PendingStatus struct {
	Code    int    `json:"code"`
	TxnHash string `json:"TxnHash"`
	Info    string
}

type PendingTxnResult

type PendingTxnResult struct {
	Code      int  `json:"code"`
	Confirmed bool `json:"confirmed"`
	Info      string
}

type PendingTxns

type PendingTxns struct {
	Txns []*PendingStatus
}

type SWInfo

type SWInfo struct {
	ZilliqaMajorVersion uint32
	ZilliqaMinorVersion uint32
	ZilliqaFixVersion   uint32
	ZilliqaUpgradeDS    uint64
	ZilliqaCommit       uint32
	ScillaMajorVersion  uint32
	ScillaMinorVersion  uint32
	ScillaFixVersion    uint32
	ScillaUpgradeDS     uint64
	ScillaCommit        uint32
}

func (*SWInfo) Serialize

func (sw *SWInfo) Serialize() []byte

type SWInfoT

type SWInfoT struct {
	Scilla  []interface{}
	Zilliqa []interface{}
}

type SerializedT

type SerializedT struct {
	Data   string `json:"data"`
	Header string `json:"header"`
}

type ShardInfo

type ShardInfo struct {
	Nodes []string `json:"nodes"`
	Size  int      `json:"size"`
}

type ShardingStructure

type ShardingStructure struct {
	NumPeers []int
}

type Signature

type Signature struct {
	R *big.Int
	S *big.Int
}

func NewFromByteArray

func NewFromByteArray(bytes []byte) *Signature

func (*Signature) Serialize

func (s *Signature) Serialize(data []byte, offset uint) []byte

type State

type State int
const (
	Initialised State = iota
	Pending
	Confirmed
	Rejected
)

type StateProof

type StateProof struct {
	AccountProof []string `json:"accountProof"`
	StateProof   []string `json:"stateProof"`
}

type Transaction

type Transaction struct {
	ID              string
	Version         string
	Nonce           string
	Amount          string
	GasPrice        string
	GasLimit        string
	Signature       string
	Receipt         TransactionReceipt
	SenderPubKey    string
	ToAddr          string
	Code            string
	Data            interface{}
	Status          State
	ContractAddress string
	Priority        bool
}

type TransactionException

type TransactionException struct {
	Line    int    `json:"line"`
	Message string `json:"message"`
}

type TransactionMessage

type TransactionMessage struct {
	Amount    string          `json:"_amount"`
	Recipient string          `json:"_recipient"`
	Tag       string          `json:"_tag"`
	Params    []ContractValue `json:"params"`
}

type TransactionReceipt

type TransactionReceipt struct {
	Accept        bool                   `json:"accept"`
	Errors        interface{}            `json:"errors"`
	Exceptions    []TransactionException `json:"exceptions"`
	Success       bool                   `json:"success"`
	CumulativeGas string                 `json:"cumulative_gas"`
	EpochNum      string                 `json:"epoch_num"`
	EventLogs     []EventLog             `json:"event_logs"`
	Transitions   []Transition           `json:"transitions"`
}

type TransactionStatus

type TransactionStatus struct {
	ID string

	Amount            string `json:"amount"`
	Data              string `json:"data"`
	EpochInserted     string `json:"epochInserted"`
	EpochUpdated      string `json:"epochUpdated"`
	GasLimit          string `json:"gasLimit"`
	GasPrice          string `json:"gasPrice"`
	LastModified      string `json:"lastModified"`
	ModificationState int    `json:"modificationState"`
	Nonce             string `json:"nonce"`
	SenderAddr        string `json:"senderAddr"`
	Signature         string `json:"signature"`
	Status            int    `json:"status"`
	Success           bool   `json:"success"`
	ToAddr            string `json:"toAddr"`
	Version           string `json:"version"`
	// contains filtered or unexported fields
}

type TransactionStatusId

type TransactionStatusId struct {
	// contains filtered or unexported fields
}

type Transactions

type Transactions struct {
	TxnHashes []string
}

type Transition

type Transition struct {
	Accept bool               `json:"accept"`
	Addr   string             `json:"addr"`
	Depth  int                `json:"depth"`
	Msg    TransactionMessage `json:"msg"`
}

type TxBlock

type TxBlock struct {
	BlockBase
	BlockHeader *TxBlockHeader
}

func NewTxBlockFromTxBlockT

func NewTxBlockFromTxBlockT(txt *TxBlockT) *TxBlock

func (*TxBlock) GetRandS

func (t *TxBlock) GetRandS() ([]byte, []byte)

func (*TxBlock) Hash

func (t *TxBlock) Hash() []byte

func (*TxBlock) Serialize

func (t *TxBlock) Serialize() []byte

type TxBlockBodyT

type TxBlockBodyT struct {
	B1              []bool
	B2              []bool
	BlockHash       string
	CS1             string
	HeaderSign      string
	MicroBlockInfos []MicroBlockInfo
}

type TxBlockHashSet

type TxBlockHashSet struct {
	// State merkle tree root hash only valid in vacuous epoch
	// should be 32 bytes as well
	StateRootHash [32]byte
	// State Delta Hash on DS
	// 32 bytes
	DeltaHash [32]byte
	// Hash concatenated from all microblock infos
	// 32 bytes
	MbInfoHash [32]byte
}

type TxBlockHeader

type TxBlockHeader struct {
	BlockHeaderBase BlockHeaderBase
	GasLimit        uint64
	GasUsed         uint64
	// uint128
	Rewards *big.Int
	// block index, starting from 0 in the genesis block
	BlockNum uint64
	HashSet  TxBlockHashSet
	NumTxs   uint32
	// Leader of the committee who proposed this block
	// base16 string
	MinerPubKey string
	// DS Block index at the time this Tx block was proposed
	DSBlockNum uint64
}

func NewTxBlockHeaderFromTxBlockT

func NewTxBlockHeaderFromTxBlockT(txt *TxBlockT) *TxBlockHeader

func (*TxBlockHeader) Serialize

func (t *TxBlockHeader) Serialize() []byte

func (*TxBlockHeader) ToProtoBuf

type TxBlockHeaderT

type TxBlockHeaderT struct {
	BlockNum       string
	CommitteeHash  string
	DSBlockNum     string
	GasLimit       string
	GasUsed        string
	MbInfoHash     string
	MinerPubKey    string
	NumMicroBlocks int
	NumTxns        uint32
	PrevBlockHash  string
	Rewards        string
	StateDeltaHash string
	StateRootHash  string
	Timestamp      string
	TxnFees        string
	Version        int
}

type TxBlockOrDsBlock

type TxBlockOrDsBlock struct {
	DsBlock *DsBlock
	TxBlock *TxBlock
}

type TxBlockT

type TxBlockT struct {
	Header TxBlockHeaderT `json:"header"`
	Body   TxBlockBodyT   `json:"body"`
}

type VoteT

type VoteT struct {
	VoteCount uint32
	VoteValue uint32
}

Jump to

Keyboard shortcuts

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