Documentation ¶
Index ¶
- Constants
- func BlockHashMaxSize() int
- func BlockHeaderMaxSize() (s int)
- func BlockMaxSize() (s int)
- func GenesisAccountDataMaxSize() (s int)
- func GenesisAllocationMaxSize() (s int)
- func GenesisMaxSize() (s int)
- func LightBlockHeaderMaxSize() (s int)
- func NextBonus(prev BlockHeader, params *config.ConsensusParams) basics.MicroAlgos
- func ParticipationUpdatesMaxSize() (s int)
- func ProcessUpgradeParams(prev BlockHeader) (uv UpgradeVote, us UpgradeState, err error)
- func RewardsStateMaxSize() (s int)
- func SignedTxnGroupsFlatten(txgroups [][]transactions.SignedTxn) (res []transactions.SignedTxn)
- func SignedTxnsToGroups(txns []transactions.SignedTxn) (res [][]transactions.SignedTxn)
- func StateProofTrackingDataMaxSize() (s int)
- func TxnCommitmentsMaxSize() (s int)
- func UpgradeVoteMaxSize() (s int)
- type Block
- func (_ *Block) CanMarshalMsg(z interface{}) bool
- func (_ *Block) CanUnmarshalMsg(z interface{}) bool
- func (block Block) ConsensusProtocol() config.ConsensusParams
- func (block Block) ContentsMatchHeader() bool
- func (block Block) DecodePaysetFlat() ([]transactions.SignedTxnWithAD, error)
- func (block Block) DecodePaysetGroups() ([][]transactions.SignedTxnWithAD, error)
- func (block Block) Digest() crypto.Digest
- func (block Block) GenesisHash() crypto.Digest
- func (block Block) GenesisID() string
- func (z *Block) MarshalMsg(b []byte) (o []byte)
- func (z *Block) MsgIsZero() bool
- func (z *Block) Msgsize() (s int)
- func (block Block) PaysetCommit() (TxnCommitments, error)
- func (block Block) Proposer() basics.Address
- func (block Block) ProposerPayout() basics.MicroAlgos
- func (block Block) Round() basics.Round
- func (block Block) Seed() committee.Seed
- func (b Block) String() string
- func (block Block) TxnMerkleTree() (*merklearray.Tree, error)
- func (block Block) TxnMerkleTreeSHA256() (*merklearray.Tree, error)
- func (z *Block) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *Block) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- func (block Block) WithProposer(s committee.Seed, proposer basics.Address, eligible bool) Block
- type BlockHash
- func (_ *BlockHash) CanMarshalMsg(z interface{}) bool
- func (_ *BlockHash) CanUnmarshalMsg(z interface{}) bool
- func (z *BlockHash) MarshalMsg(b []byte) []byte
- func (b BlockHash) MarshalText() ([]byte, error)
- func (z *BlockHash) MsgIsZero() bool
- func (z *BlockHash) Msgsize() int
- func (b BlockHash) String() string
- func (z *BlockHash) UnmarshalMsg(bts []byte) ([]byte, error)
- func (z *BlockHash) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) ([]byte, error)
- func (b *BlockHash) UnmarshalText(text []byte) error
- type BlockHeader
- func (_ *BlockHeader) CanMarshalMsg(z interface{}) bool
- func (_ *BlockHeader) CanUnmarshalMsg(z interface{}) bool
- func (bh BlockHeader) DecodeSignedTxn(stb transactions.SignedTxnInBlock) (transactions.SignedTxn, transactions.ApplyData, error)
- func (bh BlockHeader) EncodeSignedTxn(st transactions.SignedTxn, ad transactions.ApplyData) (transactions.SignedTxnInBlock, error)
- func (bh BlockHeader) Hash() BlockHash
- func (z *BlockHeader) MarshalMsg(b []byte) (o []byte)
- func (z *BlockHeader) MsgIsZero() bool
- func (z *BlockHeader) Msgsize() (s int)
- func (bh BlockHeader) NextVersionInfo() (ver protocol.ConsensusVersion, rnd basics.Round, supported bool)
- func (bh BlockHeader) PreCheck(prev BlockHeader) error
- func (bh BlockHeader) ToBeHashed() (protocol.HashID, []byte)
- func (bh *BlockHeader) ToLightBlockHeader() LightBlockHeader
- func (z *BlockHeader) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *BlockHeader) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type Genesis
- func (genesis Genesis) Balances() (GenesisBalances, error)
- func (genesis Genesis) Block() (Block, error)
- func (_ *Genesis) CanMarshalMsg(z interface{}) bool
- func (_ *Genesis) CanUnmarshalMsg(z interface{}) bool
- func (genesis Genesis) Hash() crypto.Digest
- func (genesis Genesis) ID() string
- func (z *Genesis) MarshalMsg(b []byte) (o []byte)
- func (z *Genesis) MsgIsZero() bool
- func (z *Genesis) Msgsize() (s int)
- func (genesis Genesis) ToBeHashed() (protocol.HashID, []byte)
- func (z *Genesis) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *Genesis) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type GenesisAccountData
- func (ga *GenesisAccountData) AccountData() basics.AccountData
- func (_ *GenesisAccountData) CanMarshalMsg(z interface{}) bool
- func (_ *GenesisAccountData) CanUnmarshalMsg(z interface{}) bool
- func (z *GenesisAccountData) MarshalMsg(b []byte) (o []byte)
- func (z *GenesisAccountData) MsgIsZero() bool
- func (z *GenesisAccountData) Msgsize() (s int)
- func (z *GenesisAccountData) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *GenesisAccountData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type GenesisAllocation
- func (_ *GenesisAllocation) CanMarshalMsg(z interface{}) bool
- func (_ *GenesisAllocation) CanUnmarshalMsg(z interface{}) bool
- func (z *GenesisAllocation) MarshalMsg(b []byte) (o []byte)
- func (z *GenesisAllocation) MsgIsZero() bool
- func (z *GenesisAllocation) Msgsize() (s int)
- func (z *GenesisAllocation) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *GenesisAllocation) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type GenesisBalances
- type LightBlockHeader
- func (_ *LightBlockHeader) CanMarshalMsg(z interface{}) bool
- func (_ *LightBlockHeader) CanUnmarshalMsg(z interface{}) bool
- func (z *LightBlockHeader) MarshalMsg(b []byte) (o []byte)
- func (z *LightBlockHeader) MsgIsZero() bool
- func (z *LightBlockHeader) Msgsize() (s int)
- func (bh *LightBlockHeader) ToBeHashed() (protocol.HashID, []byte)
- func (z *LightBlockHeader) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *LightBlockHeader) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type ParticipationUpdates
- func (_ *ParticipationUpdates) CanMarshalMsg(z interface{}) bool
- func (_ *ParticipationUpdates) CanUnmarshalMsg(z interface{}) bool
- func (z *ParticipationUpdates) MarshalMsg(b []byte) (o []byte)
- func (z *ParticipationUpdates) MsgIsZero() bool
- func (z *ParticipationUpdates) Msgsize() (s int)
- func (z *ParticipationUpdates) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *ParticipationUpdates) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type RewardsState
- func (_ *RewardsState) CanMarshalMsg(z interface{}) bool
- func (_ *RewardsState) CanUnmarshalMsg(z interface{}) bool
- func (z *RewardsState) MarshalMsg(b []byte) (o []byte)
- func (z *RewardsState) MsgIsZero() bool
- func (z *RewardsState) Msgsize() (s int)
- func (s RewardsState) NextRewardsState(nextRound basics.Round, nextProto config.ConsensusParams, ...) (res RewardsState)
- func (z *RewardsState) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *RewardsState) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type StateProofTrackingData
- func (_ *StateProofTrackingData) CanMarshalMsg(z interface{}) bool
- func (_ *StateProofTrackingData) CanUnmarshalMsg(z interface{}) bool
- func (z *StateProofTrackingData) MarshalMsg(b []byte) (o []byte)
- func (z *StateProofTrackingData) MsgIsZero() bool
- func (z *StateProofTrackingData) Msgsize() (s int)
- func (z *StateProofTrackingData) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *StateProofTrackingData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type TxnCommitments
- func (_ *TxnCommitments) CanMarshalMsg(z interface{}) bool
- func (_ *TxnCommitments) CanUnmarshalMsg(z interface{}) bool
- func (z *TxnCommitments) MarshalMsg(b []byte) (o []byte)
- func (z *TxnCommitments) MsgIsZero() bool
- func (z *TxnCommitments) Msgsize() (s int)
- func (z *TxnCommitments) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *TxnCommitments) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
- type UpgradeState
- type UpgradeVote
- func (_ *UpgradeVote) CanMarshalMsg(z interface{}) bool
- func (_ *UpgradeVote) CanUnmarshalMsg(z interface{}) bool
- func (z *UpgradeVote) MarshalMsg(b []byte) (o []byte)
- func (z *UpgradeVote) MsgIsZero() bool
- func (z *UpgradeVote) Msgsize() (s int)
- func (z *UpgradeVote) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (z *UpgradeVote) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
Constants ¶
const ( // MaxInitialGenesisAllocationSize is the maximum number of accounts that are supported when // bootstrapping a new network. The number of account *can* grow further after the bootstrapping. // This value is used exclusively for the messagepack decoder, and has no affect on the network // capabilities/capacity in any way. MaxInitialGenesisAllocationSize = 100000000 )
Variables ¶
This section is empty.
Functions ¶
func BlockHashMaxSize ¶
func BlockHashMaxSize() int
MaxSize returns a maximum valid message size for this message type
func BlockHeaderMaxSize ¶
func BlockHeaderMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func BlockMaxSize ¶
func BlockMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func GenesisAccountDataMaxSize ¶
func GenesisAccountDataMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func GenesisAllocationMaxSize ¶
func GenesisAllocationMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func GenesisMaxSize ¶
func GenesisMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func LightBlockHeaderMaxSize ¶
func LightBlockHeaderMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func NextBonus ¶
func NextBonus(prev BlockHeader, params *config.ConsensusParams) basics.MicroAlgos
NextBonus determines the bonus that should be paid out for proposing the next block.
func ParticipationUpdatesMaxSize ¶
func ParticipationUpdatesMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func ProcessUpgradeParams ¶
func ProcessUpgradeParams(prev BlockHeader) (uv UpgradeVote, us UpgradeState, err error)
ProcessUpgradeParams determines our upgrade vote, applies it, and returns the generated UpgradeVote and the new UpgradeState
func RewardsStateMaxSize ¶
func RewardsStateMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func SignedTxnGroupsFlatten ¶
func SignedTxnGroupsFlatten(txgroups [][]transactions.SignedTxn) (res []transactions.SignedTxn)
SignedTxnGroupsFlatten combines all groups into a flat slice of SignedTxns.
func SignedTxnsToGroups ¶
func SignedTxnsToGroups(txns []transactions.SignedTxn) (res [][]transactions.SignedTxn)
SignedTxnsToGroups splits a slice of SignedTxns into groups.
func StateProofTrackingDataMaxSize ¶
func StateProofTrackingDataMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func TxnCommitmentsMaxSize ¶
func TxnCommitmentsMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
func UpgradeVoteMaxSize ¶
func UpgradeVoteMaxSize() (s int)
MaxSize returns a maximum valid message size for this message type
Types ¶
type Block ¶
type Block struct { BlockHeader Payset transactions.Payset `codec:"txns,maxtotalbytes=config.MaxTxnBytesPerBlock"` }
A Block contains the Payset and metadata corresponding to a given Round.
func MakeBlock ¶
func MakeBlock(prev BlockHeader) Block
MakeBlock constructs a new valid block with an empty payset and an unset Seed.
func MakeGenesisBlock ¶
func MakeGenesisBlock(proto protocol.ConsensusVersion, genesisBal GenesisBalances, genesisID string, genesisHash crypto.Digest) (Block, error)
MakeGenesisBlock creates a genesis block, including setup of RewardsState.
func (*Block) CanMarshalMsg ¶
func (*Block) CanUnmarshalMsg ¶
func (Block) ConsensusProtocol ¶
func (block Block) ConsensusProtocol() config.ConsensusParams
ConsensusProtocol returns the consensus protocol params for a block
func (Block) ContentsMatchHeader ¶
ContentsMatchHeader checks that the TxnCommitments matches what's in the header, as the header is what the block hash authenticates. If we're given an untrusted block and a known-good hash, we can't trust the block's transactions unless we validate this.
func (Block) DecodePaysetFlat ¶
func (block Block) DecodePaysetFlat() ([]transactions.SignedTxnWithAD, error)
DecodePaysetFlat decodes block.Payset using DecodeSignedTxn, and flattens groups.
func (Block) DecodePaysetGroups ¶
func (block Block) DecodePaysetGroups() ([][]transactions.SignedTxnWithAD, error)
DecodePaysetGroups decodes block.Payset using DecodeSignedTxn, and returns the transactions in groups.
func (Block) GenesisHash ¶
GenesisHash returns the genesis hash from the block header
func (*Block) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*Block) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Block) PaysetCommit ¶
func (block Block) PaysetCommit() (TxnCommitments, error)
PaysetCommit computes the commitment to the payset, using the appropriate commitment plan based on the block's protocol.
func (Block) ProposerPayout ¶
func (block Block) ProposerPayout() basics.MicroAlgos
ProposerPayout returns the Block's proposer payout.
func (Block) TxnMerkleTree ¶
func (block Block) TxnMerkleTree() (*merklearray.Tree, error)
TxnMerkleTree returns a cryptographic commitment to the transactions in the block, along with their ApplyData, as a Merkle tree. This allows the caller to either extract the root hash (for inclusion in the block header), or to generate proofs of membership for transactions that are in this block.
func (Block) TxnMerkleTreeSHA256 ¶
func (block Block) TxnMerkleTreeSHA256() (*merklearray.Tree, error)
TxnMerkleTreeSHA256 returns a cryptographic commitment to the transactions in the block, along with their ApplyData, as a Merkle tree vector commitment, using SHA256. This allows the caller to either extract the root hash (for inclusion in the block header), or to generate proofs of membership for transactions that are in this block.
func (*Block) UnmarshalMsgWithState ¶
UnmarshalMsg implements msgp.Unmarshaler
type BlockHash ¶
BlockHash represents the hash of a block
func (*BlockHash) CanMarshalMsg ¶
func (*BlockHash) CanUnmarshalMsg ¶
func (*BlockHash) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (BlockHash) MarshalText ¶
MarshalText returns the BlockHash string as an array of bytes
func (*BlockHash) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BlockHash) UnmarshalMsg ¶
UnmarshalMsg implements msgp.Unmarshaler
func (*BlockHash) UnmarshalMsgWithState ¶
func (*BlockHash) UnmarshalText ¶
UnmarshalText initializes the BlockHash from an array of bytes.
type BlockHeader ¶
type BlockHeader struct { Round basics.Round `codec:"rnd"` // The hash of the previous block Branch BlockHash `codec:"prev"` // Sortition seed Seed committee.Seed `codec:"seed"` // TxnCommitments authenticates the set of transactions appearing in the block. TxnCommitments // TimeStamp in seconds since epoch TimeStamp int64 `codec:"ts"` // Genesis ID to which this block belongs. GenesisID string `codec:"gen,allocbound=config.MaxGenesisIDLen"` // Genesis hash to which this block belongs. GenesisHash crypto.Digest `codec:"gh"` // Proposer is the proposer of this block. Like the Seed, agreement adds // this after the block is assembled by the transaction pool, so that the same block can be prepared // for multiple participating accounts in the same node. Therefore, it can not be used // to influence block evaluation. Populated if proto.Payouts.Enabled Proposer basics.Address `codec:"prp"` // FeesCollected is the sum of all fees paid by transactions in this // block. Populated if proto.Payouts.Enabled FeesCollected basics.MicroAlgos `codec:"fc"` // Bonus is the bonus incentive to be paid for proposing this block. It // begins as a consensus parameter value, and decays periodically. Bonus basics.MicroAlgos `codec:"bi"` // ProposerPayout is the amount that is moved from the FeeSink to // the Proposer in this block. It is basically the // bonus + the payouts percent of FeesCollected, but may be zero'd by // proposer ineligibility. ProposerPayout basics.MicroAlgos `codec:"pp"` // Rewards. // // When a block is applied, some amount of rewards are accrued to // every account with AccountData.Status=/=NotParticipating. The // amount is (thisBlock.RewardsLevel-prevBlock.RewardsLevel) of // MicroAlgos for every whole config.Protocol.RewardUnit of MicroAlgos in // that account's AccountData.MicroAlgos. // // Rewards are not compounded (i.e., not added to AccountData.MicroAlgos) // until some other transaction is executed on that account. // // Not compounding rewards allows us to precisely know how many algos // of rewards will be distributed without having to examine every // account to determine if it should get one more algo of rewards // because compounding formed another whole config.Protocol.RewardUnit // of algos. RewardsState // Consensus protocol versioning. // // Each block is associated with a version of the consensus protocol, // stored under UpgradeState.CurrentProtocol. The protocol version // for a block can be determined without having to first decode the // block and its CurrentProtocol field, and this field is present for // convenience and explicitness. Block.Valid() checks that this field // correctly matches the expected protocol version. // // Each block is associated with at most one active upgrade proposal // (a new version of the protocol). An upgrade proposal can be made // by a block proposer, as long as no other upgrade proposal is active. // The upgrade proposal lasts for many rounds (UpgradeVoteRounds), and // in each round, that round's block proposer votes to support (or not) // the proposed upgrade. // // If enough votes are collected, the proposal is approved, and will // definitely take effect. The proposal lingers for some number of // rounds to give clients a chance to notify users about an approved // upgrade, if the client doesn't support it, so the user has a chance // to download updated client software. // // Block proposers influence this upgrade machinery through two fields // in UpgradeVote: UpgradePropose, which proposes an upgrade to a new // protocol, and UpgradeApprove, which signals approval of the current // proposal. // // Once a block proposer determines its UpgradeVote, then UpdateState // is updated deterministically based on the previous UpdateState and // the new block's UpgradeVote. UpgradeState UpgradeVote // TxnCounter is the number of the next transaction that will be // committed after this block. Genesis blocks can start at either // 0 or 1000, depending on a consensus parameter (AppForbidLowResources). TxnCounter uint64 `codec:"tc"` // StateProofTracking tracks the status of the state proofs, potentially // for multiple types of ASPs (Algorand's State Proofs). //msgp:sort protocol.StateProofType protocol.SortStateProofType StateProofTracking map[protocol.StateProofType]StateProofTrackingData `codec:"spt,allocbound=protocol.NumStateProofTypes"` // ParticipationUpdates contains the information needed to mark // certain accounts offline because their participation keys expired ParticipationUpdates // contains filtered or unexported fields }
A BlockHeader represents the metadata and commitments to the state of a Block. The Algorand Ledger may be defined minimally as a cryptographically authenticated series of BlockHeader objects.
func (*BlockHeader) CanMarshalMsg ¶
func (_ *BlockHeader) CanMarshalMsg(z interface{}) bool
func (*BlockHeader) CanUnmarshalMsg ¶
func (_ *BlockHeader) CanUnmarshalMsg(z interface{}) bool
func (BlockHeader) DecodeSignedTxn ¶
func (bh BlockHeader) DecodeSignedTxn(stb transactions.SignedTxnInBlock) (transactions.SignedTxn, transactions.ApplyData, error)
DecodeSignedTxn converts a SignedTxnInBlock from a block to SignedTxn and its associated ApplyData.
func (BlockHeader) EncodeSignedTxn ¶
func (bh BlockHeader) EncodeSignedTxn(st transactions.SignedTxn, ad transactions.ApplyData) (transactions.SignedTxnInBlock, error)
EncodeSignedTxn converts a SignedTxn and ApplyData into a SignedTxnInBlock for that block.
func (BlockHeader) Hash ¶
func (bh BlockHeader) Hash() BlockHash
Hash returns the hash of a block header. The hash of a block is the hash of its header.
func (*BlockHeader) MarshalMsg ¶
func (z *BlockHeader) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*BlockHeader) MsgIsZero ¶
func (z *BlockHeader) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*BlockHeader) Msgsize ¶
func (z *BlockHeader) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (BlockHeader) NextVersionInfo ¶
func (bh BlockHeader) NextVersionInfo() (ver protocol.ConsensusVersion, rnd basics.Round, supported bool)
NextVersionInfo returns information about the next expected protocol version. If no upgrade is scheduled, return the current protocol.
func (BlockHeader) PreCheck ¶
func (bh BlockHeader) PreCheck(prev BlockHeader) error
PreCheck checks if the block header bh is a valid successor to the previous block's header, prev.
func (BlockHeader) ToBeHashed ¶
func (bh BlockHeader) ToBeHashed() (protocol.HashID, []byte)
ToBeHashed implements the crypto.Hashable interface
func (*BlockHeader) ToLightBlockHeader ¶
func (bh *BlockHeader) ToLightBlockHeader() LightBlockHeader
ToLightBlockHeader creates returns a LightBlockHeader from a given block header
func (*BlockHeader) UnmarshalMsg ¶
func (z *BlockHeader) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*BlockHeader) UnmarshalMsgWithState ¶
func (z *BlockHeader) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Genesis ¶
type Genesis struct { // The SchemaID allows nodes to store data specific to a particular // universe (in case of upgrades at development or testing time), // and as an optimization to quickly check if two nodes are in // the same universe. SchemaID string `codec:"id"` // Network identifies the unique algorand network for which the ledger // is valid. // Note the Network name should not include a '-', as we generate the // GenesisID from "<Network>-<SchemaID>"; the '-' makes it easy // to distinguish between the network and schema. Network protocol.NetworkID `codec:"network"` // Proto is the consensus protocol in use at the genesis block. Proto protocol.ConsensusVersion `codec:"proto"` // Allocation determines the initial accounts and their state. Allocation []GenesisAllocation `codec:"alloc,allocbound=MaxInitialGenesisAllocationSize"` // RewardsPool is the address of the rewards pool. RewardsPool string `codec:"rwd"` // FeeSink is the address of the fee sink. FeeSink string `codec:"fees"` // Timestamp for the genesis block Timestamp int64 `codec:"timestamp"` // Arbitrary genesis comment string - will be excluded from file if empty Comment string `codec:"comment"` // DevMode defines whether this network operates in a developer mode or not. Developer mode networks // are a single node network, that operates without the agreement service being active. In liue of the // agreement service, a new block is generated each time a node receives a transaction group. The // default value for this field is "false", which makes this field empty from it's encoding, and // therefore backward compatible. DevMode bool `codec:"devmode"` // contains filtered or unexported fields }
A Genesis object defines an Algorand "universe" -- a set of nodes that can talk to each other, agree on the ledger contents, etc. This is defined by the initial account states (GenesisAllocation), the initial consensus protocol (GenesisProto), and the schema of the ledger.
func LoadGenesisFromFile ¶
LoadGenesisFromFile attempts to load a Genesis structure from a (presumably) genesis.json file.
func (Genesis) Balances ¶
func (genesis Genesis) Balances() (GenesisBalances, error)
Balances returns the genesis account balances.
func (*Genesis) CanMarshalMsg ¶
func (*Genesis) CanUnmarshalMsg ¶
func (Genesis) ID ¶
ID is the effective Genesis identifier - the combination of the network and the ledger schema version
func (*Genesis) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*Genesis) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (Genesis) ToBeHashed ¶
ToBeHashed impements the crypto.Hashable interface.
func (*Genesis) UnmarshalMsgWithState ¶
UnmarshalMsg implements msgp.Unmarshaler
type GenesisAccountData ¶
type GenesisAccountData struct { Status basics.Status `codec:"onl"` MicroAlgos basics.MicroAlgos `codec:"algo"` VoteID crypto.OneTimeSignatureVerifier `codec:"vote"` StateProofID merklesignature.Commitment `codec:"stprf"` SelectionID crypto.VRFVerifier `codec:"sel"` VoteFirstValid basics.Round `codec:"voteFst"` VoteLastValid basics.Round `codec:"voteLst"` VoteKeyDilution uint64 `codec:"voteKD"` // contains filtered or unexported fields }
GenesisAccountData contains a subset of account information that is present in the genesis file.
func (*GenesisAccountData) AccountData ¶
func (ga *GenesisAccountData) AccountData() basics.AccountData
AccountData returns a basics.AccountData type for this genesis account.
func (*GenesisAccountData) CanMarshalMsg ¶
func (_ *GenesisAccountData) CanMarshalMsg(z interface{}) bool
func (*GenesisAccountData) CanUnmarshalMsg ¶
func (_ *GenesisAccountData) CanUnmarshalMsg(z interface{}) bool
func (*GenesisAccountData) MarshalMsg ¶
func (z *GenesisAccountData) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*GenesisAccountData) MsgIsZero ¶
func (z *GenesisAccountData) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*GenesisAccountData) Msgsize ¶
func (z *GenesisAccountData) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*GenesisAccountData) UnmarshalMsg ¶
func (z *GenesisAccountData) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*GenesisAccountData) UnmarshalMsgWithState ¶
func (z *GenesisAccountData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type GenesisAllocation ¶
type GenesisAllocation struct { Address string `codec:"addr"` Comment string `codec:"comment"` State GenesisAccountData `codec:"state"` // contains filtered or unexported fields }
A GenesisAllocation object represents an allocation of algos to an address in the genesis block. Address is the checksummed short address. Comment is a note about what this address is representing, and is purely informational. State is the initial account state.
func (*GenesisAllocation) CanMarshalMsg ¶
func (_ *GenesisAllocation) CanMarshalMsg(z interface{}) bool
func (*GenesisAllocation) CanUnmarshalMsg ¶
func (_ *GenesisAllocation) CanUnmarshalMsg(z interface{}) bool
func (*GenesisAllocation) MarshalMsg ¶
func (z *GenesisAllocation) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*GenesisAllocation) MsgIsZero ¶
func (z *GenesisAllocation) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*GenesisAllocation) Msgsize ¶
func (z *GenesisAllocation) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*GenesisAllocation) UnmarshalMsg ¶
func (z *GenesisAllocation) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*GenesisAllocation) UnmarshalMsgWithState ¶
func (z *GenesisAllocation) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type GenesisBalances ¶
type GenesisBalances struct { Balances map[basics.Address]basics.AccountData FeeSink basics.Address RewardsPool basics.Address Timestamp int64 }
GenesisBalances contains the information needed to generate a new ledger
func MakeGenesisBalances ¶
func MakeGenesisBalances(balances map[basics.Address]basics.AccountData, feeSink, rewardsPool basics.Address) GenesisBalances
MakeGenesisBalances returns the information needed to bootstrap the ledger based on the current time
func MakeTimestampedGenesisBalances ¶
func MakeTimestampedGenesisBalances(balances map[basics.Address]basics.AccountData, feeSink, rewardsPool basics.Address, timestamp int64) GenesisBalances
MakeTimestampedGenesisBalances returns the information needed to bootstrap the ledger based on a given time
type LightBlockHeader ¶
type LightBlockHeader struct { /* The seed is to mitigate against the (remote) possibility that an attacker can put itself in better position to find a collision in the future -- perhaps with quantum -- e.g., by doing some precomputation, knowing or even controlling the data to be hashed, etc. Starting the hash data with a value that is uncontrollable and unpredictable (to today’s attackers) makes the attacker’s task more like breaking 2nd preimage resistance (2PR/TCR), versus the easier goal of merely breaking collision resistance. In addition, we make sure that the Seed (The unpredictable value) would be the first field that gets hashed (give it the lowest codec value in the LightBlockHeader struct) to mitigate a collision attack on the merkle damgard construction. The BlockHash serves a similar role, in that it also depends on the seed and introduces some uncontrollable input. It is slightly weaker, in the sense that an adversary can influence the BlockHash to some degree (e.g., by including specific transactions in the payset), but it comes with the added benefit of allowing to authenticate the entire blockchain based on the BlockHash value. */ Seed committee.Seed `codec:"0"` BlockHash BlockHash `codec:"1"` Round basics.Round `codec:"r"` GenesisHash crypto.Digest `codec:"gh"` Sha256TxnCommitment crypto.GenericDigest `codec:"tc,allocbound=crypto.Sha256Size"` // contains filtered or unexported fields }
LightBlockHeader represents a minimal block header. It contains all the necessary fields for verifying proofs on transactions. In addition, this struct is designed to be used on environments where only SHA256 function exists
func (*LightBlockHeader) CanMarshalMsg ¶
func (_ *LightBlockHeader) CanMarshalMsg(z interface{}) bool
func (*LightBlockHeader) CanUnmarshalMsg ¶
func (_ *LightBlockHeader) CanUnmarshalMsg(z interface{}) bool
func (*LightBlockHeader) MarshalMsg ¶
func (z *LightBlockHeader) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*LightBlockHeader) MsgIsZero ¶
func (z *LightBlockHeader) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*LightBlockHeader) Msgsize ¶
func (z *LightBlockHeader) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*LightBlockHeader) ToBeHashed ¶
func (bh *LightBlockHeader) ToBeHashed() (protocol.HashID, []byte)
ToBeHashed implements the crypto.Hashable interface
func (*LightBlockHeader) UnmarshalMsg ¶
func (z *LightBlockHeader) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*LightBlockHeader) UnmarshalMsgWithState ¶
func (z *LightBlockHeader) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ParticipationUpdates ¶
type ParticipationUpdates struct { // ExpiredParticipationAccounts contains a list of online accounts // that needs to be converted to offline since their // participation key expired. ExpiredParticipationAccounts []basics.Address `codec:"partupdrmv,allocbound=config.MaxProposedExpiredOnlineAccounts"` // AbsentParticipationAccounts contains a list of online accounts that // needs to be converted to offline since they are not proposing. AbsentParticipationAccounts []basics.Address `codec:"partupdabs,allocbound=config.MaxMarkAbsent"` // contains filtered or unexported fields }
ParticipationUpdates represents participation account data that needs to be checked/acted on by the network
func (*ParticipationUpdates) CanMarshalMsg ¶
func (_ *ParticipationUpdates) CanMarshalMsg(z interface{}) bool
func (*ParticipationUpdates) CanUnmarshalMsg ¶
func (_ *ParticipationUpdates) CanUnmarshalMsg(z interface{}) bool
func (*ParticipationUpdates) MarshalMsg ¶
func (z *ParticipationUpdates) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*ParticipationUpdates) MsgIsZero ¶
func (z *ParticipationUpdates) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*ParticipationUpdates) Msgsize ¶
func (z *ParticipationUpdates) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*ParticipationUpdates) UnmarshalMsg ¶
func (z *ParticipationUpdates) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*ParticipationUpdates) UnmarshalMsgWithState ¶
func (z *ParticipationUpdates) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type RewardsState ¶
type RewardsState struct { // The FeeSink accepts transaction fees. It can only spend to // the incentive pool. FeeSink basics.Address `codec:"fees"` // The RewardsPool accepts periodic injections from the // FeeSink and continually redistributes them to addresses as // rewards. RewardsPool basics.Address `codec:"rwd"` // RewardsLevel specifies how many rewards, in MicroAlgos, // have been distributed to each config.Protocol.RewardUnit // of MicroAlgos since genesis. RewardsLevel uint64 `codec:"earn"` // The number of new MicroAlgos added to the participation stake from rewards at the next round. RewardsRate uint64 `codec:"rate"` // The number of leftover MicroAlgos after the distribution of RewardsRate/rewardUnits // MicroAlgos for every reward unit in the next round. RewardsResidue uint64 `codec:"frac"` // The round at which the RewardsRate will be recalculated. RewardsRecalculationRound basics.Round `codec:"rwcalr"` // contains filtered or unexported fields }
RewardsState represents the global parameters controlling the rate at which accounts accrue rewards.
func (*RewardsState) CanMarshalMsg ¶
func (_ *RewardsState) CanMarshalMsg(z interface{}) bool
func (*RewardsState) CanUnmarshalMsg ¶
func (_ *RewardsState) CanUnmarshalMsg(z interface{}) bool
func (*RewardsState) MarshalMsg ¶
func (z *RewardsState) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*RewardsState) MsgIsZero ¶
func (z *RewardsState) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*RewardsState) Msgsize ¶
func (z *RewardsState) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (RewardsState) NextRewardsState ¶
func (s RewardsState) NextRewardsState(nextRound basics.Round, nextProto config.ConsensusParams, incentivePoolBalance basics.MicroAlgos, totalRewardUnits uint64, log logging.Logger) (res RewardsState)
NextRewardsState computes the RewardsState of the subsequent round given the subsequent consensus parameters, along with the incentive pool balance and the total reward units in the system as of the current round.
func (*RewardsState) UnmarshalMsg ¶
func (z *RewardsState) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*RewardsState) UnmarshalMsgWithState ¶
func (z *RewardsState) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type StateProofTrackingData ¶
type StateProofTrackingData struct { // StateProofVotersCommitment is the root of a vector commitment containing the // online accounts that will help sign a state proof. The // VC root, and the state proof, happen on blocks that // are a multiple of ConsensusParams.StateProofRounds. For blocks // that are not a multiple of ConsensusParams.StateProofRounds, // this value is zero. StateProofVotersCommitment crypto.GenericDigest `codec:"v"` // StateProofOnlineTotalWeight is the total number of microalgos held by the online accounts // during the StateProof round (or zero, if the merkle root is zero - no commitment for StateProof voters). // This is intended for computing the threshold of votes to expect from StateProofVotersCommitment. StateProofOnlineTotalWeight basics.MicroAlgos `codec:"t"` // StateProofNextRound is the next round for which we will accept // a StateProof transaction. StateProofNextRound basics.Round `codec:"n"` // contains filtered or unexported fields }
StateProofTrackingData tracks the status of state proofs.
func (*StateProofTrackingData) CanMarshalMsg ¶
func (_ *StateProofTrackingData) CanMarshalMsg(z interface{}) bool
func (*StateProofTrackingData) CanUnmarshalMsg ¶
func (_ *StateProofTrackingData) CanUnmarshalMsg(z interface{}) bool
func (*StateProofTrackingData) MarshalMsg ¶
func (z *StateProofTrackingData) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*StateProofTrackingData) MsgIsZero ¶
func (z *StateProofTrackingData) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*StateProofTrackingData) Msgsize ¶
func (z *StateProofTrackingData) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*StateProofTrackingData) UnmarshalMsg ¶
func (z *StateProofTrackingData) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*StateProofTrackingData) UnmarshalMsgWithState ¶
func (z *StateProofTrackingData) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type TxnCommitments ¶
type TxnCommitments struct { // Root of transaction merkle tree using SHA512_256 hash function. // This commitment is computed based on the PaysetCommit type specified in the block's consensus protocol. NativeSha512_256Commitment crypto.Digest `codec:"txn"` // Root of transaction vector commitment merkle tree using SHA256 hash function Sha256Commitment crypto.Digest `codec:"txn256"` // contains filtered or unexported fields }
TxnCommitments represents the commitments computed from the transactions in the block. It contains multiple commitments based on different algorithms and hash functions, to support different use cases.
func (*TxnCommitments) CanMarshalMsg ¶
func (_ *TxnCommitments) CanMarshalMsg(z interface{}) bool
func (*TxnCommitments) CanUnmarshalMsg ¶
func (_ *TxnCommitments) CanUnmarshalMsg(z interface{}) bool
func (*TxnCommitments) MarshalMsg ¶
func (z *TxnCommitments) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*TxnCommitments) MsgIsZero ¶
func (z *TxnCommitments) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*TxnCommitments) Msgsize ¶
func (z *TxnCommitments) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*TxnCommitments) UnmarshalMsg ¶
func (z *TxnCommitments) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*TxnCommitments) UnmarshalMsgWithState ¶
func (z *TxnCommitments) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type UpgradeState ¶
type UpgradeState struct { CurrentProtocol protocol.ConsensusVersion `codec:"proto"` NextProtocol protocol.ConsensusVersion `codec:"nextproto"` NextProtocolApprovals uint64 `codec:"nextyes"` // NextProtocolVoteBefore specify the last voting round for the next protocol proposal. If there is no voting for // an upgrade taking place, this would be zero. NextProtocolVoteBefore basics.Round `codec:"nextbefore"` // NextProtocolSwitchOn specify the round number at which the next protocol would be adopted. If there is no upgrade taking place, // nor a wait for the next protocol, this would be zero. NextProtocolSwitchOn basics.Round `codec:"nextswitch"` }
UpgradeState tracks the protocol upgrade state machine. It is, strictly speaking, computable from the history of all UpgradeVotes but we keep it in the block for explicitness and convenience (instead of materializing it separately, like balances).
type UpgradeVote ¶
type UpgradeVote struct { // UpgradePropose indicates a proposed upgrade UpgradePropose protocol.ConsensusVersion `codec:"upgradeprop"` // UpgradeDelay indicates the time between acceptance and execution UpgradeDelay basics.Round `codec:"upgradedelay"` // UpgradeApprove indicates a yes vote for the current proposal UpgradeApprove bool `codec:"upgradeyes"` // contains filtered or unexported fields }
UpgradeVote represents the vote of the block proposer with respect to protocol upgrades.
func (*UpgradeVote) CanMarshalMsg ¶
func (_ *UpgradeVote) CanMarshalMsg(z interface{}) bool
func (*UpgradeVote) CanUnmarshalMsg ¶
func (_ *UpgradeVote) CanUnmarshalMsg(z interface{}) bool
func (*UpgradeVote) MarshalMsg ¶
func (z *UpgradeVote) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*UpgradeVote) MsgIsZero ¶
func (z *UpgradeVote) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*UpgradeVote) Msgsize ¶
func (z *UpgradeVote) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*UpgradeVote) UnmarshalMsg ¶
func (z *UpgradeVote) UnmarshalMsg(bts []byte) (o []byte, err error)
func (*UpgradeVote) UnmarshalMsgWithState ¶
func (z *UpgradeVote) UnmarshalMsgWithState(bts []byte, st msgp.UnmarshalState) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler