Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProofOfStake ¶
type ProofOfStake struct {
// contains filtered or unexported fields
}
ProofOfStake represents the Proof of Stake consensus mechanism
func NewProofOfStake ¶
func NewProofOfStake(bc *blockchain.Blockchain) *ProofOfStake
NewProofOfStake creates a new ProofOfStake instance
func (*ProofOfStake) CreateNewBlock ¶
func (pos *ProofOfStake) CreateNewBlock() (*blockchain.Block, error)
CreateNewBlock creates a new block to be added to the blockchain
func (*ProofOfStake) SelectBlockCreator ¶
func (pos *ProofOfStake) SelectBlockCreator() string
SelectBlockCreator selects a node as the block creator based on their stake
func (*ProofOfStake) UpdateStakeholder ¶
func (pos *ProofOfStake) UpdateStakeholder(nodeID string, stake int)
UpdateStakeholder updates the stake for a given node
func (*ProofOfStake) ValidateBlock ¶
func (pos *ProofOfStake) ValidateBlock(block *blockchain.Block) bool
ValidateBlock validates a block based on the Proof of Stake mechanism
type Stakeholder ¶
Stakeholder represents a node in the network with its stake value
Click to show internal directories.
Click to hide internal directories.