Skip to content

Instantly share code, notes, and snippets.

View pipermerriam's full-sized avatar

Piper Merriam pipermerriam

  • Ethereum Foundation
  • Boulder Colorado
View GitHub Profile

Simple Streamable Serialize

Motivation:

  • Streaming encoding and decoding
  • Compact
  • 1st class support for needed data types
    • scalars (block numbers)
    • fixed length byte-strings (block hashes, state roots)
    • fixed width integers (v, r, s from transaction signature)
from eth_utils import function_signature_to_4byte_selector
import itertools
import multiprocessing
import random
import time
TARGET = b'\x00' * 4
________________________________ test_trie_sync ________________________________
 @given(random=strategies.randoms())
> @settings(max_examples=10)
 def test_trie_sync(random):
f = <function given.<locals>.run_test_with_generator.<locals>.wrapped_test at 0x00007fea84b0d6a0>
tests/test_sync.py:18:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
import asyncio
import random
class Network:
input = asyncio.Queue()
outputs = []
async def broadcast(network):

test_ namespaced JSON-RPC endpoints

We propose the following new JSON-RPC endpoints to be optionally implemented by clients.

The motivation for these new endpoints is to allow the following use cases.

  • External integration testing (e.g. web3 style libraries).
  • Execution of JSON fixture tests over RPC (grey box testing).
  • Build JSON test fixtures.
import sys
import codecs
import functools
from sha3 import sha3_256
if sys.version_info.major == 2:
bytes_types = (bytes, bytearray)
text_types = (unicode,) # noqa: F821
pragma solidity ^0.4.0;
library StringLib {
function concat(string storage _head, string _tail) returns (bool) {
bytes head = bytes(_head);
bytes memory tail = bytes(_tail);
for (uint i = 0; i < tail.length; i++) {
head.push(tail[i]);
}
@pipermerriam
pipermerriam / ecverify.sol
Created October 17, 2016 16:35 — forked from axic/ecverify.sol
Ethereum ECVerify
//
// The new assembly support in Solidity makes writing helpers easy.
// Many have complained how complex it is to use `ecrecover`, especially in conjunction
// with the `eth_sign` RPC call. Here is a helper, which makes that a matter of a single call.
//
// Sample input parameters:
// (with v=0)
// "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad",
// "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200",
// "0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a"

.eth Registrar using only Deposits.md

This is an attempt of setting up a name registrar that use deposits instead of burning or token contributions and tries to optimize name utility and reduce domain squatting. Previous initiatives of charging a "rent" based on the market price with an yearly auction proved impopular with many developers as they believed the registrar wasn't delivering any value for the "tax" as well as worries that a sudden big auction could force someone unexpectedly to be forced to sell the name.

In order to start doing that let's define the problem:

Name squatting is defined as buying a name and not adding any value to it, just holding it expecting that domains names will become more valuable in the future. Let's assume that all name buyers have the intention of acquiring a name and make it more valuable over time, either by working on it as a business and adding value to the "brand", or by working to increase the chances of finding a