This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
memory efficient simulation of network growth | |
pypy is ~10 times faster | |
""" | |
import math | |
import time | |
import array | |
import random | |
import profile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
import random | |
import json | |
import hashlib | |
def hexhash(x): | |
return '0x' + hashlib.sha224(str(x)).hexdigest()[:6] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Address A | Address B | Balance AB | Creditline AB | Creditline BA | |
---|---|---|---|---|---|
0x25ae499a363ca20d9623bb79667e21c78e7cbef0 | 0xd60cbcc76cb871a99d9c54f33a34be41b2ac994e | 0 | 10000 | 0 | |
0x25ae499a363ca20d9623bb79667e21c78e7cbef0 | 0x682899a3b136951a22ba2bb53be35952b2bd7b36 | 0 | 0 | 3700 | |
0x25ae499a363ca20d9623bb79667e21c78e7cbef0 | 0x300834e9043d3c6c4dad0a8e57cf36d21737a870 | 0 | 0 | 0 | |
0x25ae499a363ca20d9623bb79667e21c78e7cbef0 | 0x53151911dec4e218ba6cbed36c0515f1b851457e | 0 | 5000 | 171 | |
0x25ae499a363ca20d9623bb79667e21c78e7cbef0 | 0x63a5307db2de56d98367445e31ec90e47ae8785d | 3321 | 5000 | 5000 | |
0x25ae499a363ca20d9623bb79667e21c78e7cbef0 | 0xdc6d612be3ff757ab43894fb1df31b4662b3f66e | 2374 | 4000 | 5000 | |
0xb103fbb65894c6d4f063bc343aa329d49fcdc633 | 0x4b807bdd01dffac5c449654fffbeded7407f2df8 | 30000 | 30000 | 30000 | |
0xd56edaf63d31b92edb83245564ba9245400a12f7 | 0x6d767217e124b751b5aee396d4e8467bff24bccf | 0 | 1000 | 1000 | |
0xd56edaf63d31b92edb83245564ba9245400a12f7 | 0x1219223855393aade36c71a68e9004831250de1d | 600 | 1000 | 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ethereum import trie, db, utils | |
import time | |
MIN_COUNT = 32 | |
ROUNDS = 1000 | |
ERA_SIZE = 4 | |
MAX_COUNT = 32 | |
SYMMETRIC = True | |
tests = [[3, 32, False], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import trie | |
import rlp | |
import db | |
import time | |
trie.rlp_encode = rlp.codec.encode_raw | |
def int_to_big_endian(value): | |
cs = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# after entering the console of pyethapp | |
# https://github.com/ethereum/pyethapp/wiki/The_Console | |
from devp2p import kademlia | |
import gevent | |
def crawl(): | |
delay = 0.1 | |
lookups = 0 | |
kademlia_proto = eth.app.services.discovery.protocol.kademlia |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from ethereum import trie | |
from ethereum.securetrie import SecureTrie | |
from ethereum import blocks | |
import ethereum.chain | |
from pyethapp.leveldb_service import LevelDB | |
from ethereum.utils import big_endian_to_int | |
db = LevelDB(sys.argv[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
cython + gmp implementation of ecdsa recover | |
based on: | |
https://github.com/vbuterin/pybitcointools | |
""" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"comment": "\n 'node_ids': hex encoded ids in order in which they were added to the routing table\n 'buckets' : buckets sorted asc by range\n ", | |
"buckets": [ | |
{ | |
"start": "0x0", | |
"end": "0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffL", | |
"node_ids": [ | |
"0x1d7425638602ab696a402f23ae8cc938dcdcd03969b666205628059568cc69b1064005c3985c3cf3f76be1d1efa21977394988f847fd9b4e64d1bcb702753a1L", | |
"0x1825bc5430beb45f683514f2ceb81f9d7914c120c8dcd19f3e3511287900f7f993829b43922fe15ae1e3db63ef7ddc76b92da22b21df306f8a0b3c3336d8393aL", | |
"0xf844fef1931e9eea56c0941fbf24050a748dbcfac619e630dde29a6baa4b71add2467ac778eedb3693dffbc6c6fa6115ab33edf6e595ed3a8b317fa18d0752bL", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Requirements: | |
- I/O bound: cycles spent on I/O ≫ cycles spent in cpu | |
- no sharding: impossible to implement data locality strategy | |
- easy verification | |
Thoughts: |
NewerOlder