Skip to content

Instantly share code, notes, and snippets.

@daira
daira / incorrect_supply_blockchair.py
Created Nov 12, 2022
INCORRECTLY calculate the Zcash supply after a given block height on Mainnet or Testnet (not taking into account the slow start)
View incorrect_supply_blockchair.py
#!/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 Nov 12, 2022
INCORRECTLY calculate the Zcash supply after a given block height on Mainnet or Testnet (treating Blossom as never activated)
View incorrect_supply.py
#!/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 Nov 12, 2022
Calculate the Zcash supply after a given block height on Mainnet or Testnet
View incorrect_supply.py
#!/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 Nov 12, 2022
Calculate the Zcash supply after a given block height on Mainnet or Testnet
View supply.py
#!/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 Nov 12, 2022
Calculate the Zcash supply after a given block height on Mainnet or Testnet
View supply.py
#!/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)
View selectoropt3a.py
#!/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
View selectoropt.py
#!/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 Mar 19, 2021
rtl addition chain v2
View addchain_5inv_rtlv2.py
# ---> 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)
View addchain_5inv_rtl.py
# ---> 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)
View keybase.md

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: