Skip to content

Instantly share code, notes, and snippets.

@nikkolasg
Created August 17, 2021 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikkolasg/e286da05540aed58de1c2213bc76f9bf to your computer and use it in GitHub Desktop.
Save nikkolasg/e286da05540aed58de1c2213bc76f9bf to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import math
n = 2**29 # number of nodes in total
f = 256 # width of each node in the vtree
lf = math.log(f,2)
d = math.log(n,f) # number of layers in the vtree
c_h = 505 # constraints to hash
c_f = 506 # constraints to perform fixed based multiplication
c_v = 2249 # constraints to perform variable based multiplication
N = 25000 # total number of openings
def fo(i):
return '{:,}'.format(int(i)).replace(',', ' ')
# Verkle tree part
verkle = N * c_h # seed computation
verkle += N * d * c_h # verkle tree encoding checks
print("Verkle Tree part constraints: ", fo(verkle))
# Multi point opening part
multi = 3 * c_h # hashes
multi += 3 * d * N # compute g2(t)
multi += d * N * c_v # commitment to g1
print("Multi points constraints: ", fo(multi))
# IPA verification
ipa = lf * c_h # intermediate challenges computation
ipa += lf * c_v * 2 # intermediate commitments computation
ipa += lf * 3 # final polynomial for bases
ipa += f * c_f # Compute g'
ipa += f * 3 # Compute b'
ipa += 2 * c_v # Final check
print("IPA constraints: ", fo(ipa))
print("TOTAL constraints: ",fo(ipa + multi + verkle))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment