Skip to content

Instantly share code, notes, and snippets.

View gakonst's full-sized avatar

Georgios Konstantopoulos gakonst

View GitHub Profile
gakonst /
Last active September 8, 2022 23:57
Probability of a malicious validator controlling majority of a 6125-size committee
import math
def choose(n, k): return math.factorial(n) // math.factorial(k) // math.factorial(n-k)
def prob(n, k, p): return math.exp(math.log(p) * k + math.log(1-p) * (n-k) + math.log(choose(n, k)))
def probge(n, k, p): return sum([prob(n, i, p) for i in range(k, n+1)])
committee = 6125
half = committee / 2
for p in [0.45, 0.46, 0.47, 0.48, 0.49, 0.5, 0.51]:
gakonst / lista_petsa.csv
Last active March 12, 2021 08:23
View lista_petsa.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 6 columns, instead of 9. in line 1.
ΕΝΤΥΠΟ,ATHENS REVIEW OF BOOKS,ΑΤΤΙΚΗΣ,5.000,00,5.000,00,6.200,00
ΕΝΤΥΠΟ,DEAL NEWS,,5.000,00,5.000,00,6.200,00
ΕΝΤΥΠΟ,DYTIKH FREE PRESS,ΑΤΤΙΚΗΣ,2.000,00,2.000,00,2.480,00
ΕΝΤΥΠΟ,KONTRA NEWS,,36.000,00,36.000,00,44.640,00
ΕΝΤΥΠΟ,LIVE SPORT,,4.000,00,4.000,00,4.960,00
gakonst / Hegic.sol
Created April 25, 2020 09:46
Slimmed Down Version of the Hegic Options contract so that you can try to spot the bug, ref:
View Hegic.sol
pragma solidity ^0.6.6;
contract HegicReproduceBug {
Option[] public options;
enum State { Active, Exercised, Expired }
struct Option {
State state;
uint expiration;
View test.sol
pragma solidity ^0.6.2;
contract Test {
function test1() external {
function test2() external {
gakonst /
Last active March 12, 2020 21:33
Greece #COVID-19
import pandas as pd
import matplotlib.pyplot as plt
import pylab
from scipy.optimize import curve_fit
import numpy as np
import datetime
# load the data
names = ["date", "infections", "age", "gender", "area", "source"]
df = pd.read_csv(

Keybase proof

I hereby claim:

  • I am gakonst on github.
  • I am gakonst ( on keybase.
  • I have a public key ASAigclj3x7AuazeWQkVupHUdx1XOv8oAUilNCSMaL3eTgo

To claim this, I am signing this object:

gakonst / signed-contract.ts
Created September 30, 2018 14:22
Allows offline signing of a contract instance with web3.js
View signed-contract.ts
import Web3 from 'web3'
import { Contract, Account, Signature } from 'web3/types';
// Converts any contract to a signed contract
class SignedContract {
account: Account
contract: Contract
address: string
web3: Web3
View Verifying my Peepeth
Verifying my identity on 0x867b5ec95ef7d6cfe460e5ae2b88fc3d10ac9098
gakonst /
Last active April 4, 2018 09:27
Summary and Thoughts on the potential ASIC-Fork

To Fork or not To Fork, that is the question.


For the people that have not been following the news, it is now confirmed that Bitmain is selling an Ethereum mining ASIC. This can be potentially harmful for Ethereum's decentralization and thus the community is currently discussing on how this should be approached, potentially through a hard-fork change in the hashing algorithm used to achieve consensus.

There are valid arguments on both sides. I'll refer to bits and pieces I have extracted from my reading and understanding so far. This is where we should discuss with concrete arguments on each case.

My assumption is that full PoS, and not PoW/PoS Casper with epochs, is not close enough to be considered a remedy.

Ideas for the Fork

gakonst / TestGas.solidity
Created March 23, 2018 14:44
Gas Testing for Libraries Public vs Internal
View TestGas.solidity
pragma solidity ^0.4.21;
library TestLibPublic {
struct Data {
uint n;
function Set(Data storage self, uint a) public {
self.n = a;