Skip to content

Instantly share code, notes, and snippets.

vbuterin / gist:39366aa0ee67122627eb
Created Aug 8, 2014
Verifying myself: My Bitcoin username is +vitalik.
View gist:39366aa0ee67122627eb
Verifying myself: My Bitcoin username is +vitalik.
View sendLots.js
// This is free and unencumbered software released into the public domain.
// Paste this function into the JavaScript console and execute like so:
// sendLots(eth.coinbase, eth.accounts[1])
// This can be saved to a file and loaded with loadScript('/path/to/sendLots.js')
sendLots = function(fromAccount, toAccount) {
loops = 5;
txcount = 2;
waitBlocks = 1;
data = "";
View N + k^2 Algorithms
The purpose of this note is to describe a modification to proof of stake algorithms, as well as a proof of work variant, which uses a notion of increasing timeouts to ensure convergence in a partially synchronous environment. It builds on Andrew Miller et al's work [here](, and its primary contribution is intended to be relaxing the network model from synchronous to partially synchronous. It also builds heavily on Sompolinsky and Zohar's work on [GHOST](
* A synchronous network model is one where messages between correct nodes are guaranteed to arrive at the recipient within D seconds for some known D. Within that D, however, an attacker has absolute freedom to manipulate latencies of individual messages to attempt to prevent convergence.
* A partially synchronous model is similar, except D is unknown.
* GHOST is a blockchain fork choice rule that tries to determine the "head" of a cha
View gist:47b6c572ba8f95109f1ba5e414297c09

We can create a simplified scalable consensus algorithm that attempts to provide guarantees of only data availability; that is, the basic "unit" of consensus is a data block, a small header that cryptographically points to, say, 1 MB of data, and the only purpose of this system is to provide only the guarantee that the data committed to by these block headers is readily available. This is a challenging problem to solve scalably because the usual technique for scalable validation, incentivized interactive verification with penalties, does not work well for data availability because a malicious attacker can always reveal data just before they are supposed to be penalized. However, using the mechanism described here we can combine rapid shuffling and a form of graceful degradation to solve the scalable data availability validator problem rather effectively.

We can model the protocol by assuming access to a "DHT oracle" where nodes can call DHTget(hash) and get back the preimage if the preimage has been publis

View casper_abi
[{"name": "__init__", "outputs": [], "inputs": [{"type": "int128", "name": "_epoch_length"}, {"type": "int128", "name": "_withdrawal_delay"}, {"type": "address", "name": "_owner"}, {"type": "address", "name": "_sighasher"}, {"type": "address", "name": "_purity_checker"}, {"type": "decimal10", "name": "_base_interest_factor"}, {"type": "decimal10", "name": "_base_penalty_factor"}, {"type": "int128", "name": "_min_deposit_size"}], "constant": false, "payable": false, "type": "constructor"}, {"name": "get_main_hash_voted_frac", "outputs": [{"type": "decimal10", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function"}, {"name": "get_deposit_size", "outputs": [{"type": "int128", "name": "out"}], "inputs": [{"type": "int128", "name": "validator_index"}], "constant": true, "payable": false, "type": "function"}, {"name": "get_total_curdyn_deposits", "outputs": [{"type": "int128", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function"}, {"name": "get_total_p
## Code NOT run or tested or audited. For exposition purposes only.
latest_messages = [_ for i in range(len(validators))]
scores = {}
# Note re big O notation: N = messages, B = balance changes, T = history length
def update_latest_messages(new_messages: List[Tuple[int, int, bytes32]]):
# new_messages: (validator index, slot of new target, block_hash of new target) for each new message
starting_slot = 0
View how_much_eth_was_premined.js
x1 = prompt("11.9 million ETH was given to the foundation + early contributors. Is this a premine? Answer Yes/No").toLowerCase() == "yes" ? 11.9 : 0
x2 = prompt("61.1 million ETH was sold in an open widely publicized process where anyone could obtain ETH by sending bitcoin to a specific address. Is this a premine? Answer Yes/No").toLowerCase() == "yes" ? 61.1 : 0
x3 = prompt("3.6 million ETH was economically reallocated during the DAO fork. Is this a premine? Answer Yes/No").toLowerCase() == "yes" ? 3.6 : 0
x4 = prompt("36.1 million ETH was mined so far. Is this a premine? Answer Yes/No").toLowerCase() == "yes" ? 46.1 : 0
alert((x1+x2+x3+x4)+" million out of 107.2 million ETH was premined!")

Keybase proof

I hereby claim:

  • I am vbuterin on github.
  • I am vbuterin ( on keybase.
  • I have a public key whose fingerprint is 84A3 E5B6 DAA2 DA53 26CC 86C3 49DF 1C60 79D8 3FAC

To claim this, I am signing this object: