Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByBalance ¶
type ByBalance []*Participant
ByBalance implements sort.Interface for []Participant based on the Balance field.
type GroupsConfig ¶
type GroupsConfig struct { // GroupBalanceDiff is the maximum difference between consecutive balances GroupBalanceDiff *big.Int // MinPrivacyThreshold is the minimum number of participants in a group. MinPrivacyThreshold int64 // MinAccuracy is the minimum accuracy required for the rounding process. MinAccuracy float64 // OutliersThreshold is the z-score threshold for identifying outliers. OutliersThreshold float64 }
GroupsConfig represents the configuration for the grouping and rounding process.
var DefaultGroupsConfig GroupsConfig = GroupsConfig{ GroupBalanceDiff: big.NewInt(0), MinPrivacyThreshold: 3, MinAccuracy: 50.0, OutliersThreshold: 2.0, }
type Participant ¶
Participant represents a participant with an Ethereum address and balance.
func GroupAndRoundCensus ¶
func GroupAndRoundCensus(participants []*Participant, config GroupsConfig) ([]*Participant, float64, error)
GroupAndRoundCensus groups the participants and rounds their balances. It rounds the balances of the participants with the highest accuracy possible while maintaining a minimum privacy threshold. It discards outliers from the rounding process but returns them in the final list of participants.
Click to show internal directories.
Click to hide internal directories.