Skip to content

Instantly share code, notes, and snippets.

View Arachnid's full-sized avatar

Nick Johnson Arachnid

View GitHub Profile
// Copyright 2018 The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider("http://localhost:8545"))
PERCENTILE = 0.6
NUMBLOCKS = 43200
# NUMBLOCKS = 1000
def getMinGasPrice(block):
minPrice = None

Keybase proof

I hereby claim:

  • I am arachnid on github.
  • I am arachnid (https://keybase.io/arachnid) on keybase.
  • I have a public key whose fingerprint is 01D0 4A62 A925 E4E6 9297 0628 A9C0 6CE2 FF8B 0A48

To claim this, I am signing this object:

pragma solidity ^0.4.10;
contract ENS {
function owner(bytes32 node) constant returns (address);
}
contract Deed {
address public owner;
address public previousOwner;
}
// Example usage: `bumpGasPrice(web3.toWei(2, 'gwei'))`
function bumpGasPrice(minprice) {
for(var i = 0; i < eth.accounts.length; i++) {
var account = eth.accounts[i];
var pending = txpool.content.pending[account];
if(pending === undefined) continue;
Object.keys(pending).forEach(function(nonce) {
var tx = pending[nonce];
var gasPrice = new BigNumber(tx.gasPrice.slice(2), 16);
if(gasPrice < minprice) {
pragma solidity ^0.4.10;
import "IERC20Token.sol";
/**
* The problem: Handing out tokens is problematic, because the receiving account
* also needs enough ether to send a transaction transferring the tokens to the
* user's account.
*
* The solution: Send the tokens to a 'checking account'. The recipient of the
pragma solidity ^0.4.0;
import "SafeMath.sol";
import "IERC20Token.sol";
/**
* @dev Implements a capped token sale using a second-price auction.
*
* @author Nick Johnson <arachnid@notdot.net>
*
@Arachnid
Arachnid / genwordlist.py
Last active June 19, 2017 12:22
An attempt at a better mnemonic wordlist. All words are 4-8 characters; all 4-character prefixes are unique, and no two words have edit distance < 2.
from pyxdameraulevenshtein import damerau_levenshtein_distance
words = [line.strip().split(" ")[1] for line in open('wordlist.txt')]
out = []
for word in words:
if len(out) >= 2148: break
if len(word) < 4 or len(word) > 8: continue
if len(out) > 0 and min(damerau_levenshtein_distance(x, word) for x in out) < 2: continue
if any(x.startswith(word[:4]) for x in out): continue
print word
out.append(word)
pragma solidity ^0.4.0;
contract BadToken {
mapping(address=>uint) public balances;
function BadToken() payable {
balances[msg.sender] = msg.value;
}
function transfer(address recipient, uint amount) {