@ -47,7 +47,7 @@ function hash(message: any): bigint {
for ( let k = 0 ; k < 2 ; k ++ ) {
for ( let k = 0 ; k < 2 ; k ++ ) {
const identityTrapdoor = BigInt ( ethers . utils . hexlify ( ethers . utils . randomBytes ( 32 ) ) )
const identityTrapdoor = BigInt ( ethers . utils . hexlify ( ethers . utils . randomBytes ( 32 ) ) )
const identityNullifier = BigInt ( ethers . utils . hexlify ( ethers . utils . randomBytes ( 32 ) ) )
const identityNullifier = BigInt ( ethers . utils . hexlify ( ethers . utils . randomBytes ( 32 ) ) )
secrets . push ( { identityTrapdoor , identityNullifier } )
secrets . push ( { identityTrapdoor , identityNullifier } )
const secret = poseidon ( [ identityNullifier , identityTrapdoor ] )
const secret = poseidon ( [ identityNullifier , identityTrapdoor ] )
const identityCommitment = poseidon ( [ secret ] )
const identityCommitment = poseidon ( [ secret ] )
@ -86,7 +86,6 @@ function hash(message: any): bigint {
console . log ( 'check' )
console . log ( 'check' )
await snarkjs . wtns . check ( r1cs , wtns , logger ) ;
await snarkjs . wtns . check ( r1cs , wtns , logger ) ;
console . log ( 'prove' )
console . log ( 'prove' )
const { proof , publicSignals } = await snarkjs . groth16 . prove ( zkey_final , wtns ) ;
const { proof , publicSignals } = await snarkjs . groth16 . prove ( zkey_final , wtns ) ;
@ -94,8 +93,6 @@ function hash(message: any): bigint {
console . log ( 'zk proof validity' , verified ) ;
console . log ( 'zk proof validity' , verified ) ;
proof1 . root . toString ( ) === publicSignals [ 0 ] ? console . log ( 'merkle proof valid' ) : console . log ( 'merkle proof invalid' )
proof1 . root . toString ( ) === publicSignals [ 0 ] ? console . log ( 'merkle proof valid' ) : console . log ( 'merkle proof invalid' )
} catch ( e ) {
} catch ( e ) {
console . error ( e . message )
console . error ( e . message )
}
}