diff --git a/.gitignore b/.gitignore
index aea8ef9b..5d561b6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,3 +68,5 @@ tmp
.DS_Store
stats.html
+
+sophia_smart_contract_tests/contracts
diff --git a/build/browser.esm.js b/build/browser.esm.js
index a7c592d4..b2efa01b 100644
--- a/build/browser.esm.js
+++ b/build/browser.esm.js
@@ -3886,10 +3886,10 @@ class WitnessCalculatorCircom2 {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
-const { unstringifyBigInts: unstringifyBigInts$b} = utils;
+const { unstringifyBigInts: unstringifyBigInts$c} = utils;
async function wtnsCalculate(_input, wasmFileName, wtnsFileName, options) {
- const input = unstringifyBigInts$b(_input);
+ const input = unstringifyBigInts$c(_input);
const fdWasm = await readExisting(wasmFileName);
const wasm = await fdWasm.read(fdWasm.totalSize);
@@ -3931,10 +3931,10 @@ async function wtnsCalculate(_input, wasmFileName, wtnsFileName, options) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
-const {unstringifyBigInts: unstringifyBigInts$a} = utils;
+const {unstringifyBigInts: unstringifyBigInts$b} = utils;
async function groth16FullProve(_input, wasmFile, zkeyFileName, logger) {
- const input = unstringifyBigInts$a(_input);
+ const input = unstringifyBigInts$b(_input);
const wtns= {
type: "mem"
@@ -3961,7 +3961,7 @@ async function groth16FullProve(_input, wasmFile, zkeyFileName, logger) {
You should have received a copy of the GNU General Public License along with
snarkjs. If not, see .
*/
-const {unstringifyBigInts: unstringifyBigInts$9} = utils;
+const {unstringifyBigInts: unstringifyBigInts$a} = utils;
async function groth16Verify(_vk_verifier, _publicSignals, _proof, logger) {
/*
@@ -3971,9 +3971,9 @@ async function groth16Verify(_vk_verifier, _publicSignals, _proof, logger) {
}
*/
- const vk_verifier = unstringifyBigInts$9(_vk_verifier);
- const proof = unstringifyBigInts$9(_proof);
- const publicSignals = unstringifyBigInts$9(_publicSignals);
+ const vk_verifier = unstringifyBigInts$a(_vk_verifier);
+ const proof = unstringifyBigInts$a(_proof);
+ const publicSignals = unstringifyBigInts$a(_publicSignals);
const curve = await getCurveFromName(vk_verifier.curve);
@@ -4062,7 +4062,7 @@ function publicInputsAreValid$1(curve, publicInputs) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
-const { unstringifyBigInts: unstringifyBigInts$8} = utils;
+const { unstringifyBigInts: unstringifyBigInts$9} = utils;
function p256$2(n) {
let nstr = n.toString(16);
@@ -4072,8 +4072,8 @@ function p256$2(n) {
}
async function groth16ExportSolidityCallData(_proof, _pub) {
- const proof = unstringifyBigInts$8(_proof);
- const pub = unstringifyBigInts$8(_pub);
+ const proof = unstringifyBigInts$9(_proof);
+ const pub = unstringifyBigInts$9(_pub);
let inputs = "";
for (let i=0; i.
+*/
+const { unstringifyBigInts: unstringifyBigInts$8 } = utils;
+
+function cli_n(n) {
+ let nstr = n.toString(16);
+ return `0x${nstr}`;
+}
+
+function sdk_n(n) {
+ let nstr = n.toString(10);
+ return `${nstr}n`;
+}
+
+async function groth16ExportSophiaCalldata(_proof, _pub, type) {
+ const proof = unstringifyBigInts$8(_proof);
+ const pub = unstringifyBigInts$8(_pub);
+
+
+ let S;
+
+ if (type == "cli") {
+ let inputs = "";
+ for (let i=0; i.
*/
-const {unstringifyBigInts: unstringifyBigInts$b, stringifyBigInts: stringifyBigInts$4} = ffjavascript.utils;
+const {unstringifyBigInts: unstringifyBigInts$c, stringifyBigInts: stringifyBigInts$4} = ffjavascript.utils;
async function fflonkExportSolidityVerifier(vk, templates, logger) {
if (logger) logger.info("FFLONK EXPORT SOLIDITY VERIFIER STARTED");
@@ -5562,7 +5577,7 @@ async function fflonkExportSolidityVerifier(vk, templates, logger) {
return ejs__default["default"].render(template, vk);
function fromVkey(str) {
- const val = unstringifyBigInts$b(str);
+ const val = unstringifyBigInts$c(str);
return curve.Fr.fromObject(val);
}
@@ -6062,10 +6077,10 @@ async function joinABC(curve, zkey, a, b, c, logger) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
-const { unstringifyBigInts: unstringifyBigInts$a} = ffjavascript.utils;
+const { unstringifyBigInts: unstringifyBigInts$b} = ffjavascript.utils;
async function wtnsCalculate$1(_input, wasmFileName, wtnsFileName, options) {
- const input = unstringifyBigInts$a(_input);
+ const input = unstringifyBigInts$b(_input);
const fdWasm = await fastFile__namespace.readExisting(wasmFileName);
const wasm = await fdWasm.read(fdWasm.totalSize);
@@ -6107,10 +6122,10 @@ async function wtnsCalculate$1(_input, wasmFileName, wtnsFileName, options) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
-const {unstringifyBigInts: unstringifyBigInts$9} = ffjavascript.utils;
+const {unstringifyBigInts: unstringifyBigInts$a} = ffjavascript.utils;
async function groth16FullProve$1(_input, wasmFile, zkeyFileName, logger) {
- const input = unstringifyBigInts$9(_input);
+ const input = unstringifyBigInts$a(_input);
const wtns= {
type: "mem"
@@ -6137,7 +6152,7 @@ async function groth16FullProve$1(_input, wasmFile, zkeyFileName, logger) {
You should have received a copy of the GNU General Public License along with
snarkjs. If not, see .
*/
-const {unstringifyBigInts: unstringifyBigInts$8} = ffjavascript.utils;
+const {unstringifyBigInts: unstringifyBigInts$9} = ffjavascript.utils;
async function groth16Verify$1(_vk_verifier, _publicSignals, _proof, logger) {
/*
@@ -6147,9 +6162,9 @@ async function groth16Verify$1(_vk_verifier, _publicSignals, _proof, logger) {
}
*/
- const vk_verifier = unstringifyBigInts$8(_vk_verifier);
- const proof = unstringifyBigInts$8(_proof);
- const publicSignals = unstringifyBigInts$8(_publicSignals);
+ const vk_verifier = unstringifyBigInts$9(_vk_verifier);
+ const proof = unstringifyBigInts$9(_proof);
+ const publicSignals = unstringifyBigInts$9(_publicSignals);
const curve = await getCurveFromName(vk_verifier.curve);
@@ -6238,7 +6253,7 @@ function publicInputsAreValid$1(curve, publicInputs) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
-const { unstringifyBigInts: unstringifyBigInts$7} = ffjavascript.utils;
+const { unstringifyBigInts: unstringifyBigInts$8} = ffjavascript.utils;
function p256$2(n) {
let nstr = n.toString(16);
@@ -6248,8 +6263,8 @@ function p256$2(n) {
}
async function groth16ExportSolidityCallData(_proof, _pub) {
- const proof = unstringifyBigInts$7(_proof);
- const pub = unstringifyBigInts$7(_pub);
+ const proof = unstringifyBigInts$8(_proof);
+ const pub = unstringifyBigInts$8(_pub);
let inputs = "";
for (let i=0; i.
+*/
+const { unstringifyBigInts: unstringifyBigInts$7 } = ffjavascript.utils;
+
+function cli_n(n) {
+ let nstr = n.toString(16);
+ return `0x${nstr}`;
+}
+
+function sdk_n(n) {
+ let nstr = n.toString(10);
+ return `${nstr}n`;
+}
+
+async function groth16ExportSophiaCalldata(_proof, _pub, type) {
+ const proof = unstringifyBigInts$7(_proof);
+ const pub = unstringifyBigInts$7(_pub);
+
+
+ let S;
+
+ if (type == "cli") {
+ let inputs = "";
+ for (let i=0; i
async function zkeyExportSolidityCalldata(params, options) {
@@ -13131,6 +13282,40 @@ async function zkeyExportSolidityCalldata(params, options) {
return 0;
}
+// sophia gencall
+async function zkeyExportSophiaCalldata(params, options) {
+ let publicName;
+ let proofName;
+
+ if (params.length < 1) {
+ publicName = "public.json";
+ } else {
+ publicName = params[0];
+ }
+
+ if (params.length < 2) {
+ proofName = "proof.json";
+ } else {
+ proofName = params[1];
+ }
+
+ let type = "sdk";
+ if (options.cli) type = "cli";
+
+ const pub = JSON.parse(fs__default["default"].readFileSync(publicName, "utf8"));
+ const proof = JSON.parse(fs__default["default"].readFileSync(proofName, "utf8"));
+
+ let res;
+ if (proof.protocol == "groth16") {
+ res = await groth16ExportSophiaCalldata(proof, pub, type);
+ } else {
+ throw new Error("Invalid Protocol");
+ }
+ console.log(res);
+
+ return 0;
+}
+
// powersoftau new [powersoftau_0000.ptau]",
async function powersOfTauNew(params, options) {
let curveName;
diff --git a/build/main.cjs b/build/main.cjs
index deeb7fb5..d964980e 100644
--- a/build/main.cjs
+++ b/build/main.cjs
@@ -1245,10 +1245,10 @@ async function joinABC(curve, zkey, a, b, c, logger) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
-const { unstringifyBigInts: unstringifyBigInts$b} = ffjavascript.utils;
+const { unstringifyBigInts: unstringifyBigInts$c} = ffjavascript.utils;
async function wtnsCalculate(_input, wasmFileName, wtnsFileName, options) {
- const input = unstringifyBigInts$b(_input);
+ const input = unstringifyBigInts$c(_input);
const fdWasm = await fastFile__namespace.readExisting(wasmFileName);
const wasm = await fdWasm.read(fdWasm.totalSize);
@@ -1290,10 +1290,10 @@ async function wtnsCalculate(_input, wasmFileName, wtnsFileName, options) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
-const {unstringifyBigInts: unstringifyBigInts$a} = ffjavascript.utils;
+const {unstringifyBigInts: unstringifyBigInts$b} = ffjavascript.utils;
async function groth16FullProve(_input, wasmFile, zkeyFileName, logger) {
- const input = unstringifyBigInts$a(_input);
+ const input = unstringifyBigInts$b(_input);
const wtns= {
type: "mem"
@@ -1320,7 +1320,7 @@ async function groth16FullProve(_input, wasmFile, zkeyFileName, logger) {
You should have received a copy of the GNU General Public License along with
snarkjs. If not, see .
*/
-const {unstringifyBigInts: unstringifyBigInts$9} = ffjavascript.utils;
+const {unstringifyBigInts: unstringifyBigInts$a} = ffjavascript.utils;
async function groth16Verify(_vk_verifier, _publicSignals, _proof, logger) {
/*
@@ -1330,9 +1330,9 @@ async function groth16Verify(_vk_verifier, _publicSignals, _proof, logger) {
}
*/
- const vk_verifier = unstringifyBigInts$9(_vk_verifier);
- const proof = unstringifyBigInts$9(_proof);
- const publicSignals = unstringifyBigInts$9(_publicSignals);
+ const vk_verifier = unstringifyBigInts$a(_vk_verifier);
+ const proof = unstringifyBigInts$a(_proof);
+ const publicSignals = unstringifyBigInts$a(_publicSignals);
const curve = await getCurveFromName(vk_verifier.curve);
@@ -1421,7 +1421,7 @@ function publicInputsAreValid$1(curve, publicInputs) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
-const { unstringifyBigInts: unstringifyBigInts$8} = ffjavascript.utils;
+const { unstringifyBigInts: unstringifyBigInts$9} = ffjavascript.utils;
function p256$2(n) {
let nstr = n.toString(16);
@@ -1431,8 +1431,8 @@ function p256$2(n) {
}
async function groth16ExportSolidityCallData(_proof, _pub) {
- const proof = unstringifyBigInts$8(_proof);
- const pub = unstringifyBigInts$8(_pub);
+ const proof = unstringifyBigInts$9(_proof);
+ const pub = unstringifyBigInts$9(_pub);
let inputs = "";
for (let i=0; i.
+*/
+const { unstringifyBigInts: unstringifyBigInts$8 } = ffjavascript.utils;
+
+function cli_n(n) {
+ let nstr = n.toString(16);
+ return `0x${nstr}`;
+}
+
+function sdk_n(n) {
+ let nstr = n.toString(10);
+ return `${nstr}n`;
+}
+
+async function groth16ExportSophiaCalldata(_proof, _pub, type) {
+ const proof = unstringifyBigInts$8(_proof);
+ const pub = unstringifyBigInts$8(_pub);
+
+
+ let S;
+
+ if (type == "cli") {
+ let inputs = "";
+ for (let i=0; i {
- res[k] = unstringifyBigInts$c(o[k]);
+ res[k] = unstringifyBigInts$d(o[k]);
});
return res;
} else {
@@ -12689,7 +12689,7 @@ var snarkjs = (function (exports) {
log2: log2$4,
stringifyBigInts: stringifyBigInts$5,
stringifyFElements: stringifyFElements,
- unstringifyBigInts: unstringifyBigInts$c,
+ unstringifyBigInts: unstringifyBigInts$d,
unstringifyFElements: unstringifyFElements
});
@@ -33846,10 +33846,10 @@ var snarkjs = (function (exports) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
- const { unstringifyBigInts: unstringifyBigInts$b} = utils$7;
+ const { unstringifyBigInts: unstringifyBigInts$c} = utils$7;
async function wtnsCalculate(_input, wasmFileName, wtnsFileName, options) {
- const input = unstringifyBigInts$b(_input);
+ const input = unstringifyBigInts$c(_input);
const fdWasm = await readExisting(wasmFileName);
const wasm = await fdWasm.read(fdWasm.totalSize);
@@ -33891,10 +33891,10 @@ var snarkjs = (function (exports) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
- const {unstringifyBigInts: unstringifyBigInts$a} = utils$7;
+ const {unstringifyBigInts: unstringifyBigInts$b} = utils$7;
async function groth16FullProve(_input, wasmFile, zkeyFileName, logger) {
- const input = unstringifyBigInts$a(_input);
+ const input = unstringifyBigInts$b(_input);
const wtns= {
type: "mem"
@@ -33921,7 +33921,7 @@ var snarkjs = (function (exports) {
You should have received a copy of the GNU General Public License along with
snarkjs. If not, see .
*/
- const {unstringifyBigInts: unstringifyBigInts$9} = utils$7;
+ const {unstringifyBigInts: unstringifyBigInts$a} = utils$7;
async function groth16Verify(_vk_verifier, _publicSignals, _proof, logger) {
/*
@@ -33931,9 +33931,9 @@ var snarkjs = (function (exports) {
}
*/
- const vk_verifier = unstringifyBigInts$9(_vk_verifier);
- const proof = unstringifyBigInts$9(_proof);
- const publicSignals = unstringifyBigInts$9(_publicSignals);
+ const vk_verifier = unstringifyBigInts$a(_vk_verifier);
+ const proof = unstringifyBigInts$a(_proof);
+ const publicSignals = unstringifyBigInts$a(_publicSignals);
const curve = await getCurveFromName(vk_verifier.curve);
@@ -34022,7 +34022,7 @@ var snarkjs = (function (exports) {
You should have received a copy of the GNU General Public License
along with snarkJS. If not, see .
*/
- const { unstringifyBigInts: unstringifyBigInts$8} = utils$7;
+ const { unstringifyBigInts: unstringifyBigInts$9} = utils$7;
function p256$2(n) {
let nstr = n.toString(16);
@@ -34032,8 +34032,8 @@ var snarkjs = (function (exports) {
}
async function groth16ExportSolidityCallData(_proof, _pub) {
- const proof = unstringifyBigInts$8(_proof);
- const pub = unstringifyBigInts$8(_pub);
+ const proof = unstringifyBigInts$9(_proof);
+ const pub = unstringifyBigInts$9(_pub);
let inputs = "";
for (let i=0; i.
+ */
+ const { unstringifyBigInts: unstringifyBigInts$8 } = utils$7;
+
+ function cli_n(n) {
+ let nstr = n.toString(16);
+ return `0x${nstr}`;
+ }
+
+ function sdk_n(n) {
+ let nstr = n.toString(10);
+ return `${nstr}n`;
+ }
+
+ async function groth16ExportSophiaCalldata(_proof, _pub, type) {
+ const proof = unstringifyBigInts$8(_proof);
+ const pub = unstringifyBigInts$8(_pub);
+
+
+ let S;
+
+ if (type == "cli") {
+ let inputs = "";
+ for (let i=0; i