Documentation ¶
Index ¶
- type CensusBuilder
- func (cb *CensusBuilder) AddPublicKeys(censusID uint64, pubKs []babyjub.PublicKey, weights []*big.Int) error
- func (cb *CensusBuilder) AddPublicKeysAndStoreError(censusID uint64, pubKs []babyjub.PublicKey, weights []*big.Int)
- func (cb *CensusBuilder) CensusInfo(censusID uint64) (*census.Info, error)
- func (cb *CensusBuilder) CensusRoot(censusID uint64) ([]byte, error)
- func (cb *CensusBuilder) CloseCensus(censusID uint64) error
- func (cb *CensusBuilder) GetProof(censusID uint64, pubK *babyjub.PublicKey) (uint64, []byte, error)
- func (cb *CensusBuilder) NewCensus() (uint64, error)
- func (cb *CensusBuilder) SetErrMsg(censusID uint64, status string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CensusBuilder ¶
type CensusBuilder struct {
// contains filtered or unexported fields
}
CensusBuilder manages multiple Census MerkleTrees
func New ¶
func New(database db.Database, subDBsPath string) (*CensusBuilder, error)
New loads the CensusBuilder
func (*CensusBuilder) AddPublicKeys ¶
func (cb *CensusBuilder) AddPublicKeys(censusID uint64, pubKs []babyjub.PublicKey, weights []*big.Int) error
AddPublicKeys adds the batch of given PublicKeys to the Census for the given censusID.
func (*CensusBuilder) AddPublicKeysAndStoreError ¶
func (cb *CensusBuilder) AddPublicKeysAndStoreError(censusID uint64, pubKs []babyjub.PublicKey, weights []*big.Int)
AddPublicKeysAndStoreError will call the AddPublicKeys and if there is an error, it will store it into the DB. This method is designed to be called from a goroutine.
func (*CensusBuilder) CensusInfo ¶
func (cb *CensusBuilder) CensusInfo(censusID uint64) (*census.Info, error)
CensusInfo returns metadata about the Census for the given CensusID
func (*CensusBuilder) CensusRoot ¶
func (cb *CensusBuilder) CensusRoot(censusID uint64) ([]byte, error)
CensusRoot returns the Root of the Census if the Census is closed.
func (*CensusBuilder) CloseCensus ¶
func (cb *CensusBuilder) CloseCensus(censusID uint64) error
CloseCensus closes the Census of the given censusID.
func (*CensusBuilder) GetProof ¶
func (cb *CensusBuilder) GetProof(censusID uint64, pubK *babyjub.PublicKey) ( uint64, []byte, error)
GetProof returns the leaf Value and the MerkleProof compressed for the given PublicKey in the given CensusID
func (*CensusBuilder) NewCensus ¶
func (cb *CensusBuilder) NewCensus() (uint64, error)
NewCensus will create a new Census, if the Census already exists, will load it