Documentation ¶
Index ¶
- Variables
- func Burn(y string, bTransfer uint64, u string, proof string) string
- func BytePadding(data []byte, length int) []byte
- func BytesCombine(pBytes ...[]byte) []byte
- func Fund(y string, b uint64) string
- func Hash(str string) *ebigint.NBigInt
- func PaddingString(in string, padding int) string
- func ProveBurn(statement BurnStatement, witness BurnWitness) string
- func ProveTransfer(statement TransferStatement, witness TransferWitness) string
- func ReadBalance(CL, CR types.Point, x *ebigint.NBigInt) int
- func Register(y string, c string, s string) string
- func Reverse(s []string) []string
- func Sign(address []byte, keypair Account) (*ebigint.NBigInt, *ebigint.NBigInt, error)
- func SignWithRandom(address []byte, keypair Account, k *ebigint.NBigInt) (*ebigint.NBigInt, *ebigint.NBigInt, error)
- func SimulateAccounts(y string, epoch uint64) string
- func Transfer(c string, d string, y string, u string, proof string) string
- type ABI_Bytes32
- type ABI_Bytes32_2
- type ABI_Bytes32_2S
- type Account
- type BN128
- func (b *BN128) B_MAX() uint
- func (b *BN128) Bytes(i *big.Int) string
- func (b *BN128) CurveG() Point
- func (b *BN128) CurveRed() *ebigint.Red
- func (b *BN128) Fq() bn256.Fq
- func (b *BN128) P() *ebigint.Red
- func (b *BN128) Q() *ebigint.Red
- func (b *BN128) RandomScalar() *ebigint.NBigInt
- func (b *BN128) Representation(p Point) string
- func (b *BN128) Serialize(p Point) types.Point
- func (b *BN128) SetSpecialRandom(r *ebigint.NBigInt)
- func (b *BN128) UnSerialize(pubkey types.Point) Point
- func (b *BN128) Zero() Point
- type BurnProof
- type BurnProver
- type BurnStatement
- type BurnWitness
- type Convolver
- func (c *Convolver) Convolution_Point(exponent *FieldVector, base *GeneratorVector) *GeneratorVector
- func (c *Convolver) Convolution_Scalar(exponent *FieldVector, base *FieldVector) *FieldVector
- func (c *Convolver) FFT_Point(input *GeneratorVector, inverse bool) *GeneratorVector
- func (c *Convolver) FFT_Scalar(input *FieldVector, inverse bool) *FieldVector
- type ETH_ADDR
- type FieldVector
- func (f *FieldVector) Add(other *FieldVector) *FieldVector
- func (f *FieldVector) Concat(other *FieldVector) *FieldVector
- func (f *FieldVector) Extract(parity int) *FieldVector
- func (f *FieldVector) Flip() *FieldVector
- func (f *FieldVector) GetVector() []*ebigint.NBigInt
- func (f *FieldVector) Hadamard(other *FieldVector) *FieldVector
- func (f *FieldVector) InnerProduct(other *FieldVector) *ebigint.NBigInt
- func (f *FieldVector) Invert() *FieldVector
- func (f *FieldVector) Length() int
- func (f *FieldVector) Negate() *FieldVector
- func (f *FieldVector) Plus(constant *ebigint.NBigInt) *FieldVector
- func (f *FieldVector) Slice(begin, end int) *FieldVector
- func (f *FieldVector) String() string
- func (f *FieldVector) Subtract(other *FieldVector) *FieldVector
- func (f *FieldVector) Sum() *ebigint.NBigInt
- func (f *FieldVector) Times(constant *ebigint.NBigInt) *FieldVector
- type FieldVectorPolynomial
- type GeneratorParams
- type GeneratorVector
- func (g *GeneratorVector) Add(other *GeneratorVector) *GeneratorVector
- func (g *GeneratorVector) Commit(exponents *FieldVector) Point
- func (g *GeneratorVector) Concat(other *GeneratorVector) *GeneratorVector
- func (g *GeneratorVector) Extract(parity int) *GeneratorVector
- func (g *GeneratorVector) GetVector() []Point
- func (g *GeneratorVector) Hadamard(exponents *FieldVector) *GeneratorVector
- func (g *GeneratorVector) Length() int
- func (g *GeneratorVector) Negate() *GeneratorVector
- func (g *GeneratorVector) Slice(begin, end int) *GeneratorVector
- func (g *GeneratorVector) String() string
- func (g *GeneratorVector) Sum() Point
- func (g *GeneratorVector) Times(constant *ebigint.NBigInt) *GeneratorVector
- type InnerProductProof
- type InnerProductProver
- type InnerProduct_statement
- type InnerProduct_witness
- type PList
- type ParseSimulateAccountsResponse
- type PedersenCommitment
- func (pc PedersenCommitment) Add(other *PedersenCommitment) *PedersenCommitment
- func (pc PedersenCommitment) Commit() Point
- func (pc PedersenCommitment) GetR() *ebigint.NBigInt
- func (pc PedersenCommitment) GetX() *ebigint.NBigInt
- func (pc PedersenCommitment) Times(exponent *ebigint.NBigInt) *PedersenCommitment
- type Point
- type PolyCommitment
- type Polynomial
- type TransferStatement
- type TransferWitness
- type ZetherProof
- type ZetherProver
Constants ¶
This section is empty.
Variables ¶
View Source
var (
FIELD_MODULUS, _ = new(big.Int).SetString("30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47", 16)
GROUP_MODULUS, _ = new(big.Int).SetString("30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001", 16)
B_MAX uint = 4294967295
)
View Source
var (
BASEPOS = 64
)
Functions ¶
func BytePadding ¶
func BytesCombine ¶
func PaddingString ¶
func ProveBurn ¶
func ProveBurn(statement BurnStatement, witness BurnWitness) string
func ProveTransfer ¶
func ProveTransfer(statement TransferStatement, witness TransferWitness) string
func SignWithRandom ¶
func SignWithRandom(address []byte, keypair Account, k *ebigint.NBigInt) (*ebigint.NBigInt, *ebigint.NBigInt, error)
just for test with special k.
func SimulateAccounts ¶ added in v0.0.5
Types ¶
type ABI_Bytes32 ¶
type ABI_Bytes32 [32]byte
type ABI_Bytes32_2 ¶
type ABI_Bytes32_2 [2][32]byte
type ABI_Bytes32_2S ¶
type ABI_Bytes32_2S [][2][32]byte
type Account ¶
func CreateAccount ¶
func CreateAccount() Account
func CreateAccountWithX ¶
func (Account) MarshalJSON ¶
func (*Account) UnmarshalJSON ¶
type BN128 ¶
func (*BN128) RandomScalar ¶
func (*BN128) Representation ¶
func (*BN128) SetSpecialRandom ¶ added in v0.0.2
for test.
type BurnProver ¶
type BurnProver struct {
// contains filtered or unexported fields
}
func NewBurnProver ¶
func NewBurnProver() BurnProver
func (BurnProver) GenerateProof ¶
func (burn BurnProver) GenerateProof(istatement BurnStatement, iwitness BurnWitness) *BurnProof
type BurnStatement ¶
type BurnWitness ¶
type Convolver ¶
type Convolver struct {
// contains filtered or unexported fields
}
func NewConvolver ¶
func NewConvolver() *Convolver
func (*Convolver) Convolution_Point ¶
func (c *Convolver) Convolution_Point(exponent *FieldVector, base *GeneratorVector) *GeneratorVector
func (*Convolver) Convolution_Scalar ¶
func (c *Convolver) Convolution_Scalar(exponent *FieldVector, base *FieldVector) *FieldVector
func (*Convolver) FFT_Point ¶
func (c *Convolver) FFT_Point(input *GeneratorVector, inverse bool) *GeneratorVector
func (*Convolver) FFT_Scalar ¶
func (c *Convolver) FFT_Scalar(input *FieldVector, inverse bool) *FieldVector
type FieldVector ¶
type FieldVector struct {
// contains filtered or unexported fields
}
func NewFieldVector ¶
func NewFieldVector(vector []*ebigint.NBigInt) *FieldVector
func (*FieldVector) Add ¶
func (f *FieldVector) Add(other *FieldVector) *FieldVector
func (*FieldVector) Concat ¶
func (f *FieldVector) Concat(other *FieldVector) *FieldVector
func (*FieldVector) Extract ¶
func (f *FieldVector) Extract(parity int) *FieldVector
func (*FieldVector) Flip ¶
func (f *FieldVector) Flip() *FieldVector
func (*FieldVector) GetVector ¶
func (f *FieldVector) GetVector() []*ebigint.NBigInt
func (*FieldVector) Hadamard ¶
func (f *FieldVector) Hadamard(other *FieldVector) *FieldVector
func (*FieldVector) InnerProduct ¶
func (f *FieldVector) InnerProduct(other *FieldVector) *ebigint.NBigInt
func (*FieldVector) Invert ¶
func (f *FieldVector) Invert() *FieldVector
func (*FieldVector) Length ¶
func (f *FieldVector) Length() int
func (*FieldVector) Negate ¶
func (f *FieldVector) Negate() *FieldVector
func (*FieldVector) Plus ¶
func (f *FieldVector) Plus(constant *ebigint.NBigInt) *FieldVector
func (*FieldVector) Slice ¶
func (f *FieldVector) Slice(begin, end int) *FieldVector
func (*FieldVector) String ¶ added in v0.0.2
func (f *FieldVector) String() string
func (*FieldVector) Subtract ¶
func (f *FieldVector) Subtract(other *FieldVector) *FieldVector
func (*FieldVector) Sum ¶
func (f *FieldVector) Sum() *ebigint.NBigInt
func (*FieldVector) Times ¶
func (f *FieldVector) Times(constant *ebigint.NBigInt) *FieldVector
type FieldVectorPolynomial ¶
type FieldVectorPolynomial struct {
// contains filtered or unexported fields
}
func NewFieldVectorPolynomial ¶
func NewFieldVectorPolynomial(coefficients ...*FieldVector) *FieldVectorPolynomial
func (*FieldVectorPolynomial) Evaluate ¶
func (f *FieldVectorPolynomial) Evaluate(x *ebigint.NBigInt) *FieldVector
func (*FieldVectorPolynomial) GetCoefficients ¶
func (f *FieldVectorPolynomial) GetCoefficients() []*FieldVector
func (*FieldVectorPolynomial) InnerProduct ¶
func (f *FieldVectorPolynomial) InnerProduct(other *FieldVectorPolynomial) []*ebigint.NBigInt
type GeneratorParams ¶
type GeneratorParams struct {
// contains filtered or unexported fields
}
func NewGeneratorParams ¶
func NewGeneratorParams(hi interface{}, gs, hs *GeneratorVector) *GeneratorParams
func (*GeneratorParams) Commit ¶
func (g *GeneratorParams) Commit(blinding *ebigint.NBigInt, gExp, hExp *FieldVector) Point
func (GeneratorParams) GetG ¶
func (g GeneratorParams) GetG() Point
func (GeneratorParams) GetGS ¶
func (g GeneratorParams) GetGS() *GeneratorVector
func (GeneratorParams) GetH ¶
func (g GeneratorParams) GetH() Point
func (GeneratorParams) GetHS ¶
func (g GeneratorParams) GetHS() *GeneratorVector
type GeneratorVector ¶
type GeneratorVector struct {
// contains filtered or unexported fields
}
func NewGeneratorVector ¶
func NewGeneratorVector(Innards []Point) *GeneratorVector
func (*GeneratorVector) Add ¶
func (g *GeneratorVector) Add(other *GeneratorVector) *GeneratorVector
func (*GeneratorVector) Commit ¶
func (g *GeneratorVector) Commit(exponents *FieldVector) Point
func (*GeneratorVector) Concat ¶
func (g *GeneratorVector) Concat(other *GeneratorVector) *GeneratorVector
func (*GeneratorVector) Extract ¶
func (g *GeneratorVector) Extract(parity int) *GeneratorVector
func (*GeneratorVector) GetVector ¶
func (g *GeneratorVector) GetVector() []Point
func (*GeneratorVector) Hadamard ¶
func (g *GeneratorVector) Hadamard(exponents *FieldVector) *GeneratorVector
func (*GeneratorVector) Length ¶
func (g *GeneratorVector) Length() int
func (*GeneratorVector) Negate ¶
func (g *GeneratorVector) Negate() *GeneratorVector
func (*GeneratorVector) Slice ¶
func (g *GeneratorVector) Slice(begin, end int) *GeneratorVector
func (*GeneratorVector) String ¶ added in v0.0.2
func (g *GeneratorVector) String() string
func (*GeneratorVector) Sum ¶
func (g *GeneratorVector) Sum() Point
func (*GeneratorVector) Times ¶
func (g *GeneratorVector) Times(constant *ebigint.NBigInt) *GeneratorVector
type InnerProductProof ¶
func (*InnerProductProof) Serialize ¶
func (i *InnerProductProof) Serialize() string
type InnerProductProver ¶
type InnerProductProver struct { }
func (InnerProductProver) GenerateProof ¶
func (t InnerProductProver) GenerateProof(statement InnerProduct_statement, witness InnerProduct_witness, salt *ebigint.NBigInt) *InnerProductProof
type InnerProduct_statement ¶
type InnerProduct_statement struct { PrimeBase *GeneratorParams P Point }
type InnerProduct_witness ¶
type InnerProduct_witness struct { L *FieldVector R *FieldVector }
type ParseSimulateAccountsResponse ¶ added in v0.0.6
func ParseSimulateAccounts ¶ added in v0.0.6
func ParseSimulateAccounts(data string) (*ParseSimulateAccountsResponse, error)
type PedersenCommitment ¶
type PedersenCommitment struct {
// contains filtered or unexported fields
}
func NewPedersenCommitment ¶
func NewPedersenCommitment(params GeneratorParams, coefficient *ebigint.NBigInt, b *ebigint.NBigInt) *PedersenCommitment
func (PedersenCommitment) Add ¶
func (pc PedersenCommitment) Add(other *PedersenCommitment) *PedersenCommitment
func (PedersenCommitment) Commit ¶
func (pc PedersenCommitment) Commit() Point
func (PedersenCommitment) GetR ¶
func (pc PedersenCommitment) GetR() *ebigint.NBigInt
func (PedersenCommitment) GetX ¶
func (pc PedersenCommitment) GetX() *ebigint.NBigInt
func (PedersenCommitment) Times ¶
func (pc PedersenCommitment) Times(exponent *ebigint.NBigInt) *PedersenCommitment
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
func MapInto ¶
utils.mapInto = (seed) => { // seed is flattened 0x + hex string
var seed_red = new BN(seed.slice(2), 16).toRed(bn128.p); var p_1_4 = bn128.curve.p.add(new BN(1)).div(new BN(4)); while (true) { var y_squared = seed_red.redPow(new BN(3)).redAdd(new BN(3).toRed(bn128.p)); var y = y_squared.redPow(p_1_4); if (y.redPow(new BN(2)).eq(y_squared)) { return bn128.curve.point(seed_red.fromRed(), y.fromRed()); } seed_red.redIAdd(new BN(1).toRed(bn128.p)); } };
seed is flattened 0x + hex string
type PolyCommitment ¶
type PolyCommitment struct {
// contains filtered or unexported fields
}
func NewPolyCommitment ¶
func NewPolyCommitment(params GeneratorParams, coefficients []*ebigint.NBigInt) *PolyCommitment
func (*PolyCommitment) Evaluate ¶
func (pc *PolyCommitment) Evaluate(x *ebigint.NBigInt) *PedersenCommitment
func (*PolyCommitment) GetCommitments ¶
func (pc *PolyCommitment) GetCommitments() []Point
type Polynomial ¶
type Polynomial struct {
// contains filtered or unexported fields
}
func NewPolynomial ¶
func NewPolynomial(coefficients []*ebigint.NBigInt) *Polynomial
func (*Polynomial) Mul ¶
func (p *Polynomial) Mul(other *Polynomial) *Polynomial
type TransferStatement ¶
type TransferStatement struct { CLn []types.Point CRn []types.Point C []types.Point D types.Point Y []types.Point Epoch int }
func (*TransferStatement) Content ¶ added in v0.0.2
func (t *TransferStatement) Content()
type TransferWitness ¶
type TransferWitness struct { BTransfer int BDiff int Index []int SK string // keypair['x'], bigInt hex string R string // random scalar, bigInt hex string }
func (*TransferWitness) Content ¶ added in v0.0.2
func (t *TransferWitness) Content()
type ZetherProof ¶
type ZetherProof struct { BA Point BS Point A Point B Point CLnG []Point CRnG []Point C_0G []Point DG []Point C_XG []Point // contains filtered or unexported fields }
func (ZetherProof) Serialize ¶
func (z ZetherProof) Serialize() string
type ZetherProver ¶
type ZetherProver struct {
// contains filtered or unexported fields
}
func NewZetherProver ¶
func NewZetherProver() ZetherProver
func (ZetherProver) GenerateProof ¶
func (this ZetherProver) GenerateProof(istatement TransferStatement, iwitness TransferWitness) *ZetherProof
func (ZetherProver) RecursivePolynomials ¶
func (this ZetherProver) RecursivePolynomials(plist *PList, accum *Polynomial, a []*ebigint.NBigInt, b []*ebigint.NBigInt)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.