Skip to content

Instantly share code, notes, and snippets.

Avatar

Nicolas Gailly nikkolasg

View GitHub Profile
View verkle_constraints_msm_h4.py
#!/usr/bin/env python3
import math
def bench(n,f,N):
lf = math.ceil(math.log(f,2))
d = math.ceil(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
View verkle_constraints_msm_h3.py
#!/usr/bin/env python3
import math
n = 2**30 # 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
View verkle_constraints_msm.py
#!/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
View verkle_constraints.py
#!/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
View gas3.py
#!/usr/bin/env python3
precommitGas = 9000000
provecommitGas = 40000000
windowpostGas = 512265727
sectorsInPartition = 2349
maxSectorsPerWindowPost = 10000
sectorSize = 32
blockLimitGas = 10e9
tipset = 5
@nikkolasg
nikkolasg / gas_simulation.py
Created Sep 17, 2020
Simulation of pre/provecommit + window post evolution
View gas_simulation.py
#!/usr/bin/env python3
precommitGas = 9000000
provecommitGas = 40000000
windowpostGas = 512265727
maxSectorsPerWindowPost = 10000
sectorSize = 32
blockLimitGas = 10e9
@nikkolasg
nikkolasg / gas.py
Created Sep 16, 2020
Compute the maximum storage size given some conditions and the time to reach it
View gas.py
#!/usr/bin/env python3
precommitGas = 9000000
provecommitGas = 40000000
windowpostGas = 512265727
windowPostInPartition = 2349
sectorSize = 32
blockLimitGas = 10e9
View drand_catchup.py
#!/usr/bin/env python3
from datetime import timedelta
period = 30
catchup = 10
downtime_h = 3
downtime_rounds = 2 * 60 * downtime_h
downtime = period * downtime_rounds
@nikkolasg
nikkolasg / wdrand.py
Last active Jun 3, 2020
weidghted drand numbers constraint solver
View wdrand.py
#!/usr/bin/env python3
# requires installation of https://pypi.org/project/python-constraint/
# `pip3 python-constraint` should do it
from constraint import *
import math
import json
# Let X the number of tier 1 nodes.
# Let Y the number of tier 2 nodes.
# Let R be the weight / replication factor of each tier 1 node
View gist:78f18a24738da8f547fc58ca2f5b372c
Verifying my Blockstack ID is secured with the address 1PErskqD6PhcP1SFeWbzDTFu23iU4EBc1U https://explorer.blockstack.org/address/1PErskqD6PhcP1SFeWbzDTFu23iU4EBc1U