Documentation ¶
Index ¶
- Variables
- func CheckProof(root, proof []byte, index uint64, pubK *babyjub.PublicKey, weight *big.Int) (bool, error)
- type Census
- func (c *Census) AddPublicKeys(pubKs []babyjub.PublicKey, weights []*big.Int) ([]arbo.Invalid, error)
- func (c *Census) Close() error
- func (c *Census) GetErrMsg() (string, error)
- func (c *Census) GetProof(pubK *babyjub.PublicKey) (uint64, []byte, error)
- func (c *Census) Info() (*Info, error)
- func (c *Census) IntermediateRoot() ([]byte, error)
- func (c *Census) IsClosed() (bool, error)
- func (c *Census) Root() ([]byte, error)
- func (c *Census) SetErrMsg(status string) error
- func (c *Census) Size() (uint64, error)
- type Info
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrCensusNotClosed is used when trying to do some action with the Census // that needs the Census to be closed ErrCensusNotClosed = errors.New("Census not closed yet") // ErrCensusClosed is used when trying to add keys to a census and the census // is already closed ErrCensusClosed = errors.New("Census closed, can not add more keys") // ErrMaxNLeafsReached is used when trying to add a number of new publicKeys // which would exceed the maximum number of keys in the census. ErrMaxNLeafsReached = fmt.Errorf("MaxNLeafs (%d) reached", types.MaxNLeafs) )
Functions ¶
Types ¶
type Census ¶
type Census struct {
// contains filtered or unexported fields
}
Census contains the MerkleTree with the PublicKeys
func (*Census) AddPublicKeys ¶
func (c *Census) AddPublicKeys(pubKs []babyjub.PublicKey, weights []*big.Int) ([]arbo.Invalid, error)
AddPublicKeys adds the batch of given PublicKeys, assigning incremental indexes to each one.
func (*Census) GetProof ¶
GetProof returns the leaf Value and the MerkleProof compressed for the given PublicKey
func (*Census) IntermediateRoot ¶
IntermediateRoot returns the CensusRoot even if the Census is not closed. WARNING: It should be used only for testing purposes.
func (*Census) IsClosed ¶
IsClosed returns true if the census is closed, and false if the census is still open
Click to show internal directories.
Click to hide internal directories.