Skip to content

Instantly share code, notes, and snippets.

View daira's full-sized avatar

Daira-Emma Hopwood daira

View GitHub Profile
@daira
daira / incorrect_supply_blockchair.py
Created November 12, 2022 00:32
INCORRECTLY calculate the Zcash supply after a given block height on Mainnet or Testnet (not taking into account the slow start)
#!/usr/bin/env python3
# ***INCORRECT VERSION, FOR ILLUSTRATION ONLY***
def exact_div(x, y):
assert x % y == 0
return x // y
# floor(u/x + v/y)
def div2(u, x, v, y):
@daira
daira / incorrect_supply.py
Created November 12, 2022 00:20
INCORRECTLY calculate the Zcash supply after a given block height on Mainnet or Testnet (treating Blossom as never activated)
#!/usr/bin/env python3
# ***INCORRECT VERSION, FOR ILLUSTRATION ONLY***
def exact_div(x, y):
assert x % y == 0
return x // y
# floor(u/x + v/y)
def div2(u, x, v, y):
@daira
daira / incorrect_supply.py
Created November 12, 2022 00:20
Calculate the Zcash supply after a given block height on Mainnet or Testnet
#!/usr/bin/env python3
# ***INCORRECT VERSION, FOR ILLUSTRATION ONLY***
def exact_div(x, y):
assert x % y == 0
return x // y
# floor(u/x + v/y)
def div2(u, x, v, y):
@daira
daira / supply.py
Created November 12, 2022 00:10
Calculate the Zcash supply after a given block height on Mainnet or Testnet
#!/usr/bin/env python3
def exact_div(x, y):
assert x % y == 0
return x // y
# floor(u/x + v/y)
def div2(u, x, v, y):
return (u*y + v*x) // (x*y)
@daira
daira / supply.py
Created November 12, 2022 00:03
Calculate the Zcash supply after a given block height on Mainnet or Testnet
#!/usr/bin/env python3
def exact_div(x, y):
assert x % y == 0
return x // y
# floor(u/x + v/y)
def div2(u, x, v, y):
return (u*y + v*x) // (x*y)
#!/usr/bin/env python3
from collections import deque
from math import inf
from random import randrange
import json
# A proposed "set of simple selectors" s_{1..k} for a configuration is consistent iff
# for each selector s_i,
# * s_i is a boolean fixed column; and
#!/usr/bin/env python3
from collections import deque
from math import inf
import json
# For simplicity use the same disjoint-set data structure as for the
# permutation argument.
class DisjointSets(object):
def __init__(self, n):
@daira
daira / addchain_5inv_rtlv2.py
Created March 19, 2021 19:06
rtl addition chain v2
# ---> up to here is a multiple of 0b110011 = 51 :-)
x_p = 0b11001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001101001110100111101110000011001001101000010000101001100000111000101110000011110000111100111111000011001100110011001100110011001101
pchain = Chain()
pi = pa = 1
for i in range(1, 128):
pi = pchain.sqr(pi)
if '01001110100111101110000011001001101000010000101001100000111000101110000011110000111100111111000011001100110011001100110011001101'[127-i] == '1':
pa = pchain.mul(pa, pi)
@daira
daira / addchain_5inv_rtl.py
Created March 19, 2021 18:30
rtl addition chain
# ---> up to here is a multiple of 3 :-)
x_p = 0b11001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001101001110100111101110000011001001101000010000101001100000111000101110000011110000111100111111000011001100110011001100110011001101
pchain = Chain()
pi = pa = 1
for i in range(1, 114):
pi = pchain.sqr(pi)
if '101110000011001001101000010000101001100000111000101110000011110000111100111111000011001100110011001100110011001101'[113-i] == '1':
pa = pchain.mul(pa, pi)

Keybase proof

I hereby claim:

  • I am daira on github.
  • I am zedaira (https://keybase.io/zedaira) on keybase.
  • I have a public key ASDhxWkEakEA-bzyc2LulixNHnPD83MdWX4Q4cGxlezvRwo

To claim this, I am signing this object: