feat: adds a patch_vk tool to add the precomputed pairing
This commit is contained in:
parent
350ccc6ee9
commit
7ba98555fd
1236
phase2/tools/patch_vk/package-lock.json
generated
Normal file
1236
phase2/tools/patch_vk/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
14
phase2/tools/patch_vk/package.json
Normal file
14
phase2/tools/patch_vk/package.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
9
phase2/tools/patch_vk/patch_vk.js
Normal file
9
phase2/tools/patch_vk/patch_vk.js
Normal file
@ -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)));
|
Loading…
Reference in New Issue
Block a user