Skip to content

Instantly share code, notes, and snippets.

View protolambda's full-sized avatar
:shipit:
building L1 and L2 ethereum things

protolambda protolambda

:shipit:
building L1 and L2 ethereum things
View GitHub Profile
@protolambda
protolambda / op-goerli.json
Created July 14, 2023 23:35
extracted optimism chain configs
{
"chainId": 420,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
import matplotlib.pyplot as plt
MIN_DATA_GASPRICE = 10**8
DATA_GASPRICE_UPDATE_FRACTION = 8902606
DATA_GAS_PER_BLOB = 2**17
def fake_exponential(factor: int, numerator: int, denominator: int) -> int:
i = 1
output = 0
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: semaphore16
Contributor # 116
Hash: 3676be95 cf9735dd c2b417ec e52b2e2e
b54ba8bd 6325ce68 5517d851 84503b22
d8252f0d 3afab3f5 6d464e61 66abee5c
c06534d0 7ed1ecb5 368aaacc 39195b17
did:3:bafyreigxujdiiahptasm4cc24vn6x5xmh6rqdkenrgah7n6eogfcp4plhy
@protolambda
protolambda / chart.py
Created March 13, 2021 20:17
bitcoin price vs energy usage
import pandas as pd
energy = pd.read_csv('energy.csv')
price = pd.read_csv('btcusd.csv', skiprows=1, header='infer')
day_seconds = 24*60*60
energy['Timestamp'] = (energy['Timestamp'] // day_seconds) * day_seconds
energy.set_index('Timestamp', drop=True, inplace=True)
# Some are in ms precision, others are not. Convert everything to seconds
price['Unix Timestamp'] = price['Unix Timestamp'].apply(lambda x: x if x < 1800_000_000 else x//1000)
@protolambda
protolambda / bounds_output.json
Last active April 6, 2024 19:39
Eth2 type bounds v0.12
{
"AggregateAndProof": {
"min_size": 337,
"max_size": 593
},
"Attestation": {
"min_size": 229,
"max_size": 485
},
"AttestationData": {
from typing import NamedTuple
# Before importing spec, load config:
# from eth2spec.config.config_util import prepare_config
# prepare_config("./some-dir", "config-name")
from eth2spec.phase0 import spec
from py_ecc.bls import G2ProofOfPossession as bls
@protolambda
protolambda / experimental.go
Last active November 11, 2019 23:27
Binary Tree as immutable state backing, with rebinding pattern for minimal copy-on-write modifications. Every merkle cached *by default*.
package main
import (
"crypto/sha256"
"encoding/binary"
"fmt"
"github.com/protolambda/zrnt/eth2/core"
"log"
)
@protolambda
protolambda / old.txt
Created October 2, 2019 05:46
legendre gas comparison
tests/test_legendre.py::test_legendre_bit_multi[98664890185803090820795664221311571457388121129367363513725762245513639662735-18446744073709551629] 1210316
PASSED
tests/test_legendre.py::test_legendre_bit_multi[18964063782618292170393288995423561994901627456468505707369109131577067020952-18446744073709551629] 1210316
PASSED
tests/test_legendre.py::test_legendre_bit_multi[8091199738843691471527825287170383243412719389859028349784895924450364058964-18446744073709551629] 1210316
PASSED
tests/test_legendre.py::test_legendre_bit_multi[77249322488094553571524885090385411773495183262004086725201158612430117530436-18446744073709551629] 1210316
PASSED
tests/test_legendre.py::test_legendre_bit_multi[66396120258083160297362790952219000403681848958905759440048413833693003638385-18446744073709551629] 1210316
PASSED
from eth2spec.phase0 import spec
from eth2spec.utils.bls import bls_sign
from eth2spec.utils.merkle_minimal import calc_merkle_tree_from_leaves, get_merkle_proof
from eth2spec.utils.hash_function import hash
from py_ecc.bls import privtopub
from typing import List, Tuple
from eth_utils import (
encode_hex,
int_to_big_endian,
)