feat: adds a patch_vk tool to add the precomputed pairing

This commit is contained in:
Kobi Gurkan 2019-10-17 13:27:38 +03:00
parent 350ccc6ee9
commit 7ba98555fd
3 changed files with 1259 additions and 0 deletions

1236
phase2/tools/patch_vk/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

@ -0,0 +1,14 @@
{
"name": "patch_vk",
"version": "1.0.0",
"description": "",
"main": "patch_vk.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"snarkjs": "^0.1.20"
}
}

@ -0,0 +1,9 @@
const fs = require('fs');
const {stringifyBigInts, unstringifyBigInts} = require('snarkjs/src/stringifybigint.js');
const BN128 = require('snarkjs/src/bn128');
const bn128 = new BN128();
const json = unstringifyBigInts(JSON.parse(fs.readFileSync('transformed_vk.json')));
json.vk_alfabeta_12 = bn128.F12.affine(bn128.pairing( json.vk_alfa_1 , json.vk_beta_2 ));
fs.writeFileSync('patched_transformed_vk.json', JSON.stringify(stringifyBigInts(json)));