Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a curve object. #387

Closed
jawar-cn opened this issue Jun 20, 2023 · 3 comments
Closed

How to create a curve object. #387

jawar-cn opened this issue Jun 20, 2023 · 3 comments

Comments

@jawar-cn
Copy link

I'm trying to use snarkjs in javascript .

When I new a power of tau

const zkSnark = require("snarkjs");
await zkSnark.powersOfTau.newAccumulator(curve, 14, "pot14_0000.ptau")

I really don't know how and where to get a curve object.

And I find a mothod in snarkjs named getCurveFromName which is not defined by "exports" in package.json

@phated
Copy link
Contributor

phated commented Jun 25, 2023

Curves are created when they are needed and then they are available on the global, such as globalThis.curve_bn128

@jawar-cn
Copy link
Author

I use
console.log(globalThis)
and console shows

<ref *1> Object [global] {
  global: [Circular *1],
  queueMicrotask: [Function: queueMicrotask],
  clearImmediate: [Function: clearImmediate],
  setImmediate: [Function: setImmediate] {
    [Symbol(nodejs.util.promisify.custom)]: [Getter]
  },
  structuredClone: [Getter/Setter],
  clearInterval: [Function: clearInterval],
  clearTimeout: [Function: clearTimeout],
  setInterval: [Function: setInterval],
  setTimeout: [Function: setTimeout] {
    [Symbol(nodejs.util.promisify.custom)]: [Getter]
  },
  atob: [Getter/Setter],
  btoa: [Getter/Setter],
  performance: [Getter/Setter],
  fetch: [AsyncFunction: fetch],
  crypto: [Getter],
  curve_bn128: null,
  curve_bls12381: null
}

the curve_bn128 object is null.

@OBrezhniev
Copy link
Member

Fixed in #512

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants