Skip to content

Instantly share code, notes, and snippets.

@timbeiko
timbeiko / Adoption.sol
Created June 30, 2018 19:57
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.17;
contract Adoption {
address[16] public adopters;
function adopt(uint petId) public returns (uint) {
require(petId >= 0 && petId <= 15);
adopters[petId] = msg.sender;
return petId;
}
pragma solidity 0.4.24;
contract Migrations {
address public owner;
uint public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
@timbeiko
timbeiko / v0_shard_viz.py
Last active September 9, 2018 10:54
Sharding PoC Viz
import json
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import random
import hashlib
SHARD_COUNT = 3
MAX_BLOCK_HEIGHT = 5
VALIDATOR_COUNT = 3
2021-07-21 10:39:25 UTC 43/50 peers 5 MiB chain 0 bytes queue RPC: 1 conn, 13 req/s, 450 ��s
2021-07-21 10:39:28 UTC Imported #10679535 0xfa58���713c (22 txs, 4.19 Mgas, 367 ms, 21.36 KiB)
2021-07-21 10:39:36 UTC Imported #10679536 0x2822���5836 (7 txs, 1.19 Mgas, 313 ms, 2.21 KiB)
2021-07-21 10:39:51 UTC Imported #10679537 0xe936���2598 (115 txs, 7.99 Mgas, 2628 ms, 33.61 KiB)
2021-07-21 10:39:53 UTC Block import failed for #10679538 (0x1252���25f1)
Error: Error(Execution(NotEnoughCash { required: 1840000000000000, got: 1556899999118000 }), State { next_error: None, backtrace: InternalBacktrace { backtrace: Some( 0: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: <unknown>
@timbeiko
timbeiko / attestation.txt
Created April 4, 2022 20:58
Attestation
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: semaphore16
Contributor # 31
Hash: 69be5a73 d3b947f4 20edfab3 9b939f97
24b2efc8 45f51ba3 c3636e47 4ad09c40
c7f1770a fb82bc31 2338207d f859369a
389ef15b d1e1713f f728256f a83eb4e2
@timbeiko
timbeiko / goerli_avg_diff.py
Created July 17, 2022 16:58
Goerli TTD Estimations
import csv
with open('goerli_td_1m.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
avg = 0.0 # Average difficulty added per block
deltas = [] # List of added difficulty per block
# Calculate average over the entire set, and convert deltas column to a list
for row in csv_reader: