Skip to content

Instantly share code, notes, and snippets.

View obscuren's full-sized avatar
😎
Working on Grid Online

Jeffrey Wilcke obscuren

😎
Working on Grid Online
View GitHub Profile
var id = shh.newIdentity();
var filter1 = shh.filter({to: id}, function(err, res) {
if( err ) {
console.log("Whisper error:", err);
// short circuit
return;
}
console.log("Received whisper message");

Testnet simplifications:

  1. Difficulty formula

D(genesisblock) = 2^22 D(block) = D(block.parent) + D(block.parent) / 1024 * (1 if block.timestamp < block.parent.timestamp + 42 else -1)

  1. Fees

POC-7 https://ethereum.etherpad.mozilla.org/14? Latest changes:


Stateless contracts: Additional opcode: 0xf4: CALLSTATELESS Calls self, but grabbing the code from the TO argument instead of from one's own address DONE PY,C++, go/Java

ALTERATIONS FOR SUICIDE

Suicide's semantics are now:

All funds are immediately transferred to the nominated recipient account, but the account itself remains valid. It is tagged for destruction, to be completed simultaneously with all remaining gas being refunded to the origination account (this can safely happen simultaneously since the suicidal account is necessarily a contract account and the transaction originator is necessarily externally controlled, non-contract account).

All accounts become the same type; code/storage is just empty for the non-contract accounts.

PoC 4

Big Changes

We now make a distinction between state and code. Code is stored as an immutable byte array node in the state tree. Accounts have both a state and code hash. When creating contracts, two byte arrays containing EVM code are given: an initialiser (run once then discarded) and the body (stored in the state tree as mentioned).

Transaction types are distinguished between 

(i) A message call transaction now contains the following fields:

Testnet simplifications:

  1. Difficulty formula

D(genesisblock) = 2^22 D(block) = D(block.parent) + D(block.parent) / 1024 * (1 if block.timestamp < block.parent.timestamp + 42 else -1)

  1. Fees
@obscuren
obscuren / stack.md
Last active November 5, 2015 22:31

Function calling and removing deterministic memory:

Memory and stack management

000: stack ptr ->-->-->-+ (points to "stack frame 2")
--- stack frame 1       |
001: "___ret_pos"       |
002: "___p_stack_ptr"   |
003: stack var "a"      |
func ExampleExecute_ffi() {
// enable FFI
vm.EnableFFI()
cfg := &Config{
DisableJit: true,
// create ffi model and functions
Ffi: vm.Ffi{
0: func(in []byte) ([]byte, error) {
reverse := make([]byte, len(in))
@obscuren
obscuren / eth.go
Last active November 1, 2015 19:48
package main
import (
"fmt"
"log"
"os"
"os/signal"
"github.com/ethereum/go-ethereum/accounts/contract"
"github.com/ethereum/go-ethereum/common"
panic: close of closed channel
goroutine 36182 [running]:
github.com/ethereum/go-ethereum/miner.(*RemoteAgent).Stop(0xc8359d7810)
/Users/jeffrey/go/src/github.com/ethereum/go-ethereum/miner/remote_agent.go:80 +0x30
github.com/ethereum/go-ethereum/miner.(*worker).unregister(0xc820297ea0, 0x6f21230, 0xc8359d7810)
/Users/jeffrey/go/src/github.com/ethereum/go-ethereum/miner/worker.go:219 +0xb3
github.com/ethereum/go-ethereum/miner.(*Miner).Unregister(0xc82029d3e0, 0x6f21230, 0xc8359d7810)
/Users/jeffrey/go/src/github.com/ethereum/go-ethereum/miner/miner.go:140 +0x39
github.com/ethereum/go-ethereum/xeth.(*XEth).Stop(0xc8226376c0)