You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
718 B

  1. package proof
  2. import (
  3. "math/big"
  4. "github.com/arnaucube/go-snark/bn128"
  5. "github.com/arnaucube/go-snark/circuit"
  6. "github.com/arnaucube/go-snark/fields"
  7. )
  8. // Proof is ...
  9. type Proof interface{}
  10. // Setup is ...
  11. type Setup interface {
  12. Z() []*big.Int
  13. Init(cir *circuit.Circuit, alphas, betas, gammas [][]*big.Int) error
  14. Generate(cir *circuit.Circuit, w []*big.Int, px []*big.Int) (Proof, error)
  15. Verify(p Proof, publicSignals []*big.Int) (bool, error)
  16. }
  17. // Utils is ...
  18. var Utils struct {
  19. Bn bn128.Bn128
  20. FqR fields.Fq
  21. PF fields.PF
  22. }
  23. func init() {
  24. var err error
  25. if Utils.Bn, err = bn128.NewBn128(); err != nil {
  26. panic(err)
  27. }
  28. Utils.FqR = fields.NewFq(Utils.Bn.R)
  29. Utils.PF = fields.NewPF(Utils.FqR)
  30. }