Skip to content

Instantly share code, notes, and snippets.

View Arachnid's full-sized avatar

Nick Johnson Arachnid

View GitHub Profile
library StringTools {
struct Slice {
uint _ptr;
uint _len;
}
function memcpy(Slice dest, Slice src) private {
var len = src._len;
var destPtr = dest._ptr;
var srcPtr = src._ptr;
/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
library itmap {
struct entry {
// Equal to the index of the key of this item in keys, plus 1.
uint keyIndex;
uint value;
}
struct itmap {
mapping(uint => entry) data;
uint[] keys;
import urllib
import sha3
message = urllib.urlopen('http://pastebin.com/raw/CcGUBgDG').read()
clean = message.split('=====\r\n')[1].split('=====')[0].replace('\r\n', '\n').strip()
sha3.sha3_256(clean).hexdigest()
Nicks-MBP:azkube nickjohnson$ docker build .
Sending build context to Docker daemon 58.82 MB
Step 1 : FROM scratch
--->
Step 2 : ADD ca-certificates.crt /etc/ssl/certs/
---> Using cache
---> 2595831e39e2
Step 3 : ADD azkube /opt/azkube/azkube
---> acdf0edd49c6
Removing intermediate container a52b7ba90687

Excerpt from For The Win, by Cory Doctorow

Once, when he'd been working on his Masters, he'd participated in a study for a pal in the economics department. They'd locked twenty five grad students into a room and given each of them a poker chip. "You can do whatever you want with those chips," the experimenter had said. "But you might want to hang onto them. Every hour, on the hour, I'm going to unlock this door and give you twenty dollars for each poker chip you're holding. I'll do this eight times, for the next eight hours. Then I'll unlock the door for a final time and you can go home and your poker chips will be worthless -- though you'll be able to keep all the money you've acquired over the course of the experiment."

He'd snorted and rolled his eyes at the other grad students, who were mostly doing the same. It was going to be a loooong eight hours. After all, everyone knew what the value of the poker chips were: $160 in the first hour, $140 in the next, $120 in th

  EIP: draft
  Title: Ethereum Domain Name Service - Specification
  Author: Nick Johnson 
  Status: Draft
  Type: Informational
  Created: 2016-04-04

Abstract

/**
* Author: Nick Johnson <arachnid at notdot.net>
*
* WARNING: This contract is new and thus-far only lightly tested. I'm fairly
* confident it operates as described, but you may want to assure yourself of
* its correctness - or wait for others to do so for you - before you trust your
* ether to it. No guarantees, express or implied, are provided - use at your
* own risk.
*
* @dev Ether vault contract. Stores ether with a 'time lock' on withdrawals,
library LZF {
function decompress(bytes memory compressed, bytes memory decompressed) internal {
uint ip;
uint in_end;
uint op;
assembly {
// OP points to the current output location in memory
op := add(decompressed, 32)
// IP actually points to 31 bytes before the desired location, so
// MLOADs work correctly

pre-EIP: Password-protected Paper Wallets

Abstract

A mechanism is presented for generating password protected wallets, generated in such a fashion that a printing facility can generate a paper wallet that is encrypted with a user-supplied password, produced in such a fashion that the neither the printer nor the user can recover the account's private key without both the paper wallet and the password. This facilitates generating secure paper wallets or 'physical ether', whose security rests neither on the trustworthiness of the printer nor on the user's ability to effectively conceal their password. Password-protected wallets are encoded as mnemonic phrases, as described in BIP39.

Motivation

Paper wallets provide an attractive option for secure offline storage of cryptocurrencies, but securely generating a paper wallet can be an involved process, requiring an offline ('airgapped') computer and considerable care to protect private informati