UNPKG

@nori-zk/ethprocessor

Version:

zkApp for verifying SP1 Helios Nori proof and storing latest execution state root on Mina

41 lines 1.56 kB
import { Logger, LogPrinter } from 'esm-iso-logger'; import { vkData } from '../proofs/nodeVk.js'; import { p0 } from '../proofs/p0.js'; import { sp1PlonkProof } from '../proofs/sp1Proof.js'; import { MinaEthProcessorSubmitter } from '../proofSubmitter.js'; import { wait } from '../txWait.js'; const logger = new Logger('ProveAndSubmit'); new LogPrinter('NoriEthProcessor'); function buildProofCreateArgument() { const example = { sp1PlonkProof, conversionOutputProof: { vkData, proofData: p0 }, }; return example; } async function main() { logger.info(`ProveAndSubmit has started.`); // Construct a MinaEthProcessorSubmittor const proofSubmitter = new MinaEthProcessorSubmitter(); // Establish the network await proofSubmitter.networkSetUp(); // Compile contracts. await proofSubmitter.compileContracts(); // Build proof. const ethProof = await proofSubmitter.createProof(buildProofCreateArgument()); logger.info(`Proof has been successfully created... Moving on to submitting the proof.`); // Submit proof. const txDetails = await proofSubmitter.submit(ethProof.proof); logger.log(`TxHash: ${txDetails.txHash}`); // Wait for finalization logger.log('Waiting for finalization.'); await wait(txDetails.txId, process.env.MINA_RPC_NETWORK_URL); logger.log('Finalized!'); } main() .then(() => process.exit(0)) .catch((err) => { logger.fatal(`Error in main function.\n${String(err)}`); process.exit(1); }); //# sourceMappingURL=proveAndSubmit.js.map