Question : Is to possible to read the Message field in human readable format inside the circuit #1176
Replies: 6 comments
-
Can you elaborate what do you mean by reading the message? Are you interested in debug printing the intermediate values? For this, we have |
Beta Was this translation helpful? Give feedback.
-
@ivokub Hey,Thanks for the reply. |
Beta Was this translation helpful? Give feedback.
-
All the variables inside the circuit are actually field elements (essentially integers modulo scalar field), so the human-readable representation for it is actually an integer. There is a natural way to encode messages as integers though -> you look at every letter as a message as byte and then represent these bytes as base-256 encoded integer. Similarly, you can have the encoding the other way, but keep in mind that for every byte there may not be an printable letter (particularly for byte values [127,255]). |
Beta Was this translation helpful? Give feedback.
-
Thank you @ivokub |
Beta Was this translation helpful? Give feedback.
-
By default it is not possible. The circuit as defined is turned into a list of constraints depending on the arithmetization (R1CS/Plonk) and as such we cannot really have conversions as the actual values are only assigned at proving time and we don't have the circuit code anymore. When using However, there is a tool for debugging circuits. There is a := api.Mul(x, y)
aa, ok := a.(*big.Int)
fmt.Println(aa.String()) but we always don't work with a := api.Mul(x, y)
switch aa := a.(type) {
case *big.Int:
/// print big.Int
case big.Int:
/// print big.Int
case uint64:
/// print uint64
... // etc
} |
Beta Was this translation helpful? Give feedback.
-
Thankyou @ivokub |
Beta Was this translation helpful? Give feedback.
-
I was working with Ethan Buchman e snark account https://github.com/informalsystems/cosmos-sdk/blob/gnark50/crypto/keys/gnark/eddsa/eddsa.go .I want to read the message in side the circuit .
Is it possible?
Beta Was this translation helpful? Give feedback.
All reactions