Replies: 3 comments 5 replies
-
You are measuring the circuit compile, Groth16 and Groth16 proving. It would be more suitable to only measure the proving time i.e. the part proof, err := groth16.Prove(r1cs, pk, witness)
if err != nil {
fmt.Printf("Prove failed: %v\n", err)
return
} |
Beta Was this translation helpful? Give feedback.
-
This one is the smaller one. Let me know if there is anything else you want me to provide. |
Beta Was this translation helpful? Give feedback.
-
I see it now - here your circuits are exactly the same, you're only changing the input witness. Circuit compile speed doesn't depend on the input. Neither does the proving time unless there is some non-deterministic computation using hints. NB! All arithmetic in circuit is done modulo the native field. This means that most probably the large input is cut to fit into the native field, as the native field is approx 254 bits. So the behaviour is expected. |
Beta Was this translation helpful? Give feedback.
-
I am trying to see the time it takes for the mimc function on different size of inputs string, However, it seems that the time is not sensitive to the size of the inputs, where I am a bit confused about. I have try inputs of string length 1 and string length 120,000, and the time it takes is pretty similar.
Here is my code:
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"math/big"
"os"
"time"
)
const (
pubInputFile = "public.json"
priInputFile = "private.json"
vkKeyFile = "vk.g16vk"
proofFile = "proof.g16p"
)
// Structure to hold the input data from the JSON file
type Inputs struct {
PreImage string
json:"PreImage"
Hash string
json:"Hash"
}
type Circuit struct {
PreImage frontend.Variable
Hash frontend.Variable
gnark:",public"
}
func (circuit *Circuit) Define(api frontend.API) error {
// Create a new MiMC hash instance
mimcHash, _ := mimc.NewMiMC(api)
}
func main() {
// Step 1: Read input data from JSON file
inputFile := "inputs.json"
file, err := os.Open(inputFile)
if err != nil {
fmt.Printf("Failed to open the file: %v\n", err)
return
}
defer file.Close()
}
Beta Was this translation helpful? Give feedback.
All reactions