diff --git a/e2e/e2e.ts b/e2e/e2e.ts index e73d44f..213914c 100644 --- a/e2e/e2e.ts +++ b/e2e/e2e.ts @@ -3,7 +3,6 @@ import { ethers } from "ethers"; import { createInterepProof, sToBytes32 } from "../common"; // @ts-ignore circom import { poseidon } from "circomlibjs"; -import fs from "fs"; import { address, abi } from "../deployments/localhost_integration/RLN.json"; diff --git a/e2e/get-proof.ts b/e2e/get-proof.ts new file mode 100644 index 0000000..191cc62 --- /dev/null +++ b/e2e/get-proof.ts @@ -0,0 +1,13 @@ +async function main() { + const { getProof } = await import("./utils"); + const proof = await getProof(); + console.log(proof); + console.log("SOLIDITY PROOF: ", JSON.stringify(proof.solidityProof)); +} + +main() + .then(() => process.exit(0)) + .catch((e) => { + console.error(e); + process.exit(1); + }); diff --git a/e2e/utils.ts b/e2e/utils.ts new file mode 100644 index 0000000..203660f --- /dev/null +++ b/e2e/utils.ts @@ -0,0 +1,42 @@ +import createIdentity from "@interep/identity"; +import createProof from "@interep/proof"; +import { ethers } from "ethers"; +// @ts-ignore +import { poseidon } from "circomlibjs"; +import { sToBytes32 } from "../common"; + +// if length is not 64 pad with 0 +const pad = (str: string): string => (str.length === 64 ? str : pad("0" + str)); + +export async function getCredentials() { + const signer = new ethers.Wallet("0x" + process.env.PRIVATE_KEY); + const identity = await createIdentity( + (msg) => signer.signMessage(msg), + "Github" + ); + console.log("ID COMMITMENT: " + pad(identity.getCommitment().toString(16))); + console.log( + "ID KEY: " + + pad( + poseidon([identity.getNullifier(), identity.getTrapdoor()]).toString(16) + ) + ); + return identity; +} + +export async function getProof() { + const identity = await getCredentials(); + const proof = await createProof( + identity, + "github", + "bronze", + 1, + sToBytes32("foo"), + { + wasmFilePath: "./test/oldSnarkArtifacts/semaphore.wasm", + zkeyFilePath: "./test/oldSnarkArtifacts/semaphore.zkey", + }, + "goerli" + ); + return proof; +} diff --git a/test/oldSnarkArtifacts/semaphore.wasm b/test/oldSnarkArtifacts/semaphore.wasm new file mode 100644 index 0000000..dccaeaa Binary files /dev/null and b/test/oldSnarkArtifacts/semaphore.wasm differ diff --git a/test/oldSnarkArtifacts/semaphore.zkey b/test/oldSnarkArtifacts/semaphore.zkey new file mode 100644 index 0000000..77483ad Binary files /dev/null and b/test/oldSnarkArtifacts/semaphore.zkey differ diff --git a/ui/index.html b/ui/index.html index 40b2fe6..d257514 100644 --- a/ui/index.html +++ b/ui/index.html @@ -386,13 +386,13 @@ const checkChain = async (chainId) => { retrieveRLNDetailsButton.disabled = retrievedRLNEvents || chainId !== 5; registerButton.disabled = !(chainId === 5 && retrievedRLNEvents); - if (chainId !== 31337) { - alert("Switch to Localhost"); + if (chainId !== 5) { + alert("Switch to Goerli"); } }; - const rlnDeployBlk = 0; - const rlnAddress = "0x962a95edCDdcEBbB5A703f1357494009F1A10244"; + const rlnDeployBlk = 8059743; + const rlnAddress = "0xCd41a0aC28c5c025779eAC3208D0bF23baa3a5b6"; const rlnAbi = [ { inputs: [