Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadStakeDist ¶
loads json file containing stake distribution into in memory map to access stakes of users useful when validating transactions (check for enough credit) and validating leaders (computing threshold for leader)
Types ¶
type Block ¶
type Block struct { PreviousHash string // aka state Slot int // index of slot block produced in VrfOutput string VrfProof string SlotLeader string // public key of block creator Timestamp string Transactions []Transaction Nonce string //seeds slot leaders for selection process, no need to include in all blocks (just epoch transitions) StakeDistribution []Stakeholder //only in epoch transitions Signature string // signing all previous fields (proof that slot leader is who he claims to be) }
func GenesisBlock ¶
func (*Block) Add ¶
func (b *Block) Add(t Transaction)
func (*Block) Sign ¶
func (b *Block) Sign(privateKey ed25519.PrivateKey)
type Distribution ¶
type Distribution struct {
Stakeholders []Stakeholder
}
type Stakeholder ¶
type Transaction ¶
type Transaction struct { // maybe introduce a transaction header type later Nonce uint64 // in case same amount sent to same receiver later From string To string Amount uint64 Timestamp string ContractCode []byte GasPrice uint64 GasLimit uint64 ContractAddress string // provides consent for smart contracts involving other users (otherwise empty) Signature string }
func (*Transaction) Sign ¶
func (t *Transaction) Sign(privateKey ed25519.PrivateKey)
func (*Transaction) Validate ¶
func (t *Transaction) Validate() bool
Click to show internal directories.
Click to hide internal directories.