Documentation ¶
Overview ¶
Permissions implement a permission interface to determine if a node is allowed to participate in consensus and punish nodes that violate the consensus rules.
The ProofOfStake permission implementation requires a minimum amount of tokens staged on a deposit contract to be allowed to participate in consensus. The balance deposited is checked against the state of the chain at the time of checksum window creation. The ProofOfStake implementation punishes nodes that violate the consensus rules by slashing their deposit.
The ProofOfAuthority permission implementation requires a list of authorized tokens to be allowed to participate in consensus. The ProofOfAuthority does not contemplate punishment other than be automatically removed from the list of authorized tokens.
Index ¶
- func Violations(duplicates *bft.Duplicate) map[crypto.Token]struct{}
- type Permissionless
- type ProofOfAuthority
- func (poa *ProofOfAuthority) Authorize(token crypto.Token)
- func (poa *ProofOfAuthority) Cancel(token crypto.Token)
- func (poa *ProofOfAuthority) DeterminePool(chain *chain.Blockchain, candidates []crypto.Token) map[crypto.Token]int
- func (poa *ProofOfAuthority) Punish(duplicates *bft.Duplicate, weights map[crypto.Token]int) map[crypto.Token]uint64
- type ProofOfStake
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Permissionless ¶
type Permissionless struct{}
func (Permissionless) DeterminePool ¶
func (p Permissionless) DeterminePool(chain *chain.Blockchain, candidates []crypto.Token) map[crypto.Token]int
type ProofOfAuthority ¶
Proof of authority implements a PoA permission interface.
func NewProofOfAuthority ¶
func NewProofOfAuthority(tokens ...crypto.Token) *ProofOfAuthority
NewProofOfStake returns a new empty ProofOfStake.
func (*ProofOfAuthority) Authorize ¶
func (poa *ProofOfAuthority) Authorize(token crypto.Token)
func (*ProofOfAuthority) Cancel ¶
func (poa *ProofOfAuthority) Cancel(token crypto.Token)
Cancel removes a token from the list of authorized tokens.
func (*ProofOfAuthority) DeterminePool ¶
func (poa *ProofOfAuthority) DeterminePool(chain *chain.Blockchain, candidates []crypto.Token) map[crypto.Token]int
DeterminePool returns a map of authorized tokens and their equal weight of 1.
type ProofOfStake ¶
type ProofOfStake struct {
MinimumStage uint64
}
Proof of statke implements a PoS permission interface.
func (*ProofOfStake) DeterminePool ¶
func (pos *ProofOfStake) DeterminePool(chain *chain.Blockchain, candidates []crypto.Token) map[crypto.Token]int
DeterminePool returns the autorized candidates with their respective deposits.