Appearance
Fiat-Shamir Transform
Now let's put all the pieces together.
In practice, we often want a non-interactive proof system so that we can compute the proofs at one point in time on a given machine, and check them later when needed. To achieve this, we use the Fiat-Shamir transformation, where we assume a hash function behaves as a random oracle. The idea is that the prover himself can generate "unbiased" challenges based on the messages he would send to the verifier in an interactive version of the protocol by using a hash function. See for instance the following two functions that operate over a string that we will call a "transcript".
The first function
python
import hashlib
def push(v, transcript, delim="|"):
return transcript + delim + str(v)
def generate_challenge(transcript):
# Encode the transcript string into bytes for the hash function
transcript_bytes = transcript.encode('utf-8')
# Compute the SHA256 hash and get its hexadecimal representation
sha256_hash = hashlib.sha256(transcript_bytes).hexdigest()
# Convert the hexadecimal hash string to an integer
hash_int = int(sha256_hash, 16)
# Cast the integer into an element of our finite field F
return F(hash_int)
#Examples
transcript = ""
print(f"Initial transcript: '{transcript}'")
# Push a number and an elliptic curve point to the transcript
transcript = push(12345, transcript)
transcript = push(kzg.P, transcript)
print(f"Updated transcript: '{transcript}'")
# # Generate a challenge from the transcript
challenge = generate_challenge(transcript)
print(f"Generated challenge: {challenge}")
Step 1
We start with an empty transcript and add the initial values
Exercise 19
Push the values discussed above in order to the empty transcript. Also compute proofs for the openings of
python
transcript = ""
#Solve here!
value_a = #?
value_b = #?
value_c = #?
c_a = #?
c_b = #?
c_c = #?
proof_value_a =
proof_value_b =
proof_output =