Documentation ¶
Index ¶
- Constants
- Variables
- func Migrate(partDB db.Accessor) error
- type Participation
- func (part Participation) Address() basics.Address
- func (part Participation) Close()
- func (part Participation) DeleteOldKeys(current basics.Round, proto config.ConsensusParams) <-chan error
- func (part Participation) GenerateRegistrationTransaction(fee basics.MicroAlgos, txnFirstValid, txnLastValid basics.Round, ...) transactions.Transaction
- func (part Participation) OverlapsInterval(first, last basics.Round) bool
- func (part Participation) Persist() error
- func (part Participation) PersistNewParent() error
- func (part Participation) VRFSecrets() *crypto.VRFSecrets
- func (part Participation) ValidInterval() (first, last basics.Round)
- func (part Participation) VotingSecrets() *crypto.OneTimeSignatureSecrets
- func (part Participation) VotingSigner() crypto.OneTimeSigner
- type ParticipationInterval
- type Root
Constants ¶
const PartTableSchemaName = "parttable"
PartTableSchemaName is the name of the table in the Schema Versions table storing the table + version details
const PartTableSchemaVersion = 2
PartTableSchemaVersion is the latest version of the PartTable schema
Variables ¶
var ErrUnsupportedSchema = fmt.Errorf("unsupported participation file schema version (expected %d)", PartTableSchemaVersion)
ErrUnsupportedSchema is the error returned when the PartTable schema version is wrong.
Functions ¶
Types ¶
type Participation ¶
type Participation struct { Parent basics.Address VRF *crypto.VRFSecrets Voting *crypto.OneTimeSignatureSecrets // The first and last rounds for which this account is valid, respectively. // // When lastValid has concluded, this set of secrets is destroyed. FirstValid basics.Round LastValid basics.Round KeyDilution uint64 Store db.Accessor }
A Participation encapsulates a set of secrets which allows a root to participate in consensus. All such accounts are associated with a parent root account via the Address (although this parent account may not be resident on this machine).
Participations are allowed to vote on a user's behalf for some range of rounds. After this range, all remaining secrets are destroyed.
For correctness, all Roots should have no more than one Participation globally active at any time. If this condition is violated, the Root may equivocate. (Algorand tolerates a limited fraction of misbehaving accounts.)
Participations handle persistence and deletion of secrets.
func FillDBWithParticipationKeys ¶
func FillDBWithParticipationKeys(store db.Accessor, address basics.Address, firstValid, lastValid basics.Round, keyDilution uint64) (part Participation, err error)
FillDBWithParticipationKeys initializes the passed database with participation keys
func RestoreParticipation ¶
func RestoreParticipation(store db.Accessor) (acc Participation, err error)
RestoreParticipation restores a Participation from a database handle.
func (Participation) Address ¶
func (part Participation) Address() basics.Address
Address returns the root account under which this participation account is registered.
func (Participation) Close ¶
func (part Participation) Close()
Close closes the underlying database handle.
func (Participation) DeleteOldKeys ¶
func (part Participation) DeleteOldKeys(current basics.Round, proto config.ConsensusParams) <-chan error
DeleteOldKeys securely deletes ephemeral keys for rounds strictly older than the given round.
func (Participation) GenerateRegistrationTransaction ¶
func (part Participation) GenerateRegistrationTransaction(fee basics.MicroAlgos, txnFirstValid, txnLastValid basics.Round, leaseBytes [32]byte, params config.ConsensusParams) transactions.Transaction
GenerateRegistrationTransaction returns a transaction object for registering a Participation with its parent.
func (Participation) OverlapsInterval ¶
func (part Participation) OverlapsInterval(first, last basics.Round) bool
OverlapsInterval returns true if the partkey is valid at all within the range of rounds (inclusive)
func (Participation) Persist ¶
func (part Participation) Persist() error
Persist writes a Participation out to a database on the disk
func (Participation) PersistNewParent ¶
func (part Participation) PersistNewParent() error
PersistNewParent writes a new parent address to the partkey database.
func (Participation) VRFSecrets ¶
func (part Participation) VRFSecrets() *crypto.VRFSecrets
VRFSecrets returns the VRF secrets associated with this Participation account.
func (Participation) ValidInterval ¶
func (part Participation) ValidInterval() (first, last basics.Round)
ValidInterval returns the first and last rounds for which this participation account is valid.
func (Participation) VotingSecrets ¶
func (part Participation) VotingSecrets() *crypto.OneTimeSignatureSecrets
VotingSecrets returns the voting secrets associated with this Participation account.
func (Participation) VotingSigner ¶
func (part Participation) VotingSigner() crypto.OneTimeSigner
VotingSigner returns the voting secrets associated with this Participation account, together with the KeyDilution value.
type ParticipationInterval ¶
type ParticipationInterval struct { basics.Address // FirstValid and LastValid are inclusive. FirstValid basics.Round LastValid basics.Round }
A ParticipationInterval defines an interval for which a participation account is valid.
type Root ¶
type Root struct {
// contains filtered or unexported fields
}
A Root encapsulates a set of secrets which controls some store of money.
A Root is authorized to spend money and create Participations for which this account is the parent.
It handles persistence and secure deletion of secrets.
func GenerateRoot ¶
GenerateRoot uses the system's source of randomness to generate an account.
func ImportRoot ¶
ImportRoot uses a provided source of randomness to instantiate an account.
func RestoreRoot ¶
RestoreRoot restores a Root from a database handle.
func (Root) Secrets ¶
func (root Root) Secrets() *crypto.SignatureSecrets
Secrets returns the signing secrets associated with the Root account.