@@ -6,6 +6,7 @@ import { InputMap } from '@noir-lang/noirc_abi';
66import { readFile , unlink , writeFile } from 'fs/promises' ;
77import { addHexPrefix } from '../../util/hex.js' ;
88import { type Hex } from 'viem' ;
9+ import { Barretenberg } from './barretenberg.js' ;
910
1011// IMPORTANT: The proof paths used here are not unique to the `proofId` - therefore they can be overridden in parallel proof generation.
1112// https://github.com/noir-lang/noir/issues/5037
@@ -35,8 +36,21 @@ export class NargoProver {
3536 return path . join ( this . circuit . root , 'proofs' , `${ this . circuit . name } .proof` ) ;
3637 }
3738
39+ private get witnessPath ( ) : string {
40+ return path . join ( this . circuit . packagePath ( ) , 'target' , `${ this . proverName } .gz` ) ;
41+ }
42+
43+ private get bytecodePath ( ) : string {
44+ return path . join ( this . circuit . root , 'target' , `${ this . circuit . name } .json` ) ;
45+ }
46+
3847 public async executeProveCommand ( ) : Promise < void > {
39- await $ `nargo prove --package ${ this . circuit . name } --oracle-resolver http://localhost:5555 -p ${ this . proverName } -v ${ this . verifierName } ` ;
48+ // Generate witness using nargo execute
49+ await $ `nargo execute --package ${ this . circuit . name } --oracle-resolver http://localhost:5555 -p ${ this . proverName } ` ;
50+
51+ // Generate proof from witness using bb
52+ const bb = await Barretenberg . create ( ) ;
53+ await bb . prove ( this . bytecodePath , this . witnessPath , this . proofPath ) ;
4054 }
4155
4256 public async prove ( inputs : InputMap ) : Promise < Hex > {
0 commit comments