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
package main
import (
"log"
"strings"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/xeth"
)
@obscuren
obscuren / t.md
Last active September 15, 2015 21:36
correction

Quirk #1 - hiding in plain sight

There are two types of accounts within Ethereum; normal accounts and contract accounts. Contracts are created by sending transactions with empty to-fields, and contain some data which is executed (a’la constructor) and, hopefully, returns some code which gets placed on the blockchain. The contracts are, naturally, part of the same address space as the normal accounts; and the address of a contract is determined thus :

address = sha3(rlp_encode(creator_account, creator_account_nonce))[12:]
@obscuren
obscuren / core_refactor.md
Last active September 1, 2015 06:56
Ethereum core refactor

Core refactor

The following document will describe the necessary items that will be refactored during the core refactoring phase. This eleminary document will describe the steps required for a clean API for the core components of ethereum which includes the following packages: core, core/vm, core/state.

Topics

The following topics will see refactoring:

"de0b295669a9fd93d5f28d9ec85e40f4cb697bae": {
"balance": "11901464239480000000000000",
"nonce": 0,
"root": "858afe1eb769928c0cfac9169a6c0d56f938504713c835757a2becec48917e71",
"codeHash": "455cfd3b87eddf1a20355ff64153db6a17d653645bbead18986fca09a7dffeba",
"storage": {
"0000000000000000000000000000000000000000000000000000000000000000": "04",
"0000000000000000000000000000000000000000000000000000000000000001": "07",
"0000000000000000000000000000000000000000000000000000000000000003": "9405096a47749d8bfab0a90c1bb7a95115dbe4cea6",
"0000000000000000000000000000000000000000000000000000000000000004": "947c56d94ebeccb769524379c450873519a9d805ff",
I0729 13:36:25.889333 74181 flags.go:378] WARNING: No etherbase set and no accounts found as default
I0729 13:36:25.895422 74181 backend.go:288] Protocol Versions: [61 60], Network Id: 0
I0729 13:36:25.895676 74181 backend.go:300] Successfully wrote genesis block. New genesis hash = 476017333ababfe1b1ddefab4c8e2af2a492ca1648c85fac1e37a10018987a94
I0729 13:36:25.895702 74181 backend.go:317] Blockchain DB Version: 3
I0729 13:36:25.895779 74181 chain_manager.go:257] Last block (#0) 476017333ababfe1b1ddefab4c8e2af2a492ca1648c85fac1e37a10018987a94 TD=512
I0729 13:36:25.899634 74181 cmd.go:121] Starting Geth/v0.9.39/darwin/go1.4
I0729 13:36:25.899712 74181 server.go:311] Starting Server
I0729 13:36:27.996877 74181 udp.go:205] Listening, enode://55640096ae9316e8a9f1e0dcccd4b91d3e2d3b6f32e05073bd0352e2ac89983b5d7066fdd4e2f80f2fc44bc993785329da7b4c7b47637c7210cf3b8a61acd959@[::]:30303
I0729 13:36:27.997026 74181 backend.go:542] Server started
I0729 13:36:27.997078 74181 server.go:548] Listening on

Frontier technical checklist: (FORK ME)

  • Build Geth release 1.0.0
    • git clone https://github.com/ethereum/go-ethereum.git; cd go-ethereum
    • git checkout release/1.0.0
    • make geth
  • Clean out old test net relics (export ETH=<data dir> default data dir on OS X ~/Library/Ethereum, Linux ~/.ethereum)
    • rm -rf $ETH/{blockchain,state,extra}
    • Make a backup of your old keys cp -r $ETH/keystore /path/to/backup/keystore.backup
  • Craft the genesis block
type IntPool struct {
pool chan *big.Int
}
// NewPool creates a new pool of big.Int
func NewIntPool(max int) *IntPool {
return &IntPool{
pool: make(chan *big.Int, max),
}
}
go tool yacc -o ast/cll.go ast/cll.y
conflicts: 1 shift/reduce
go install ./cmd/cllc
cllc --debug ./examples/basic.cll
AST
0 *ast.BlockStmt{
1 . List: []Stmt (len = 5) {
2 . . 0: *ast.GenDecl{
3 . . . Decl: *ast.DeclObj{
I0615 04:33:23.287472 32007 sync.go:232] Importing 1 explicitly fetched blocks
I0615 04:33:23.331168 32007 chain_manager.go:689] imported 1 block(s) (0 queued 0 ignored) including 5 txs in 42.831242ms. #605703 [44493635 / 44493635]
I0615 04:33:27.010420 32007 sync.go:141] Scheduling 1 hash announcements from a979fb575495b8d6
I0615 04:33:27.606898 32007 sync.go:178] Explicitly fetching 1 blocks from a979fb575495b8d6
I0615 04:33:27.661588 32007 sync.go:232] Importing 1 explicitly fetched blocks
I0615 04:33:27.801074 32007 chain_manager.go:689] imported 1 block(s) (0 queued 0 ignored) including 52 txs in 139.00873ms. #605702 [ed5d5ca5 / ed5d5ca5]
I0615 04:33:28.239829 32007 sync.go:141] Scheduling 1 hash announcements from a979fb575495b8d6
I0615 04:33:28.806855 32007 sync.go:178] Explicitly fetching 1 blocks from a979fb575495b8d6
I0615 04:33:29.005267 32007 sync.go:232] Importing 1 explicitly fetched blocks
I0615 04:33:29.031122 32007 chain_manager.go:689] imported 1 block(s) (0 queued 0 igno
goroutine 42 [running]:
net/http.func·011()
/usr/local/go/src/net/http/server.go:1130 +0xbb
github.com/ethereum/go-ethereum/eth.(*GasPriceOracle).SuggestPrice(0x0, 0x0)
/Users/jeffrey/go/src/github.com/ethereum/go-ethereum/eth/gasprice.go:158 +0x1d2
github.com/ethereum/go-ethereum/xeth.(*XEth).DefaultGasPrice(0xc20c770820, 0xc209472e00)
/Users/jeffrey/go/src/github.com/ethereum/go-ethereum/xeth/xeth.go:45 +0x2f
github.com/ethereum/go-ethereum/xeth.(*XEth).Call(0xc20c770820, 0xc20be850b0, 0x2a, 0xc20be85080, 0x2a, 0xc20a013408, 0x1, 0x0, 0x0, 0x0, ...)
/Users/jeffrey/go/src/github.com/ethereum/go-ethereum/xeth/xeth.go:838 +0x3c7
github.com/ethereum/go-ethereum/rpc.(*EthereumApi).doCall(0xc20b899420, 0xc20ad1a240, 0x86, 0x90, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)