Documentation ¶
Index ¶
- Constants
- Variables
- func AggregateVerify(schemeType SchemeMPLType, pks []*G1Element, datas [][]byte, ...) (bool, error)
- func CalculatePlotFilterInput(plotID, challenge [32]byte) [32]byte
- func CalculatePosChallenge(plotID, challenge [32]byte) [32]byte
- func Hash256(data []byte) (hash [32]byte)
- func PassPlotFilter(plotID, challenge [32]byte) bool
- func Verify(schemeType SchemeMPLType, pk *G1Element, data []byte, signature *G2Element) (bool, error)
- type AugSchemeMPL
- func (s *AugSchemeMPL) Aggregate(signatures ...*G2Element) (*G2Element, error)
- func (s *AugSchemeMPL) AggregateVerify(pks []*G1Element, datas [][]byte, signature *G2Element) (bool, error)
- func (s *AugSchemeMPL) DeriveChildPkUnhardened(pk *G1Element, index int) (*G1Element, error)
- func (s *AugSchemeMPL) DeriveChildSk(sk *PrivateKey, index int) (*PrivateKey, error)
- func (s *AugSchemeMPL) DeriveChildSkUnhardened(sk *PrivateKey, index int) (*PrivateKey, error)
- func (s *AugSchemeMPL) KeyGen(seed []byte) (*PrivateKey, error)
- func (s *AugSchemeMPL) Sign(sk *PrivateKey, data []byte) (*G2Element, error)
- func (s *AugSchemeMPL) SignPrepend(sk *PrivateKey, data []byte, pk *G1Element) (*G2Element, error)
- func (s *AugSchemeMPL) SkToG1(sk *PrivateKey) (*G1Element, error)
- func (s *AugSchemeMPL) Verify(pk *G1Element, data []byte, signature *G2Element) (bool, error)
- type BasicSchemeMPL
- func (s *BasicSchemeMPL) Aggregate(signatures ...*G2Element) (*G2Element, error)
- func (s *BasicSchemeMPL) AggregateVerify(pks []*G1Element, datas [][]byte, signature *G2Element) (bool, error)
- func (s *BasicSchemeMPL) DeriveChildPkUnhardened(pk *G1Element, index int) (*G1Element, error)
- func (s *BasicSchemeMPL) DeriveChildSk(sk *PrivateKey, index int) (*PrivateKey, error)
- func (s *BasicSchemeMPL) DeriveChildSkUnhardened(sk *PrivateKey, index int) (*PrivateKey, error)
- func (s *BasicSchemeMPL) KeyGen(seed []byte) (*PrivateKey, error)
- func (s *BasicSchemeMPL) Sign(sk *PrivateKey, data []byte) (*G2Element, error)
- func (s *BasicSchemeMPL) SkToG1(sk *PrivateKey) (*G1Element, error)
- func (s *BasicSchemeMPL) Verify(pk *G1Element, data []byte, signature *G2Element) (bool, error)
- type DiskPlotter
- type DiskProver
- func (dp *DiskProver) Close() error
- func (dp *DiskProver) Filename() string
- func (dp *DiskProver) GetFullProof(challenge [32]byte, index uint32) ([]byte, error)
- func (dp *DiskProver) GetQualitiesForChallenge(challenge [32]byte) ([][]byte, error)
- func (dp *DiskProver) ID() [32]byte
- func (dp *DiskProver) Memo() []byte
- func (dp *DiskProver) PlotInfo() *PlotInfo
- func (dp *DiskProver) Size() uint8
- type G1Element
- func DeriveChildPkUnhardened(schemeType SchemeMPLType, pk *G1Element, index int) (*G1Element, error)
- func NewG1Element() *G1Element
- func NewG1ElementFromBytes(bytes []byte) (*G1Element, error)
- func NewG1ElementGenerator() *G1Element
- func SkToG1(schemeType SchemeMPLType, sk *PrivateKey) (*G1Element, error)
- type G2Element
- func AggregateSignatures(schemeType SchemeMPLType, signatures ...*G2Element) (*G2Element, error)
- func NewG2Element() *G2Element
- func NewG2ElementFromBytes(bytes []byte) (*G2Element, error)
- func NewG2ElementGenerator() *G2Element
- func Sign(schemeType SchemeMPLType, sk *PrivateKey, data []byte) (*G2Element, error)
- type PlotInfo
- type PopSchemeMPL
- func (s *PopSchemeMPL) Aggregate(signatures ...*G2Element) (*G2Element, error)
- func (s *PopSchemeMPL) AggregateVerify(pks []*G1Element, datas [][]byte, signature *G2Element) (bool, error)
- func (s *PopSchemeMPL) DeriveChildPkUnhardened(pk *G1Element, index int) (*G1Element, error)
- func (s *PopSchemeMPL) DeriveChildSk(sk *PrivateKey, index int) (*PrivateKey, error)
- func (s *PopSchemeMPL) DeriveChildSkUnhardened(sk *PrivateKey, index int) (*PrivateKey, error)
- func (s *PopSchemeMPL) FastAggregateVerify(pks []*G1Element, data []byte, signature *G2Element) (bool, error)
- func (s *PopSchemeMPL) KeyGen(seed []byte) (*PrivateKey, error)
- func (s *PopSchemeMPL) PopProve(sk *PrivateKey) (*G2Element, error)
- func (s *PopSchemeMPL) PopVerify(pk *G1Element, signature *G2Element) (bool, error)
- func (s *PopSchemeMPL) Sign(sk *PrivateKey, data []byte) (*G2Element, error)
- func (s *PopSchemeMPL) SkToG1(sk *PrivateKey) (*G1Element, error)
- func (s *PopSchemeMPL) Verify(pk *G1Element, data []byte, signature *G2Element) (bool, error)
- type PrivateKey
- func AggregatePrivateKey(sks ...*PrivateKey) (*PrivateKey, error)
- func AugDerivePath(master *PrivateKey, paths []int) (key *PrivateKey, err error)
- func DeriveChildSk(schemeType SchemeMPLType, unhardened bool, sk *PrivateKey, index int) (*PrivateKey, error)
- func KeyGen(schemeType SchemeMPLType, seed []byte) (*PrivateKey, error)
- func MasterSkToFarmerSk(master *PrivateKey) (*PrivateKey, error)
- func MasterSkToLocalSk(master *PrivateKey) (*PrivateKey, error)
- func MasterSkToPoolSk(master *PrivateKey) (*PrivateKey, error)
- func NewPrivateKeyFromBytes(bytes []byte) (*PrivateKey, error)
- type ProofOfSpace
- type ProofVerifier
- type SchemeMPLType
Constants ¶
View Source
const ( MinPlotSize = 32 MaxPlotSize = 50 )
View Source
const ( // PrivateKeyBytes is the length of a BLS private key PrivateKeyBytes = 32 // PublicKeyBytes is the length of a BLS public key PublicKeyBytes = 48 // SignatureBytes is the length of a BLS signature SignatureBytes = 96 )
Variables ¶
View Source
var ZeroID = [32]byte{}
Functions ¶
func AggregateVerify ¶
func CalculatePosChallenge ¶
func PassPlotFilter ¶
Types ¶
type AugSchemeMPL ¶
type AugSchemeMPL struct{}
func NewAugSchemeMPL ¶
func NewAugSchemeMPL() *AugSchemeMPL
func (*AugSchemeMPL) Aggregate ¶
func (s *AugSchemeMPL) Aggregate(signatures ...*G2Element) (*G2Element, error)
func (*AugSchemeMPL) AggregateVerify ¶
func (*AugSchemeMPL) DeriveChildPkUnhardened ¶
func (s *AugSchemeMPL) DeriveChildPkUnhardened(pk *G1Element, index int) (*G1Element, error)
func (*AugSchemeMPL) DeriveChildSk ¶
func (s *AugSchemeMPL) DeriveChildSk(sk *PrivateKey, index int) (*PrivateKey, error)
func (*AugSchemeMPL) DeriveChildSkUnhardened ¶
func (s *AugSchemeMPL) DeriveChildSkUnhardened(sk *PrivateKey, index int) (*PrivateKey, error)
func (*AugSchemeMPL) KeyGen ¶
func (s *AugSchemeMPL) KeyGen(seed []byte) (*PrivateKey, error)
func (*AugSchemeMPL) Sign ¶
func (s *AugSchemeMPL) Sign(sk *PrivateKey, data []byte) (*G2Element, error)
func (*AugSchemeMPL) SignPrepend ¶
func (s *AugSchemeMPL) SignPrepend(sk *PrivateKey, data []byte, pk *G1Element) (*G2Element, error)
func (*AugSchemeMPL) SkToG1 ¶
func (s *AugSchemeMPL) SkToG1(sk *PrivateKey) (*G1Element, error)
type BasicSchemeMPL ¶
type BasicSchemeMPL struct{}
func NewBasicSchemeMPL ¶
func NewBasicSchemeMPL() *BasicSchemeMPL
func (*BasicSchemeMPL) Aggregate ¶
func (s *BasicSchemeMPL) Aggregate(signatures ...*G2Element) (*G2Element, error)
func (*BasicSchemeMPL) AggregateVerify ¶
func (*BasicSchemeMPL) DeriveChildPkUnhardened ¶
func (s *BasicSchemeMPL) DeriveChildPkUnhardened(pk *G1Element, index int) (*G1Element, error)
func (*BasicSchemeMPL) DeriveChildSk ¶
func (s *BasicSchemeMPL) DeriveChildSk(sk *PrivateKey, index int) (*PrivateKey, error)
func (*BasicSchemeMPL) DeriveChildSkUnhardened ¶
func (s *BasicSchemeMPL) DeriveChildSkUnhardened(sk *PrivateKey, index int) (*PrivateKey, error)
func (*BasicSchemeMPL) KeyGen ¶
func (s *BasicSchemeMPL) KeyGen(seed []byte) (*PrivateKey, error)
func (*BasicSchemeMPL) Sign ¶
func (s *BasicSchemeMPL) Sign(sk *PrivateKey, data []byte) (*G2Element, error)
func (*BasicSchemeMPL) SkToG1 ¶
func (s *BasicSchemeMPL) SkToG1(sk *PrivateKey) (*G1Element, error)
SkToG1 return PublicKey
type DiskPlotter ¶
type DiskPlotter struct {
// contains filtered or unexported fields
}
func NewDiskPlotter ¶
func NewDiskPlotter() (*DiskPlotter, error)
func (*DiskPlotter) Close ¶
func (p *DiskPlotter) Close() error
func (*DiskPlotter) CreatePlotDisk ¶
type DiskProver ¶
type DiskProver struct {
// contains filtered or unexported fields
}
func NewDiskProver ¶
func NewDiskProver(filename string, loadPlotInfo bool) (*DiskProver, error)
func (*DiskProver) Close ¶
func (dp *DiskProver) Close() error
func (*DiskProver) Filename ¶
func (dp *DiskProver) Filename() string
func (*DiskProver) GetFullProof ¶
func (dp *DiskProver) GetFullProof(challenge [32]byte, index uint32) ([]byte, error)
func (*DiskProver) GetQualitiesForChallenge ¶
func (dp *DiskProver) GetQualitiesForChallenge(challenge [32]byte) ([][]byte, error)
func (*DiskProver) ID ¶
func (dp *DiskProver) ID() [32]byte
func (*DiskProver) Memo ¶
func (dp *DiskProver) Memo() []byte
func (*DiskProver) PlotInfo ¶
func (dp *DiskProver) PlotInfo() *PlotInfo
func (*DiskProver) Size ¶
func (dp *DiskProver) Size() uint8
type G1Element ¶
type G1Element [PublicKeyBytes]byte
func DeriveChildPkUnhardened ¶
func DeriveChildPkUnhardened(schemeType SchemeMPLType, pk *G1Element, index int) (*G1Element, error)
func NewG1ElementFromBytes ¶
func NewG1ElementGenerator ¶
func NewG1ElementGenerator() *G1Element
func SkToG1 ¶
func SkToG1(schemeType SchemeMPLType, sk *PrivateKey) (*G1Element, error)
func (*G1Element) SerializeCompressed ¶
func (*G1Element) SerializeUncompressed ¶
no difference with SerializeCompressed
type G2Element ¶
type G2Element [SignatureBytes]byte
func AggregateSignatures ¶
func AggregateSignatures(schemeType SchemeMPLType, signatures ...*G2Element) (*G2Element, error)
func NewG2ElementFromBytes ¶
func NewG2ElementGenerator ¶
func NewG2ElementGenerator() *G2Element
func Sign ¶
func Sign(schemeType SchemeMPLType, sk *PrivateKey, data []byte) (*G2Element, error)
type PlotInfo ¶
type PlotInfo struct { PoolPublicKey *G1Element PuzzleHash [32]byte FarmerPublicKey *G1Element MasterSk *PrivateKey LocalSk *PrivateKey PlotPublicKey *G1Element }
type PopSchemeMPL ¶
type PopSchemeMPL struct{}
func NewPopSchemeMPL ¶
func NewPopSchemeMPL() *PopSchemeMPL
func (*PopSchemeMPL) Aggregate ¶
func (s *PopSchemeMPL) Aggregate(signatures ...*G2Element) (*G2Element, error)
func (*PopSchemeMPL) AggregateVerify ¶
func (*PopSchemeMPL) DeriveChildPkUnhardened ¶
func (s *PopSchemeMPL) DeriveChildPkUnhardened(pk *G1Element, index int) (*G1Element, error)
func (*PopSchemeMPL) DeriveChildSk ¶
func (s *PopSchemeMPL) DeriveChildSk(sk *PrivateKey, index int) (*PrivateKey, error)
func (*PopSchemeMPL) DeriveChildSkUnhardened ¶
func (s *PopSchemeMPL) DeriveChildSkUnhardened(sk *PrivateKey, index int) (*PrivateKey, error)
func (*PopSchemeMPL) FastAggregateVerify ¶
func (*PopSchemeMPL) KeyGen ¶
func (s *PopSchemeMPL) KeyGen(seed []byte) (*PrivateKey, error)
func (*PopSchemeMPL) PopProve ¶
func (s *PopSchemeMPL) PopProve(sk *PrivateKey) (*G2Element, error)
func (*PopSchemeMPL) PopVerify ¶
func (s *PopSchemeMPL) PopVerify(pk *G1Element, signature *G2Element) (bool, error)
func (*PopSchemeMPL) Sign ¶
func (s *PopSchemeMPL) Sign(sk *PrivateKey, data []byte) (*G2Element, error)
func (*PopSchemeMPL) SkToG1 ¶
func (s *PopSchemeMPL) SkToG1(sk *PrivateKey) (*G1Element, error)
type PrivateKey ¶
type PrivateKey [PrivateKeyBytes]byte
func AggregatePrivateKey ¶
func AggregatePrivateKey(sks ...*PrivateKey) (*PrivateKey, error)
func AugDerivePath ¶
func AugDerivePath(master *PrivateKey, paths []int) (key *PrivateKey, err error)
func DeriveChildSk ¶
func DeriveChildSk(schemeType SchemeMPLType, unhardened bool, sk *PrivateKey, index int) (*PrivateKey, error)
TODO: check param
func KeyGen ¶
func KeyGen(schemeType SchemeMPLType, seed []byte) (*PrivateKey, error)
func MasterSkToFarmerSk ¶
func MasterSkToFarmerSk(master *PrivateKey) (*PrivateKey, error)
func MasterSkToLocalSk ¶
func MasterSkToLocalSk(master *PrivateKey) (*PrivateKey, error)
func MasterSkToPoolSk ¶
func MasterSkToPoolSk(master *PrivateKey) (*PrivateKey, error)
func NewPrivateKeyFromBytes ¶
func NewPrivateKeyFromBytes(bytes []byte) (*PrivateKey, error)
func (*PrivateKey) Bytes ¶
func (k *PrivateKey) Bytes() []byte
func (*PrivateKey) Copy ¶
func (k *PrivateKey) Copy() *PrivateKey
func (*PrivateKey) Equals ¶
func (k *PrivateKey) Equals(target *PrivateKey) bool
func (*PrivateKey) GetG1 ¶
func (k *PrivateKey) GetG1() (*G1Element, error)
type ProofOfSpace ¶
type ProofOfSpace struct { Challenge [32]byte PoolPublicKey *G1Element PuzzleHash [32]byte PlotPublicKey *G1Element KSize uint8 Proof []byte }
func (*ProofOfSpace) Decode ¶
func (pos *ProofOfSpace) Decode(data []byte) (err error)
func (*ProofOfSpace) Encode ¶
func (pos *ProofOfSpace) Encode() []byte
func (*ProofOfSpace) GetID ¶
func (pos *ProofOfSpace) GetID() ([32]byte, error)
func (*ProofOfSpace) GetQuality ¶
func (pos *ProofOfSpace) GetQuality() ([]byte, error)
func (*ProofOfSpace) GetVerifiedQuality ¶
func (pos *ProofOfSpace) GetVerifiedQuality(challenge [32]byte) ([]byte, error)
type ProofVerifier ¶
type ProofVerifier struct {
// contains filtered or unexported fields
}
func NewProofVerifier ¶
func NewProofVerifier() *ProofVerifier
func (*ProofVerifier) Free ¶
func (pv *ProofVerifier) Free()
func (*ProofVerifier) GetVerifiedQuality ¶
type SchemeMPLType ¶
type SchemeMPLType int
const ( SchemeMPLBasic SchemeMPLType = 1 + iota SchemeMPLAug SchemeMPLPop )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.