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.

34 lines
1.1 KiB

  1. const {unstringifyBigInts} = require("./stringifybigint.js");
  2. const buildPKey = require("./buildpkey.js");
  3. const fs = require("fs");
  4. const version = require("../package").version;
  5. const argv = require("yargs")
  6. .version(version)
  7. .usage(`node buildpkey.js -i "proving_key.json" -o "proving_key.bin"
  8. Default: circuit.json
  9. `)
  10. .alias("i", "input")
  11. .alias("o", "output")
  12. .help("h")
  13. .alias("h", "help")
  14. .epilogue(`Copyright (C) 2018 0kims association
  15. This program comes with ABSOLUTELY NO WARRANTY;
  16. This is free software, and you are welcome to redistribute it
  17. under certain conditions; see the COPYING file in the official
  18. repo directory at https://github.com/iden3/circom `)
  19. .argv;
  20. const inputName = (argv.input) ? argv.input : "proving_key.json";
  21. const outputName = (argv.output) ? argv.output : "proving_key.bin";
  22. const provingKey = unstringifyBigInts(JSON.parse(fs.readFileSync(inputName, "utf8")));
  23. const bin = buildPKey(provingKey);
  24. var wstream = fs.createWriteStream(outputName);
  25. wstream.write(bin);
  26. wstream.end();