diff --git a/.travis.yml b/.travis.yml index 2b3ff92f61..13211f7363 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ install: # - go get code.google.com/p/go.tools/cmd/goimports # - go get github.com/golang/lint/golint # - go get golang.org/x/tools/cmd/vet - - go get golang.org/x/tools/cmd/cover github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover before_script: # - gofmt -l -w . # - goimports -l -w . @@ -15,7 +15,7 @@ before_script: script: - make travis-test-with-coverage after_success: - - if [ "$COVERALLS_TOKEN" ]; then goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN; fi + - bash <(curl -s https://codecov.io/bash) env: global: - secure: "U2U1AmkU4NJBgKR/uUAebQY87cNL0+1JHjnLOmmXwxYYyj5ralWb1aSuSH3qSXiT93qLBmtaUkuv9fberHVqrbAeVlztVdUsKAq7JMQH+M99iFkC9UiRMqHmtjWJ0ok4COD1sRYixxi21wb/JrMe3M1iL4QJVS61iltjHhVdM64=" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..918a2c1546 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,9 @@ +If you'd like to contribute to go-ethereum please fork, fix, commit and +send a pull request. Commits who do not comply with the coding standards +are ignored (use gofmt!). If you send pull requests make absolute sure that you +commit on the `develop` branch and that you do not merge to master. +Commits that are directly based on master are simply ignored. + +See [Developers' Guide](https://github.com/ethereum/go-ethereum/wiki/Developers'-Guide) +for more details on configuring your environment, testing, and +dependency management. diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 199914baa4..d5c41227dc 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -24,14 +24,18 @@ "Comment": "v23.1-227-g8f6ccaa", "Rev": "8f6ccaaef9b418553807a73a95cb5f49cd3ea39f" }, + { + "ImportPath": "github.com/fatih/color", + "Comment": "v0.1-5-gf773d4c", + "Rev": "f773d4c806cc8e4a5749d6a35e2a4bbcd71443d6" + }, { "ImportPath": "github.com/gizak/termui", "Rev": "bab8dce01c193d82bc04888a0a9a7814d505f532" }, { - "ImportPath": "github.com/howeyc/fsnotify", - "Comment": "v0.9.0-11-g6b1ef89", - "Rev": "6b1ef893dc11e0447abda6da20a5203481878dda" + "ImportPath": "github.com/hashicorp/golang-lru", + "Rev": "7f9ef20a0256f494e24126014135cf893ab71e9e" }, { "ImportPath": "github.com/huin/goupnp", @@ -45,10 +49,6 @@ "ImportPath": "github.com/kardianos/osext", "Rev": "ccfcd0245381f0c94c68f50626665eed3c6b726a" }, - { - "ImportPath": "github.com/mattn/go-colorable", - "Rev": "043ae16291351db8465272edf465c9f388161627" - }, { "ImportPath": "github.com/mattn/go-isatty", "Rev": "fdbe02a1b44e75977b2690062b83cf507d70c013" @@ -78,6 +78,10 @@ "ImportPath": "github.com/rs/cors", "Rev": "6e0c3cb65fc0fdb064c743d176a620e3ca446dfb" }, + { + "ImportPath": "github.com/shiena/ansicolor", + "Rev": "a5e2b567a4dd6cc74545b8a4f27c9d63b9e7735b" + }, { "ImportPath": "github.com/syndtr/goleveldb/leveldb", "Rev": "4875955338b0a434238a31165cb87255ab6e9e4a" diff --git a/Godeps/_workspace/src/github.com/fatih/color/.travis.yml b/Godeps/_workspace/src/github.com/fatih/color/.travis.yml new file mode 100644 index 0000000000..2405aef3a8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/.travis.yml @@ -0,0 +1,3 @@ +language: go +go: 1.3 + diff --git a/Godeps/_workspace/src/github.com/fatih/color/LICENSE.md b/Godeps/_workspace/src/github.com/fatih/color/LICENSE.md new file mode 100644 index 0000000000..25fdaf639d --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Fatih Arslan + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Godeps/_workspace/src/github.com/fatih/color/README.md b/Godeps/_workspace/src/github.com/fatih/color/README.md new file mode 100644 index 0000000000..d6fb06a3e3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/README.md @@ -0,0 +1,151 @@ +# Color [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/fatih/color) [![Build Status](http://img.shields.io/travis/fatih/color.svg?style=flat-square)](https://travis-ci.org/fatih/color) + + + +Color lets you use colorized outputs in terms of [ANSI Escape Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It has support for Windows too! The API can be used in several ways, pick one that suits you. + + + +![Color](http://i.imgur.com/c1JI0lA.png) + + +## Install + +```bash +go get github.com/fatih/color +``` + +## Examples + +### Standard colors + +```go +// Print with default helper functions +color.Cyan("Prints text in cyan.") + +// A newline will be appended automatically +color.Blue("Prints %s in blue.", "text") + +// These are using the default foreground colors +color.Red("We have red") +color.Magenta("And many others ..") + +``` + +### Mix and reuse colors + +```go +// Create a new color object +c := color.New(color.FgCyan).Add(color.Underline) +c.Println("Prints cyan text with an underline.") + +// Or just add them to New() +d := color.New(color.FgCyan, color.Bold) +d.Printf("This prints bold cyan %s\n", "too!.") + +// Mix up foreground and background colors, create new mixes! +red := color.New(color.FgRed) + +boldRed := red.Add(color.Bold) +boldRed.Println("This will print text in bold red.") + +whiteBackground := red.Add(color.BgWhite) +whiteBackground.Println("Red text with white background.") +``` + +### Custom print functions (PrintFunc) + +```go +// Create a custom print function for convenience +red := color.New(color.FgRed).PrintfFunc() +red("Warning") +red("Error: %s", err) + +// Mix up multiple attributes +notice := color.New(color.Bold, color.FgGreen).PrintlnFunc() +notice("Don't forget this...") +``` + +### Insert into noncolor strings (SprintFunc) + +```go +// Create SprintXxx functions to mix strings with other non-colorized strings: +yellow := color.New(color.FgYellow).SprintFunc() +red := color.New(color.FgRed).SprintFunc() +fmt.Printf("This is a %s and this is %s.\n", yellow("warning"), red("error")) + +info := color.New(color.FgWhite, color.BgGreen).SprintFunc() +fmt.Printf("This %s rocks!\n", info("package")) + +// Use helper functions +fmt.Printf("This", color.RedString("warning"), "should be not neglected.") +fmt.Printf(color.GreenString("Info:"), "an important message." ) + +// Windows supported too! Just don't forget to change the output to color.Output +fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS")) +``` + +### Plug into existing code + +```go +// Use handy standard colors +color.Set(color.FgYellow) + +fmt.Println("Existing text will now be in yellow") +fmt.Printf("This one %s\n", "too") + +color.Unset() // Don't forget to unset + +// You can mix up parameters +color.Set(color.FgMagenta, color.Bold) +defer color.Unset() // Use it in your function + +fmt.Println("All text will now be bold magenta.") +``` + +### Disable color + +There might be a case where you want to disable color output (for example to +pipe the standard output of your app to somewhere else). `Color` has support to +disable colors both globally and for single color definition. For example +suppose you have a CLI app and a `--no-color` bool flag. You can easily disable +the color output with: + +```go + +var flagNoColor = flag.Bool("no-color", false, "Disable color output") + +if *flagNoColor { + color.NoColor = true // disables colorized output +} +``` + +It also has support for single color definitions (local). You can +disable/enable color output on the fly: + +```go +c := color.New(color.FgCyan) +c.Println("Prints cyan text") + +c.DisableColor() +c.Println("This is printed without any color") + +c.EnableColor() +c.Println("This prints again cyan...") +``` + +## Todo + +* Save/Return previous values +* Evaluate fmt.Formatter interface + + +## Credits + + * [Fatih Arslan](https://github.com/fatih) + * Windows support via @shiena: [ansicolor](https://github.com/shiena/ansicolor) + +## License + +The MIT License (MIT) - see [`LICENSE.md`](https://github.com/fatih/color/blob/master/LICENSE.md) for more details + diff --git a/Godeps/_workspace/src/github.com/fatih/color/color.go b/Godeps/_workspace/src/github.com/fatih/color/color.go new file mode 100644 index 0000000000..c4a10c3c8d --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/color.go @@ -0,0 +1,353 @@ +package color + +import ( + "fmt" + "os" + "strconv" + "strings" + + "github.com/mattn/go-isatty" + "github.com/shiena/ansicolor" +) + +// NoColor defines if the output is colorized or not. It's dynamically set to +// false or true based on the stdout's file descriptor referring to a terminal +// or not. This is a global option and affects all colors. For more control +// over each color block use the methods DisableColor() individually. +var NoColor = !isatty.IsTerminal(os.Stdout.Fd()) + +// Color defines a custom color object which is defined by SGR parameters. +type Color struct { + params []Attribute + noColor *bool +} + +// Attribute defines a single SGR Code +type Attribute int + +const escape = "\x1b" + +// Base attributes +const ( + Reset Attribute = iota + Bold + Faint + Italic + Underline + BlinkSlow + BlinkRapid + ReverseVideo + Concealed + CrossedOut +) + +// Foreground text colors +const ( + FgBlack Attribute = iota + 30 + FgRed + FgGreen + FgYellow + FgBlue + FgMagenta + FgCyan + FgWhite +) + +// Background text colors +const ( + BgBlack Attribute = iota + 40 + BgRed + BgGreen + BgYellow + BgBlue + BgMagenta + BgCyan + BgWhite +) + +// New returns a newly created color object. +func New(value ...Attribute) *Color { + c := &Color{params: make([]Attribute, 0)} + c.Add(value...) + return c +} + +// Set sets the given parameters immediately. It will change the color of +// output with the given SGR parameters until color.Unset() is called. +func Set(p ...Attribute) *Color { + c := New(p...) + c.Set() + return c +} + +// Unset resets all escape attributes and clears the output. Usually should +// be called after Set(). +func Unset() { + if NoColor { + return + } + + fmt.Fprintf(Output, "%s[%dm", escape, Reset) +} + +// Set sets the SGR sequence. +func (c *Color) Set() *Color { + if c.isNoColorSet() { + return c + } + + fmt.Fprintf(Output, c.format()) + return c +} + +func (c *Color) unset() { + if c.isNoColorSet() { + return + } + + Unset() +} + +// Add is used to chain SGR parameters. Use as many as parameters to combine +// and create custom color objects. Example: Add(color.FgRed, color.Underline). +func (c *Color) Add(value ...Attribute) *Color { + c.params = append(c.params, value...) + return c +} + +func (c *Color) prepend(value Attribute) { + c.params = append(c.params, 0) + copy(c.params[1:], c.params[0:]) + c.params[0] = value +} + +// Output defines the standard output of the print functions. By default +// os.Stdout is used. +var Output = ansicolor.NewAnsiColorWriter(os.Stdout) + +// Print formats using the default formats for its operands and writes to +// standard output. Spaces are added between operands when neither is a +// string. It returns the number of bytes written and any write error +// encountered. This is the standard fmt.Print() method wrapped with the given +// color. +func (c *Color) Print(a ...interface{}) (n int, err error) { + c.Set() + defer c.unset() + + return fmt.Fprint(Output, a...) +} + +// Printf formats according to a format specifier and writes to standard output. +// It returns the number of bytes written and any write error encountered. +// This is the standard fmt.Printf() method wrapped with the given color. +func (c *Color) Printf(format string, a ...interface{}) (n int, err error) { + c.Set() + defer c.unset() + + return fmt.Fprintf(Output, format, a...) +} + +// Println formats using the default formats for its operands and writes to +// standard output. Spaces are always added between operands and a newline is +// appended. It returns the number of bytes written and any write error +// encountered. This is the standard fmt.Print() method wrapped with the given +// color. +func (c *Color) Println(a ...interface{}) (n int, err error) { + c.Set() + defer c.unset() + + return fmt.Fprintln(Output, a...) +} + +// PrintFunc returns a new function that prints the passed arguments as +// colorized with color.Print(). +func (c *Color) PrintFunc() func(a ...interface{}) { + return func(a ...interface{}) { c.Print(a...) } +} + +// PrintfFunc returns a new function that prints the passed arguments as +// colorized with color.Printf(). +func (c *Color) PrintfFunc() func(format string, a ...interface{}) { + return func(format string, a ...interface{}) { c.Printf(format, a...) } +} + +// PrintlnFunc returns a new function that prints the passed arguments as +// colorized with color.Println(). +func (c *Color) PrintlnFunc() func(a ...interface{}) { + return func(a ...interface{}) { c.Println(a...) } +} + +// SprintFunc returns a new function that returns colorized strings for the +// given arguments with fmt.Sprint(). Useful to put into or mix into other +// string. Windows users should use this in conjuction with color.Output, example: +// +// put := New(FgYellow).SprintFunc() +// fmt.Fprintf(color.Output, "This is a %s", put("warning")) +func (c *Color) SprintFunc() func(a ...interface{}) string { + return func(a ...interface{}) string { + return c.wrap(fmt.Sprint(a...)) + } +} + +// SprintfFunc returns a new function that returns colorized strings for the +// given arguments with fmt.Sprintf(). Useful to put into or mix into other +// string. Windows users should use this in conjuction with color.Output. +func (c *Color) SprintfFunc() func(format string, a ...interface{}) string { + return func(format string, a ...interface{}) string { + return c.wrap(fmt.Sprintf(format, a...)) + } +} + +// SprintlnFunc returns a new function that returns colorized strings for the +// given arguments with fmt.Sprintln(). Useful to put into or mix into other +// string. Windows users should use this in conjuction with color.Output. +func (c *Color) SprintlnFunc() func(a ...interface{}) string { + return func(a ...interface{}) string { + return c.wrap(fmt.Sprintln(a...)) + } +} + +// sequence returns a formated SGR sequence to be plugged into a "\x1b[...m" +// an example output might be: "1;36" -> bold cyan +func (c *Color) sequence() string { + format := make([]string, len(c.params)) + for i, v := range c.params { + format[i] = strconv.Itoa(int(v)) + } + + return strings.Join(format, ";") +} + +// wrap wraps the s string with the colors attributes. The string is ready to +// be printed. +func (c *Color) wrap(s string) string { + if c.isNoColorSet() { + return s + } + + return c.format() + s + c.unformat() +} + +func (c *Color) format() string { + return fmt.Sprintf("%s[%sm", escape, c.sequence()) +} + +func (c *Color) unformat() string { + return fmt.Sprintf("%s[%dm", escape, Reset) +} + +// DisableColor disables the color output. Useful to not change any existing +// code and still being able to output. Can be used for flags like +// "--no-color". To enable back use EnableColor() method. +func (c *Color) DisableColor() { + c.noColor = boolPtr(true) +} + +// EnableColor enables the color output. Use it in conjuction with +// DisableColor(). Otherwise this method has no side effects. +func (c *Color) EnableColor() { + c.noColor = boolPtr(false) +} + +func (c *Color) isNoColorSet() bool { + // check first if we have user setted action + if c.noColor != nil { + return *c.noColor + } + + // if not return the global option, which is disabled by default + return NoColor +} + +func boolPtr(v bool) *bool { + return &v +} + +// Black is an convenient helper function to print with black foreground. A +// newline is appended to format by default. +func Black(format string, a ...interface{}) { printColor(format, FgBlack, a...) } + +// Red is an convenient helper function to print with red foreground. A +// newline is appended to format by default. +func Red(format string, a ...interface{}) { printColor(format, FgRed, a...) } + +// Green is an convenient helper function to print with green foreground. A +// newline is appended to format by default. +func Green(format string, a ...interface{}) { printColor(format, FgGreen, a...) } + +// Yellow is an convenient helper function to print with yellow foreground. +// A newline is appended to format by default. +func Yellow(format string, a ...interface{}) { printColor(format, FgYellow, a...) } + +// Blue is an convenient helper function to print with blue foreground. A +// newline is appended to format by default. +func Blue(format string, a ...interface{}) { printColor(format, FgBlue, a...) } + +// Magenta is an convenient helper function to print with magenta foreground. +// A newline is appended to format by default. +func Magenta(format string, a ...interface{}) { printColor(format, FgMagenta, a...) } + +// Cyan is an convenient helper function to print with cyan foreground. A +// newline is appended to format by default. +func Cyan(format string, a ...interface{}) { printColor(format, FgCyan, a...) } + +// White is an convenient helper function to print with white foreground. A +// newline is appended to format by default. +func White(format string, a ...interface{}) { printColor(format, FgWhite, a...) } + +func printColor(format string, p Attribute, a ...interface{}) { + if !strings.HasSuffix(format, "\n") { + format += "\n" + } + + c := &Color{params: []Attribute{p}} + c.Printf(format, a...) +} + +// BlackString is an convenient helper function to return a string with black +// foreground. +func BlackString(format string, a ...interface{}) string { + return New(FgBlack).SprintfFunc()(format, a...) +} + +// RedString is an convenient helper function to return a string with red +// foreground. +func RedString(format string, a ...interface{}) string { + return New(FgRed).SprintfFunc()(format, a...) +} + +// GreenString is an convenient helper function to return a string with green +// foreground. +func GreenString(format string, a ...interface{}) string { + return New(FgGreen).SprintfFunc()(format, a...) +} + +// YellowString is an convenient helper function to return a string with yellow +// foreground. +func YellowString(format string, a ...interface{}) string { + return New(FgYellow).SprintfFunc()(format, a...) +} + +// BlueString is an convenient helper function to return a string with blue +// foreground. +func BlueString(format string, a ...interface{}) string { + return New(FgBlue).SprintfFunc()(format, a...) +} + +// MagentaString is an convenient helper function to return a string with magenta +// foreground. +func MagentaString(format string, a ...interface{}) string { + return New(FgMagenta).SprintfFunc()(format, a...) +} + +// CyanString is an convenient helper function to return a string with cyan +// foreground. +func CyanString(format string, a ...interface{}) string { + return New(FgCyan).SprintfFunc()(format, a...) +} + +// WhiteString is an convenient helper function to return a string with white +// foreground. +func WhiteString(format string, a ...interface{}) string { + return New(FgWhite).SprintfFunc()(format, a...) +} diff --git a/Godeps/_workspace/src/github.com/fatih/color/color_test.go b/Godeps/_workspace/src/github.com/fatih/color/color_test.go new file mode 100644 index 0000000000..a1192b559d --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/color_test.go @@ -0,0 +1,176 @@ +package color + +import ( + "bytes" + "fmt" + "os" + "testing" + + "github.com/shiena/ansicolor" +) + +// Testing colors is kinda different. First we test for given colors and their +// escaped formatted results. Next we create some visual tests to be tested. +// Each visual test includes the color name to be compared. +func TestColor(t *testing.T) { + rb := new(bytes.Buffer) + Output = rb + + testColors := []struct { + text string + code Attribute + }{ + {text: "black", code: FgBlack}, + {text: "red", code: FgRed}, + {text: "green", code: FgGreen}, + {text: "yellow", code: FgYellow}, + {text: "blue", code: FgBlue}, + {text: "magent", code: FgMagenta}, + {text: "cyan", code: FgCyan}, + {text: "white", code: FgWhite}, + } + + for _, c := range testColors { + New(c.code).Print(c.text) + + line, _ := rb.ReadString('\n') + scannedLine := fmt.Sprintf("%q", line) + colored := fmt.Sprintf("\x1b[%dm%s\x1b[0m", c.code, c.text) + escapedForm := fmt.Sprintf("%q", colored) + + fmt.Printf("%s\t: %s\n", c.text, line) + + if scannedLine != escapedForm { + t.Errorf("Expecting %s, got '%s'\n", escapedForm, scannedLine) + } + } +} + +func TestNoColor(t *testing.T) { + rb := new(bytes.Buffer) + Output = rb + + testColors := []struct { + text string + code Attribute + }{ + {text: "black", code: FgBlack}, + {text: "red", code: FgRed}, + {text: "green", code: FgGreen}, + {text: "yellow", code: FgYellow}, + {text: "blue", code: FgBlue}, + {text: "magent", code: FgMagenta}, + {text: "cyan", code: FgCyan}, + {text: "white", code: FgWhite}, + } + + for _, c := range testColors { + p := New(c.code) + p.DisableColor() + p.Print(c.text) + + line, _ := rb.ReadString('\n') + if line != c.text { + t.Errorf("Expecting %s, got '%s'\n", c.text, line) + } + } + + // global check + NoColor = true + defer func() { + NoColor = false + }() + for _, c := range testColors { + p := New(c.code) + p.Print(c.text) + + line, _ := rb.ReadString('\n') + if line != c.text { + t.Errorf("Expecting %s, got '%s'\n", c.text, line) + } + } + +} + +func TestColorVisual(t *testing.T) { + // First Visual Test + fmt.Println("") + Output = ansicolor.NewAnsiColorWriter(os.Stdout) + + New(FgRed).Printf("red\t") + New(BgRed).Print(" ") + New(FgRed, Bold).Println(" red") + + New(FgGreen).Printf("green\t") + New(BgGreen).Print(" ") + New(FgGreen, Bold).Println(" green") + + New(FgYellow).Printf("yellow\t") + New(BgYellow).Print(" ") + New(FgYellow, Bold).Println(" yellow") + + New(FgBlue).Printf("blue\t") + New(BgBlue).Print(" ") + New(FgBlue, Bold).Println(" blue") + + New(FgMagenta).Printf("magenta\t") + New(BgMagenta).Print(" ") + New(FgMagenta, Bold).Println(" magenta") + + New(FgCyan).Printf("cyan\t") + New(BgCyan).Print(" ") + New(FgCyan, Bold).Println(" cyan") + + New(FgWhite).Printf("white\t") + New(BgWhite).Print(" ") + New(FgWhite, Bold).Println(" white") + fmt.Println("") + + // Second Visual test + Black("black") + Red("red") + Green("green") + Yellow("yellow") + Blue("blue") + Magenta("magenta") + Cyan("cyan") + White("white") + + // Third visual test + fmt.Println() + Set(FgBlue) + fmt.Println("is this blue?") + Unset() + + Set(FgMagenta) + fmt.Println("and this magenta?") + Unset() + + // Fourth Visual test + fmt.Println() + blue := New(FgBlue).PrintlnFunc() + blue("blue text with custom print func") + + red := New(FgRed).PrintfFunc() + red("red text with a printf func: %d\n", 123) + + put := New(FgYellow).SprintFunc() + warn := New(FgRed).SprintFunc() + + fmt.Fprintf(Output, "this is a %s and this is %s.\n", put("warning"), warn("error")) + + info := New(FgWhite, BgGreen).SprintFunc() + fmt.Fprintf(Output, "this %s rocks!\n", info("package")) + + // Fifth Visual Test + fmt.Println() + + fmt.Fprintln(Output, BlackString("black")) + fmt.Fprintln(Output, RedString("red")) + fmt.Fprintln(Output, GreenString("green")) + fmt.Fprintln(Output, YellowString("yellow")) + fmt.Fprintln(Output, BlueString("blue")) + fmt.Fprintln(Output, MagentaString("magenta")) + fmt.Fprintln(Output, CyanString("cyan")) + fmt.Fprintln(Output, WhiteString("white")) +} diff --git a/Godeps/_workspace/src/github.com/fatih/color/doc.go b/Godeps/_workspace/src/github.com/fatih/color/doc.go new file mode 100644 index 0000000000..17908787c9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/doc.go @@ -0,0 +1,114 @@ +/* +Package color is an ANSI color package to output colorized or SGR defined +output to the standard output. The API can be used in several way, pick one +that suits you. + +Use simple and default helper functions with predefined foreground colors: + + color.Cyan("Prints text in cyan.") + + // a newline will be appended automatically + color.Blue("Prints %s in blue.", "text") + + // More default foreground colors.. + color.Red("We have red") + color.Yellow("Yellow color too!") + color.Magenta("And many others ..") + +However there are times where custom color mixes are required. Below are some +examples to create custom color objects and use the print functions of each +separate color object. + + // Create a new color object + c := color.New(color.FgCyan).Add(color.Underline) + c.Println("Prints cyan text with an underline.") + + // Or just add them to New() + d := color.New(color.FgCyan, color.Bold) + d.Printf("This prints bold cyan %s\n", "too!.") + + + // Mix up foreground and background colors, create new mixes! + red := color.New(color.FgRed) + + boldRed := red.Add(color.Bold) + boldRed.Println("This will print text in bold red.") + + whiteBackground := red.Add(color.BgWhite) + whiteBackground.Println("Red text with White background.") + + +You can create PrintXxx functions to simplify even more: + + // Create a custom print function for convenient + red := color.New(color.FgRed).PrintfFunc() + red("warning") + red("error: %s", err) + + // Mix up multiple attributes + notice := color.New(color.Bold, color.FgGreen).PrintlnFunc() + notice("don't forget this...") + + +Or create SprintXxx functions to mix strings with other non-colorized strings: + + yellow := New(FgYellow).SprintFunc() + red := New(FgRed).SprintFunc() + + fmt.Printf("this is a %s and this is %s.\n", yellow("warning"), red("error")) + + info := New(FgWhite, BgGreen).SprintFunc() + fmt.Printf("this %s rocks!\n", info("package")) + +Windows support is enabled by default. All Print functions works as intended. +However only for color.SprintXXX functions, user should use fmt.FprintXXX and +set the output to color.Output: + + fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS")) + + info := New(FgWhite, BgGreen).SprintFunc() + fmt.Fprintf(color.Output, "this %s rocks!\n", info("package")) + +Using with existing code is possible. Just use the Set() method to set the +standard output to the given parameters. That way a rewrite of an existing +code is not required. + + // Use handy standard colors. + color.Set(color.FgYellow) + + fmt.Println("Existing text will be now in Yellow") + fmt.Printf("This one %s\n", "too") + + color.Unset() // don't forget to unset + + // You can mix up parameters + color.Set(color.FgMagenta, color.Bold) + defer color.Unset() // use it in your function + + fmt.Println("All text will be now bold magenta.") + +There might be a case where you want to disable color output (for example to +pipe the standard output of your app to somewhere else). `Color` has support to +disable colors both globally and for single color definition. For example +suppose you have a CLI app and a `--no-color` bool flag. You can easily disable +the color output with: + + var flagNoColor = flag.Bool("no-color", false, "Disable color output") + + if *flagNoColor { + color.NoColor = true // disables colorized output + } + +It also has support for single color definitions (local). You can +disable/enable color output on the fly: + + c := color.New(color.FgCyan) + c.Println("Prints cyan text") + + c.DisableColor() + c.Println("This is printed without any color") + + c.EnableColor() + c.Println("This prints again cyan...") +*/ +package color diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go b/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go index 3f4606af0f..862c3def42 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go @@ -9,8 +9,6 @@ import ( "net/http" "sync" "time" - - "github.com/ethereum/go-ethereum/fdtrack" ) // HTTPUClient is a client for dealing with HTTPU (HTTP over UDP). Its typical @@ -27,7 +25,6 @@ func NewHTTPUClient() (*HTTPUClient, error) { if err != nil { return nil, err } - fdtrack.Open("upnp") return &HTTPUClient{conn: conn}, nil } @@ -36,7 +33,6 @@ func NewHTTPUClient() (*HTTPUClient, error) { func (httpu *HTTPUClient) Close() error { httpu.connLock.Lock() defer httpu.connLock.Unlock() - fdtrack.Close("upnp") return httpu.conn.Close() } diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go b/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go index 786ce6fa84..815610734c 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go @@ -7,12 +7,9 @@ import ( "encoding/xml" "fmt" "io/ioutil" - "net" "net/http" "net/url" "reflect" - - "github.com/ethereum/go-ethereum/fdtrack" ) const ( @@ -29,17 +26,6 @@ type SOAPClient struct { func NewSOAPClient(endpointURL url.URL) *SOAPClient { return &SOAPClient{ EndpointURL: endpointURL, - HTTPClient: http.Client{ - Transport: &http.Transport{ - Dial: func(network, addr string) (net.Conn, error) { - c, err := net.Dial(network, addr) - if c != nil { - c = fdtrack.WrapConn("upnp", c) - } - return c, err - }, - }, - }, } } diff --git a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go b/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go index b165c784e3..8ce4e8342e 100644 --- a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go +++ b/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go @@ -5,8 +5,6 @@ import ( "log" "net" "time" - - "github.com/ethereum/go-ethereum/fdtrack" ) // Implement the NAT-PMP protocol, typically supported by Apple routers and open source @@ -104,8 +102,6 @@ func (n *Client) rpc(msg []byte, resultSize int) (result []byte, err error) { if err != nil { return } - fdtrack.Open("natpmp") - defer fdtrack.Close("natpmp") defer conn.Close() result = make([]byte, resultSize) diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/README.md b/Godeps/_workspace/src/github.com/mattn/go-colorable/README.md deleted file mode 100644 index c69da4a761..0000000000 --- a/Godeps/_workspace/src/github.com/mattn/go-colorable/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# go-colorable - -Colorable writer for windows. - -For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) -This package is possible to handle escape sequence for ansi color on windows. - -## Too Bad! - -![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) - - -## So Good! - -![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) - -## Usage - -```go -logrus.SetOutput(colorable.NewColorableStdout()) - -logrus.Info("succeeded") -logrus.Warn("not correct") -logrus.Error("something error") -logrus.Fatal("panic") -``` - -You can compile above code on non-windows OSs. - -## Installation - -``` -$ go get github.com/mattn/go-colorable -``` - -# License - -MIT - -# Author - -Yasuhiro Matsumoto (a.k.a mattn) diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go b/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go deleted file mode 100644 index 219f02f62a..0000000000 --- a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build !windows - -package colorable - -import ( - "io" - "os" -) - -func NewColorableStdout() io.Writer { - return os.Stdout -} - -func NewColorableStderr() io.Writer { - return os.Stderr -} diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go b/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go deleted file mode 100644 index 6a27878088..0000000000 --- a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go +++ /dev/null @@ -1,594 +0,0 @@ -package colorable - -import ( - "bytes" - "fmt" - "io" - "os" - "strconv" - "strings" - "syscall" - "unsafe" - - "github.com/mattn/go-isatty" -) - -const ( - foregroundBlue = 0x1 - foregroundGreen = 0x2 - foregroundRed = 0x4 - foregroundIntensity = 0x8 - foregroundMask = (foregroundRed | foregroundBlue | foregroundGreen | foregroundIntensity) - backgroundBlue = 0x10 - backgroundGreen = 0x20 - backgroundRed = 0x40 - backgroundIntensity = 0x80 - backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity) -) - -type wchar uint16 -type short int16 -type dword uint32 -type word uint16 - -type coord struct { - x short - y short -} - -type smallRect struct { - left short - top short - right short - bottom short -} - -type consoleScreenBufferInfo struct { - size coord - cursorPosition coord - attributes word - window smallRect - maximumWindowSize coord -} - -var ( - kernel32 = syscall.NewLazyDLL("kernel32.dll") - procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo") - procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute") -) - -type Writer struct { - out io.Writer - handle syscall.Handle - lastbuf bytes.Buffer - oldattr word -} - -func NewColorableStdout() io.Writer { - var csbi consoleScreenBufferInfo - out := os.Stdout - if !isatty.IsTerminal(out.Fd()) { - return out - } - handle := syscall.Handle(out.Fd()) - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - return &Writer{out: out, handle: handle, oldattr: csbi.attributes} -} - -func NewColorableStderr() io.Writer { - var csbi consoleScreenBufferInfo - out := os.Stderr - if !isatty.IsTerminal(out.Fd()) { - return out - } - handle := syscall.Handle(out.Fd()) - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - return &Writer{out: out, handle: handle, oldattr: csbi.attributes} -} - -var color256 = map[int]int{ - 0: 0x000000, - 1: 0x800000, - 2: 0x008000, - 3: 0x808000, - 4: 0x000080, - 5: 0x800080, - 6: 0x008080, - 7: 0xc0c0c0, - 8: 0x808080, - 9: 0xff0000, - 10: 0x00ff00, - 11: 0xffff00, - 12: 0x0000ff, - 13: 0xff00ff, - 14: 0x00ffff, - 15: 0xffffff, - 16: 0x000000, - 17: 0x00005f, - 18: 0x000087, - 19: 0x0000af, - 20: 0x0000d7, - 21: 0x0000ff, - 22: 0x005f00, - 23: 0x005f5f, - 24: 0x005f87, - 25: 0x005faf, - 26: 0x005fd7, - 27: 0x005fff, - 28: 0x008700, - 29: 0x00875f, - 30: 0x008787, - 31: 0x0087af, - 32: 0x0087d7, - 33: 0x0087ff, - 34: 0x00af00, - 35: 0x00af5f, - 36: 0x00af87, - 37: 0x00afaf, - 38: 0x00afd7, - 39: 0x00afff, - 40: 0x00d700, - 41: 0x00d75f, - 42: 0x00d787, - 43: 0x00d7af, - 44: 0x00d7d7, - 45: 0x00d7ff, - 46: 0x00ff00, - 47: 0x00ff5f, - 48: 0x00ff87, - 49: 0x00ffaf, - 50: 0x00ffd7, - 51: 0x00ffff, - 52: 0x5f0000, - 53: 0x5f005f, - 54: 0x5f0087, - 55: 0x5f00af, - 56: 0x5f00d7, - 57: 0x5f00ff, - 58: 0x5f5f00, - 59: 0x5f5f5f, - 60: 0x5f5f87, - 61: 0x5f5faf, - 62: 0x5f5fd7, - 63: 0x5f5fff, - 64: 0x5f8700, - 65: 0x5f875f, - 66: 0x5f8787, - 67: 0x5f87af, - 68: 0x5f87d7, - 69: 0x5f87ff, - 70: 0x5faf00, - 71: 0x5faf5f, - 72: 0x5faf87, - 73: 0x5fafaf, - 74: 0x5fafd7, - 75: 0x5fafff, - 76: 0x5fd700, - 77: 0x5fd75f, - 78: 0x5fd787, - 79: 0x5fd7af, - 80: 0x5fd7d7, - 81: 0x5fd7ff, - 82: 0x5fff00, - 83: 0x5fff5f, - 84: 0x5fff87, - 85: 0x5fffaf, - 86: 0x5fffd7, - 87: 0x5fffff, - 88: 0x870000, - 89: 0x87005f, - 90: 0x870087, - 91: 0x8700af, - 92: 0x8700d7, - 93: 0x8700ff, - 94: 0x875f00, - 95: 0x875f5f, - 96: 0x875f87, - 97: 0x875faf, - 98: 0x875fd7, - 99: 0x875fff, - 100: 0x878700, - 101: 0x87875f, - 102: 0x878787, - 103: 0x8787af, - 104: 0x8787d7, - 105: 0x8787ff, - 106: 0x87af00, - 107: 0x87af5f, - 108: 0x87af87, - 109: 0x87afaf, - 110: 0x87afd7, - 111: 0x87afff, - 112: 0x87d700, - 113: 0x87d75f, - 114: 0x87d787, - 115: 0x87d7af, - 116: 0x87d7d7, - 117: 0x87d7ff, - 118: 0x87ff00, - 119: 0x87ff5f, - 120: 0x87ff87, - 121: 0x87ffaf, - 122: 0x87ffd7, - 123: 0x87ffff, - 124: 0xaf0000, - 125: 0xaf005f, - 126: 0xaf0087, - 127: 0xaf00af, - 128: 0xaf00d7, - 129: 0xaf00ff, - 130: 0xaf5f00, - 131: 0xaf5f5f, - 132: 0xaf5f87, - 133: 0xaf5faf, - 134: 0xaf5fd7, - 135: 0xaf5fff, - 136: 0xaf8700, - 137: 0xaf875f, - 138: 0xaf8787, - 139: 0xaf87af, - 140: 0xaf87d7, - 141: 0xaf87ff, - 142: 0xafaf00, - 143: 0xafaf5f, - 144: 0xafaf87, - 145: 0xafafaf, - 146: 0xafafd7, - 147: 0xafafff, - 148: 0xafd700, - 149: 0xafd75f, - 150: 0xafd787, - 151: 0xafd7af, - 152: 0xafd7d7, - 153: 0xafd7ff, - 154: 0xafff00, - 155: 0xafff5f, - 156: 0xafff87, - 157: 0xafffaf, - 158: 0xafffd7, - 159: 0xafffff, - 160: 0xd70000, - 161: 0xd7005f, - 162: 0xd70087, - 163: 0xd700af, - 164: 0xd700d7, - 165: 0xd700ff, - 166: 0xd75f00, - 167: 0xd75f5f, - 168: 0xd75f87, - 169: 0xd75faf, - 170: 0xd75fd7, - 171: 0xd75fff, - 172: 0xd78700, - 173: 0xd7875f, - 174: 0xd78787, - 175: 0xd787af, - 176: 0xd787d7, - 177: 0xd787ff, - 178: 0xd7af00, - 179: 0xd7af5f, - 180: 0xd7af87, - 181: 0xd7afaf, - 182: 0xd7afd7, - 183: 0xd7afff, - 184: 0xd7d700, - 185: 0xd7d75f, - 186: 0xd7d787, - 187: 0xd7d7af, - 188: 0xd7d7d7, - 189: 0xd7d7ff, - 190: 0xd7ff00, - 191: 0xd7ff5f, - 192: 0xd7ff87, - 193: 0xd7ffaf, - 194: 0xd7ffd7, - 195: 0xd7ffff, - 196: 0xff0000, - 197: 0xff005f, - 198: 0xff0087, - 199: 0xff00af, - 200: 0xff00d7, - 201: 0xff00ff, - 202: 0xff5f00, - 203: 0xff5f5f, - 204: 0xff5f87, - 205: 0xff5faf, - 206: 0xff5fd7, - 207: 0xff5fff, - 208: 0xff8700, - 209: 0xff875f, - 210: 0xff8787, - 211: 0xff87af, - 212: 0xff87d7, - 213: 0xff87ff, - 214: 0xffaf00, - 215: 0xffaf5f, - 216: 0xffaf87, - 217: 0xffafaf, - 218: 0xffafd7, - 219: 0xffafff, - 220: 0xffd700, - 221: 0xffd75f, - 222: 0xffd787, - 223: 0xffd7af, - 224: 0xffd7d7, - 225: 0xffd7ff, - 226: 0xffff00, - 227: 0xffff5f, - 228: 0xffff87, - 229: 0xffffaf, - 230: 0xffffd7, - 231: 0xffffff, - 232: 0x080808, - 233: 0x121212, - 234: 0x1c1c1c, - 235: 0x262626, - 236: 0x303030, - 237: 0x3a3a3a, - 238: 0x444444, - 239: 0x4e4e4e, - 240: 0x585858, - 241: 0x626262, - 242: 0x6c6c6c, - 243: 0x767676, - 244: 0x808080, - 245: 0x8a8a8a, - 246: 0x949494, - 247: 0x9e9e9e, - 248: 0xa8a8a8, - 249: 0xb2b2b2, - 250: 0xbcbcbc, - 251: 0xc6c6c6, - 252: 0xd0d0d0, - 253: 0xdadada, - 254: 0xe4e4e4, - 255: 0xeeeeee, -} - -func (w *Writer) Write(data []byte) (n int, err error) { - var csbi consoleScreenBufferInfo - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) - - er := bytes.NewBuffer(data) -loop: - for { - r1, _, err := procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) - if r1 == 0 { - break loop - } - - c1, _, err := er.ReadRune() - if err != nil { - break loop - } - if c1 != 0x1b { - fmt.Fprint(w.out, string(c1)) - continue - } - c2, _, err := er.ReadRune() - if err != nil { - w.lastbuf.WriteRune(c1) - break loop - } - if c2 != 0x5b { - w.lastbuf.WriteRune(c1) - w.lastbuf.WriteRune(c2) - continue - } - - var buf bytes.Buffer - var m rune - for { - c, _, err := er.ReadRune() - if err != nil { - w.lastbuf.WriteRune(c1) - w.lastbuf.WriteRune(c2) - w.lastbuf.Write(buf.Bytes()) - break loop - } - if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { - m = c - break - } - buf.Write([]byte(string(c))) - } - - switch m { - case 'm': - attr := csbi.attributes - cs := buf.String() - if cs == "" { - procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(w.oldattr)) - continue - } - token := strings.Split(cs, ";") - for i, ns := range token { - if n, err = strconv.Atoi(ns); err == nil { - switch { - case n == 0 || n == 100: - attr = w.oldattr - case 1 <= n && n <= 5: - attr |= foregroundIntensity - case n == 7: - attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) - case 22 == n || n == 25 || n == 25: - attr |= foregroundIntensity - case n == 27: - attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) - case 30 <= n && n <= 37: - attr = (attr & backgroundMask) - if (n-30)&1 != 0 { - attr |= foregroundRed - } - if (n-30)&2 != 0 { - attr |= foregroundGreen - } - if (n-30)&4 != 0 { - attr |= foregroundBlue - } - case n == 38: // set foreground color. - if i < len(token)-2 && token[i+1] == "5" { - if n256, err := strconv.Atoi(token[i+2]); err == nil { - if n256foreAttr == nil { - n256setup() - } - attr &= backgroundMask - attr |= n256foreAttr[n256] - i += 2 - } - } else { - attr = attr & (w.oldattr & backgroundMask) - } - case n == 39: // reset foreground color. - attr &= backgroundMask - attr |= w.oldattr & foregroundMask - case 40 <= n && n <= 47: - attr = (attr & foregroundMask) - if (n-40)&1 != 0 { - attr |= backgroundRed - } - if (n-40)&2 != 0 { - attr |= backgroundGreen - } - if (n-40)&4 != 0 { - attr |= backgroundBlue - } - case n == 48: // set background color. - if i < len(token)-2 && token[i+1] == "5" { - if n256, err := strconv.Atoi(token[i+2]); err == nil { - if n256backAttr == nil { - n256setup() - } - attr &= foregroundMask - attr |= n256backAttr[n256] - i += 2 - } - } else { - attr = attr & (w.oldattr & foregroundMask) - } - case n == 49: // reset foreground color. - attr &= foregroundMask - attr |= w.oldattr & backgroundMask - } - procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(attr)) - } - } - } - } - return len(data) - w.lastbuf.Len(), nil -} - -type consoleColor struct { - red bool - green bool - blue bool - intensity bool -} - -func minmax3(a, b, c int) (min, max int) { - if a < b { - if b < c { - return a, c - } else if a < c { - return a, b - } else { - return c, b - } - } else { - if a < c { - return b, c - } else if b < c { - return b, a - } else { - return c, a - } - } -} - -func toConsoleColor(rgb int) (c consoleColor) { - r, g, b := (rgb&0xFF0000)>>16, (rgb&0x00FF00)>>8, rgb&0x0000FF - min, max := minmax3(r, g, b) - a := (min + max) / 2 - if r < 128 && g < 128 && b < 128 { - if r >= a { - c.red = true - } - if g >= a { - c.green = true - } - if b >= a { - c.blue = true - } - // non-intensed white is lighter than intensed black, so swap those. - if c.red && c.green && c.blue { - c.red, c.green, c.blue = false, false, false - c.intensity = true - } - } else { - if min < 128 { - min = 128 - a = (min + max) / 2 - } - if r >= a { - c.red = true - } - if g >= a { - c.green = true - } - if b >= a { - c.blue = true - } - c.intensity = true - // intensed black is darker than non-intensed white, so swap those. - if !c.red && !c.green && !c.blue { - c.red, c.green, c.blue = true, true, true - c.intensity = false - } - } - return c -} - -func (c consoleColor) foregroundAttr() (attr word) { - if c.red { - attr |= foregroundRed - } - if c.green { - attr |= foregroundGreen - } - if c.blue { - attr |= foregroundBlue - } - if c.intensity { - attr |= foregroundIntensity - } - return -} - -func (c consoleColor) backgroundAttr() (attr word) { - if c.red { - attr |= backgroundRed - } - if c.green { - attr |= backgroundGreen - } - if c.blue { - attr |= backgroundBlue - } - if c.intensity { - attr |= backgroundIntensity - } - return -} - -var n256foreAttr []word -var n256backAttr []word - -func n256setup() { - n256foreAttr = make([]word, 256) - n256backAttr = make([]word, 256) - for i, rgb := range color256 { - c := toConsoleColor(rgb) - n256foreAttr[i] = c.foregroundAttr() - n256backAttr[i] = c.backgroundAttr() - } -} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore b/Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore new file mode 100644 index 0000000000..69cec52c4e --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore @@ -0,0 +1,27 @@ +# Created by http://www.gitignore.io + +### Go ### +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test + diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/LICENSE b/Godeps/_workspace/src/github.com/shiena/ansicolor/LICENSE new file mode 100644 index 0000000000..e58473ed94 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) [2014] [shiena] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/README.md b/Godeps/_workspace/src/github.com/shiena/ansicolor/README.md new file mode 100644 index 0000000000..7797a4f186 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/README.md @@ -0,0 +1,100 @@ +[![GoDoc](https://godoc.org/github.com/shiena/ansicolor?status.svg)](https://godoc.org/github.com/shiena/ansicolor) + +# ansicolor + +Ansicolor library provides color console in Windows as ANSICON for Golang. + +## Features + +|Escape sequence|Text attributes| +|---------------|----| +|\x1b[0m|All attributes off(color at startup)| +|\x1b[1m|Bold on(enable foreground intensity)| +|\x1b[4m|Underline on| +|\x1b[5m|Blink on(enable background intensity)| +|\x1b[21m|Bold off(disable foreground intensity)| +|\x1b[24m|Underline off| +|\x1b[25m|Blink off(disable background intensity)| + +|Escape sequence|Foreground colors| +|---------------|----| +|\x1b[30m|Black| +|\x1b[31m|Red| +|\x1b[32m|Green| +|\x1b[33m|Yellow| +|\x1b[34m|Blue| +|\x1b[35m|Magenta| +|\x1b[36m|Cyan| +|\x1b[37m|White| +|\x1b[39m|Default(foreground color at startup)| +|\x1b[90m|Light Gray| +|\x1b[91m|Light Red| +|\x1b[92m|Light Green| +|\x1b[93m|Light Yellow| +|\x1b[94m|Light Blue| +|\x1b[95m|Light Magenta| +|\x1b[96m|Light Cyan| +|\x1b[97m|Light White| + +|Escape sequence|Background colors| +|---------------|----| +|\x1b[40m|Black| +|\x1b[41m|Red| +|\x1b[42m|Green| +|\x1b[43m|Yellow| +|\x1b[44m|Blue| +|\x1b[45m|Magenta| +|\x1b[46m|Cyan| +|\x1b[47m|White| +|\x1b[49m|Default(background color at startup)| +|\x1b[100m|Light Gray| +|\x1b[101m|Light Red| +|\x1b[102m|Light Green| +|\x1b[103m|Light Yellow| +|\x1b[104m|Light Blue| +|\x1b[105m|Light Magenta| +|\x1b[106m|Light Cyan| +|\x1b[107m|Light White| + +## Example + +```go +package main + +import ( + "fmt" + "os" + + "github.com/shiena/ansicolor" +) + +func main() { + w := ansicolor.NewAnsiColorWriter(os.Stdout) + text := "%sforeground %sbold%s %sbackground%s\n" + fmt.Fprintf(w, text, "\x1b[31m", "\x1b[1m", "\x1b[21m", "\x1b[41;32m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[32m", "\x1b[1m", "\x1b[21m", "\x1b[42;31m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[33m", "\x1b[1m", "\x1b[21m", "\x1b[43;34m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[34m", "\x1b[1m", "\x1b[21m", "\x1b[44;33m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[35m", "\x1b[1m", "\x1b[21m", "\x1b[45;36m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[36m", "\x1b[1m", "\x1b[21m", "\x1b[46;35m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[37m", "\x1b[1m", "\x1b[21m", "\x1b[47;30m", "\x1b[0m") +} +``` + +![screenshot](https://gist.githubusercontent.com/shiena/a1bada24b525314a7d5e/raw/c763aa7cda6e4fefaccf831e2617adc40b6151c7/main.png) + +## See also: + +- https://github.com/daviddengcn/go-colortext +- https://github.com/adoxa/ansicon +- https://github.com/aslakhellesoy/wac +- https://github.com/wsxiaoys/terminal + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request + diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go new file mode 100644 index 0000000000..d3ece8fc0c --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go @@ -0,0 +1,20 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// Package ansicolor provides color console in Windows as ANSICON. +package ansicolor + +import "io" + +// NewAnsiColorWriter creates and initializes a new ansiColorWriter +// using io.Writer w as its initial contents. +// In the console of Windows, which change the foreground and background +// colors of the text by the escape sequence. +// In the console of other systems, which writes to w all text. +func NewAnsiColorWriter(w io.Writer) io.Writer { + if _, ok := w.(*ansiColorWriter); !ok { + return &ansiColorWriter{w: w} + } + return w +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go new file mode 100644 index 0000000000..d86cfc0f34 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go @@ -0,0 +1,27 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + +The ansicolor command colors a console text by ANSI escape sequence like wac. + + $ go get github.com/shiena/ansicolor/ansicolor + +See also: + https://github.com/aslakhellesoy/wac + +*/ +package main + +import ( + "io" + "os" + + "github.com/shiena/ansicolor" +) + +func main() { + w := ansicolor.NewAnsiColorWriter(os.Stdout) + io.Copy(w, os.Stdin) +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_ansi.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_ansi.go new file mode 100644 index 0000000000..57b4633a77 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_ansi.go @@ -0,0 +1,17 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// +build !windows + +package ansicolor + +import "io" + +type ansiColorWriter struct { + w io.Writer +} + +func (cw *ansiColorWriter) Write(p []byte) (int, error) { + return cw.w.Write(p) +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go new file mode 100644 index 0000000000..4feeb1de67 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go @@ -0,0 +1,25 @@ +package ansicolor_test + +import ( + "bytes" + "testing" + + "github.com/shiena/ansicolor" +) + +func TestNewAnsiColor1(t *testing.T) { + inner := bytes.NewBufferString("") + w := ansicolor.NewAnsiColorWriter(inner) + if w == inner { + t.Errorf("Get %#v, want %#v", w, inner) + } +} + +func TestNewAnsiColor2(t *testing.T) { + inner := bytes.NewBufferString("") + w1 := ansicolor.NewAnsiColorWriter(inner) + w2 := ansicolor.NewAnsiColorWriter(w1) + if w1 != w2 { + t.Errorf("Get %#v, want %#v", w1, w2) + } +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows.go new file mode 100644 index 0000000000..d918ffe914 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows.go @@ -0,0 +1,351 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// +build windows + +package ansicolor + +import ( + "bytes" + "io" + "strings" + "syscall" + "unsafe" +) + +type csiState int + +const ( + outsideCsiCode csiState = iota + firstCsiCode + secondCsiCode +) + +type ansiColorWriter struct { + w io.Writer + state csiState + paramBuf bytes.Buffer +} + +const ( + firstCsiChar byte = '\x1b' + secondeCsiChar byte = '[' + separatorChar byte = ';' + sgrCode byte = 'm' +) + +const ( + foregroundBlue = uint16(0x0001) + foregroundGreen = uint16(0x0002) + foregroundRed = uint16(0x0004) + foregroundIntensity = uint16(0x0008) + backgroundBlue = uint16(0x0010) + backgroundGreen = uint16(0x0020) + backgroundRed = uint16(0x0040) + backgroundIntensity = uint16(0x0080) + underscore = uint16(0x8000) + + foregroundMask = foregroundBlue | foregroundGreen | foregroundRed | foregroundIntensity + backgroundMask = backgroundBlue | backgroundGreen | backgroundRed | backgroundIntensity +) + +const ( + ansiReset = "0" + ansiIntensityOn = "1" + ansiIntensityOff = "21" + ansiUnderlineOn = "4" + ansiUnderlineOff = "24" + ansiBlinkOn = "5" + ansiBlinkOff = "25" + + ansiForegroundBlack = "30" + ansiForegroundRed = "31" + ansiForegroundGreen = "32" + ansiForegroundYellow = "33" + ansiForegroundBlue = "34" + ansiForegroundMagenta = "35" + ansiForegroundCyan = "36" + ansiForegroundWhite = "37" + ansiForegroundDefault = "39" + + ansiBackgroundBlack = "40" + ansiBackgroundRed = "41" + ansiBackgroundGreen = "42" + ansiBackgroundYellow = "43" + ansiBackgroundBlue = "44" + ansiBackgroundMagenta = "45" + ansiBackgroundCyan = "46" + ansiBackgroundWhite = "47" + ansiBackgroundDefault = "49" + + ansiLightForegroundGray = "90" + ansiLightForegroundRed = "91" + ansiLightForegroundGreen = "92" + ansiLightForegroundYellow = "93" + ansiLightForegroundBlue = "94" + ansiLightForegroundMagenta = "95" + ansiLightForegroundCyan = "96" + ansiLightForegroundWhite = "97" + + ansiLightBackgroundGray = "100" + ansiLightBackgroundRed = "101" + ansiLightBackgroundGreen = "102" + ansiLightBackgroundYellow = "103" + ansiLightBackgroundBlue = "104" + ansiLightBackgroundMagenta = "105" + ansiLightBackgroundCyan = "106" + ansiLightBackgroundWhite = "107" +) + +type drawType int + +const ( + foreground drawType = iota + background +) + +type winColor struct { + code uint16 + drawType drawType +} + +var colorMap = map[string]winColor{ + ansiForegroundBlack: {0, foreground}, + ansiForegroundRed: {foregroundRed, foreground}, + ansiForegroundGreen: {foregroundGreen, foreground}, + ansiForegroundYellow: {foregroundRed | foregroundGreen, foreground}, + ansiForegroundBlue: {foregroundBlue, foreground}, + ansiForegroundMagenta: {foregroundRed | foregroundBlue, foreground}, + ansiForegroundCyan: {foregroundGreen | foregroundBlue, foreground}, + ansiForegroundWhite: {foregroundRed | foregroundGreen | foregroundBlue, foreground}, + ansiForegroundDefault: {foregroundRed | foregroundGreen | foregroundBlue, foreground}, + + ansiBackgroundBlack: {0, background}, + ansiBackgroundRed: {backgroundRed, background}, + ansiBackgroundGreen: {backgroundGreen, background}, + ansiBackgroundYellow: {backgroundRed | backgroundGreen, background}, + ansiBackgroundBlue: {backgroundBlue, background}, + ansiBackgroundMagenta: {backgroundRed | backgroundBlue, background}, + ansiBackgroundCyan: {backgroundGreen | backgroundBlue, background}, + ansiBackgroundWhite: {backgroundRed | backgroundGreen | backgroundBlue, background}, + ansiBackgroundDefault: {0, background}, + + ansiLightForegroundGray: {foregroundIntensity, foreground}, + ansiLightForegroundRed: {foregroundIntensity | foregroundRed, foreground}, + ansiLightForegroundGreen: {foregroundIntensity | foregroundGreen, foreground}, + ansiLightForegroundYellow: {foregroundIntensity | foregroundRed | foregroundGreen, foreground}, + ansiLightForegroundBlue: {foregroundIntensity | foregroundBlue, foreground}, + ansiLightForegroundMagenta: {foregroundIntensity | foregroundRed | foregroundBlue, foreground}, + ansiLightForegroundCyan: {foregroundIntensity | foregroundGreen | foregroundBlue, foreground}, + ansiLightForegroundWhite: {foregroundIntensity | foregroundRed | foregroundGreen | foregroundBlue, foreground}, + + ansiLightBackgroundGray: {backgroundIntensity, background}, + ansiLightBackgroundRed: {backgroundIntensity | backgroundRed, background}, + ansiLightBackgroundGreen: {backgroundIntensity | backgroundGreen, background}, + ansiLightBackgroundYellow: {backgroundIntensity | backgroundRed | backgroundGreen, background}, + ansiLightBackgroundBlue: {backgroundIntensity | backgroundBlue, background}, + ansiLightBackgroundMagenta: {backgroundIntensity | backgroundRed | backgroundBlue, background}, + ansiLightBackgroundCyan: {backgroundIntensity | backgroundGreen | backgroundBlue, background}, + ansiLightBackgroundWhite: {backgroundIntensity | backgroundRed | backgroundGreen | backgroundBlue, background}, +} + +var ( + kernel32 = syscall.NewLazyDLL("kernel32.dll") + procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute") + procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo") + defaultAttr *textAttributes +) + +func init() { + screenInfo := getConsoleScreenBufferInfo(uintptr(syscall.Stdout)) + if screenInfo != nil { + colorMap[ansiForegroundDefault] = winColor{ + screenInfo.WAttributes & (foregroundRed | foregroundGreen | foregroundBlue), + foreground, + } + colorMap[ansiBackgroundDefault] = winColor{ + screenInfo.WAttributes & (backgroundRed | backgroundGreen | backgroundBlue), + background, + } + defaultAttr = convertTextAttr(screenInfo.WAttributes) + } +} + +type coord struct { + X, Y int16 +} + +type smallRect struct { + Left, Top, Right, Bottom int16 +} + +type consoleScreenBufferInfo struct { + DwSize coord + DwCursorPosition coord + WAttributes uint16 + SrWindow smallRect + DwMaximumWindowSize coord +} + +func getConsoleScreenBufferInfo(hConsoleOutput uintptr) *consoleScreenBufferInfo { + var csbi consoleScreenBufferInfo + ret, _, _ := procGetConsoleScreenBufferInfo.Call( + hConsoleOutput, + uintptr(unsafe.Pointer(&csbi))) + if ret == 0 { + return nil + } + return &csbi +} + +func setConsoleTextAttribute(hConsoleOutput uintptr, wAttributes uint16) bool { + ret, _, _ := procSetConsoleTextAttribute.Call( + hConsoleOutput, + uintptr(wAttributes)) + return ret != 0 +} + +type textAttributes struct { + foregroundColor uint16 + backgroundColor uint16 + foregroundIntensity uint16 + backgroundIntensity uint16 + underscore uint16 + otherAttributes uint16 +} + +func convertTextAttr(winAttr uint16) *textAttributes { + fgColor := winAttr & (foregroundRed | foregroundGreen | foregroundBlue) + bgColor := winAttr & (backgroundRed | backgroundGreen | backgroundBlue) + fgIntensity := winAttr & foregroundIntensity + bgIntensity := winAttr & backgroundIntensity + underline := winAttr & underscore + otherAttributes := winAttr &^ (foregroundMask | backgroundMask | underscore) + return &textAttributes{fgColor, bgColor, fgIntensity, bgIntensity, underline, otherAttributes} +} + +func convertWinAttr(textAttr *textAttributes) uint16 { + var winAttr uint16 = 0 + winAttr |= textAttr.foregroundColor + winAttr |= textAttr.backgroundColor + winAttr |= textAttr.foregroundIntensity + winAttr |= textAttr.backgroundIntensity + winAttr |= textAttr.underscore + winAttr |= textAttr.otherAttributes + return winAttr +} + +func changeColor(param []byte) { + if defaultAttr == nil { + return + } + + screenInfo := getConsoleScreenBufferInfo(uintptr(syscall.Stdout)) + if screenInfo == nil { + return + } + + winAttr := convertTextAttr(screenInfo.WAttributes) + strParam := string(param) + if len(strParam) <= 0 { + strParam = "0" + } + csiParam := strings.Split(strParam, string(separatorChar)) + for _, p := range csiParam { + c, ok := colorMap[p] + switch { + case !ok: + switch p { + case ansiReset: + winAttr.foregroundColor = defaultAttr.foregroundColor + winAttr.backgroundColor = defaultAttr.backgroundColor + winAttr.foregroundIntensity = defaultAttr.foregroundIntensity + winAttr.backgroundIntensity = defaultAttr.backgroundIntensity + winAttr.underscore = 0 + winAttr.otherAttributes = 0 + case ansiIntensityOn: + winAttr.foregroundIntensity = foregroundIntensity + case ansiIntensityOff: + winAttr.foregroundIntensity = 0 + case ansiUnderlineOn: + winAttr.underscore = underscore + case ansiUnderlineOff: + winAttr.underscore = 0 + case ansiBlinkOn: + winAttr.backgroundIntensity = backgroundIntensity + case ansiBlinkOff: + winAttr.backgroundIntensity = 0 + default: + // unknown code + } + case c.drawType == foreground: + winAttr.foregroundColor = c.code + case c.drawType == background: + winAttr.backgroundColor = c.code + } + } + winTextAttribute := convertWinAttr(winAttr) + setConsoleTextAttribute(uintptr(syscall.Stdout), winTextAttribute) +} + +func parseEscapeSequence(command byte, param []byte) { + switch command { + case sgrCode: + changeColor(param) + } +} + +func isParameterChar(b byte) bool { + return ('0' <= b && b <= '9') || b == separatorChar +} + +func (cw *ansiColorWriter) Write(p []byte) (int, error) { + r, nw, nc, first, last := 0, 0, 0, 0, 0 + var err error + for i, ch := range p { + switch cw.state { + case outsideCsiCode: + if ch == firstCsiChar { + nc++ + cw.state = firstCsiCode + } + case firstCsiCode: + switch ch { + case firstCsiChar: + nc++ + break + case secondeCsiChar: + nc++ + cw.state = secondCsiCode + last = i - 1 + default: + cw.state = outsideCsiCode + } + case secondCsiCode: + nc++ + if isParameterChar(ch) { + cw.paramBuf.WriteByte(ch) + } else { + nw, err = cw.w.Write(p[first:last]) + r += nw + if err != nil { + return r, err + } + first = i + 1 + param := cw.paramBuf.Bytes() + cw.paramBuf.Reset() + parseEscapeSequence(ch, param) + cw.state = outsideCsiCode + } + default: + cw.state = outsideCsiCode + } + } + + if cw.state == outsideCsiCode { + nw, err = cw.w.Write(p[first:len(p)]) + } + + return r + nw + nc, err +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go new file mode 100644 index 0000000000..6c126d517a --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go @@ -0,0 +1,236 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// +build windows + +package ansicolor_test + +import ( + "bytes" + "fmt" + "syscall" + "testing" + + "github.com/shiena/ansicolor" + . "github.com/shiena/ansicolor" +) + +func TestWritePlanText(t *testing.T) { + inner := bytes.NewBufferString("") + w := ansicolor.NewAnsiColorWriter(inner) + expected := "plain text" + fmt.Fprintf(w, expected) + actual := inner.String() + if actual != expected { + t.Errorf("Get %s, want %s", actual, expected) + } +} + +func TestWriteParseText(t *testing.T) { + inner := bytes.NewBufferString("") + w := ansicolor.NewAnsiColorWriter(inner) + + inputTail := "\x1b[0mtail text" + expectedTail := "tail text" + fmt.Fprintf(w, inputTail) + actualTail := inner.String() + inner.Reset() + if actualTail != expectedTail { + t.Errorf("Get %s, want %s", actualTail, expectedTail) + } + + inputHead := "head text\x1b[0m" + expectedHead := "head text" + fmt.Fprintf(w, inputHead) + actualHead := inner.String() + inner.Reset() + if actualHead != expectedHead { + t.Errorf("Get %s, want %s", actualHead, expectedHead) + } + + inputBothEnds := "both ends \x1b[0m text" + expectedBothEnds := "both ends text" + fmt.Fprintf(w, inputBothEnds) + actualBothEnds := inner.String() + inner.Reset() + if actualBothEnds != expectedBothEnds { + t.Errorf("Get %s, want %s", actualBothEnds, expectedBothEnds) + } + + inputManyEsc := "\x1b\x1b\x1b\x1b[0m many esc" + expectedManyEsc := "\x1b\x1b\x1b many esc" + fmt.Fprintf(w, inputManyEsc) + actualManyEsc := inner.String() + inner.Reset() + if actualManyEsc != expectedManyEsc { + t.Errorf("Get %s, want %s", actualManyEsc, expectedManyEsc) + } + + expectedSplit := "split text" + for _, ch := range "split \x1b[0m text" { + fmt.Fprintf(w, string(ch)) + } + actualSplit := inner.String() + inner.Reset() + if actualSplit != expectedSplit { + t.Errorf("Get %s, want %s", actualSplit, expectedSplit) + } +} + +type screenNotFoundError struct { + error +} + +func writeAnsiColor(expectedText, colorCode string) (actualText string, actualAttributes uint16, err error) { + inner := bytes.NewBufferString("") + w := ansicolor.NewAnsiColorWriter(inner) + fmt.Fprintf(w, "\x1b[%sm%s", colorCode, expectedText) + + actualText = inner.String() + screenInfo := GetConsoleScreenBufferInfo(uintptr(syscall.Stdout)) + if screenInfo != nil { + actualAttributes = screenInfo.WAttributes + } else { + err = &screenNotFoundError{} + } + return +} + +type testParam struct { + text string + attributes uint16 + ansiColor string +} + +func TestWriteAnsiColorText(t *testing.T) { + screenInfo := GetConsoleScreenBufferInfo(uintptr(syscall.Stdout)) + if screenInfo == nil { + t.Fatal("Could not get ConsoleScreenBufferInfo") + } + defer ChangeColor(screenInfo.WAttributes) + defaultFgColor := screenInfo.WAttributes & uint16(0x0007) + defaultBgColor := screenInfo.WAttributes & uint16(0x0070) + defaultFgIntensity := screenInfo.WAttributes & uint16(0x0008) + defaultBgIntensity := screenInfo.WAttributes & uint16(0x0080) + + fgParam := []testParam{ + {"foreground black ", uint16(0x0000 | 0x0000), "30"}, + {"foreground red ", uint16(0x0004 | 0x0000), "31"}, + {"foreground green ", uint16(0x0002 | 0x0000), "32"}, + {"foreground yellow ", uint16(0x0006 | 0x0000), "33"}, + {"foreground blue ", uint16(0x0001 | 0x0000), "34"}, + {"foreground magenta", uint16(0x0005 | 0x0000), "35"}, + {"foreground cyan ", uint16(0x0003 | 0x0000), "36"}, + {"foreground white ", uint16(0x0007 | 0x0000), "37"}, + {"foreground default", defaultFgColor | 0x0000, "39"}, + {"foreground light gray ", uint16(0x0000 | 0x0008 | 0x0000), "90"}, + {"foreground light red ", uint16(0x0004 | 0x0008 | 0x0000), "91"}, + {"foreground light green ", uint16(0x0002 | 0x0008 | 0x0000), "92"}, + {"foreground light yellow ", uint16(0x0006 | 0x0008 | 0x0000), "93"}, + {"foreground light blue ", uint16(0x0001 | 0x0008 | 0x0000), "94"}, + {"foreground light magenta", uint16(0x0005 | 0x0008 | 0x0000), "95"}, + {"foreground light cyan ", uint16(0x0003 | 0x0008 | 0x0000), "96"}, + {"foreground light white ", uint16(0x0007 | 0x0008 | 0x0000), "97"}, + } + + bgParam := []testParam{ + {"background black ", uint16(0x0007 | 0x0000), "40"}, + {"background red ", uint16(0x0007 | 0x0040), "41"}, + {"background green ", uint16(0x0007 | 0x0020), "42"}, + {"background yellow ", uint16(0x0007 | 0x0060), "43"}, + {"background blue ", uint16(0x0007 | 0x0010), "44"}, + {"background magenta", uint16(0x0007 | 0x0050), "45"}, + {"background cyan ", uint16(0x0007 | 0x0030), "46"}, + {"background white ", uint16(0x0007 | 0x0070), "47"}, + {"background default", uint16(0x0007) | defaultBgColor, "49"}, + {"background light gray ", uint16(0x0007 | 0x0000 | 0x0080), "100"}, + {"background light red ", uint16(0x0007 | 0x0040 | 0x0080), "101"}, + {"background light green ", uint16(0x0007 | 0x0020 | 0x0080), "102"}, + {"background light yellow ", uint16(0x0007 | 0x0060 | 0x0080), "103"}, + {"background light blue ", uint16(0x0007 | 0x0010 | 0x0080), "104"}, + {"background light magenta", uint16(0x0007 | 0x0050 | 0x0080), "105"}, + {"background light cyan ", uint16(0x0007 | 0x0030 | 0x0080), "106"}, + {"background light white ", uint16(0x0007 | 0x0070 | 0x0080), "107"}, + } + + resetParam := []testParam{ + {"all reset", defaultFgColor | defaultBgColor | defaultFgIntensity | defaultBgIntensity, "0"}, + {"all reset", defaultFgColor | defaultBgColor | defaultFgIntensity | defaultBgIntensity, ""}, + } + + boldParam := []testParam{ + {"bold on", uint16(0x0007 | 0x0008), "1"}, + {"bold off", uint16(0x0007), "21"}, + } + + underscoreParam := []testParam{ + {"underscore on", uint16(0x0007 | 0x8000), "4"}, + {"underscore off", uint16(0x0007), "24"}, + } + + blinkParam := []testParam{ + {"blink on", uint16(0x0007 | 0x0080), "5"}, + {"blink off", uint16(0x0007), "25"}, + } + + mixedParam := []testParam{ + {"both black, bold, underline, blink", uint16(0x0000 | 0x0000 | 0x0008 | 0x8000 | 0x0080), "30;40;1;4;5"}, + {"both red, bold, underline, blink", uint16(0x0004 | 0x0040 | 0x0008 | 0x8000 | 0x0080), "31;41;1;4;5"}, + {"both green, bold, underline, blink", uint16(0x0002 | 0x0020 | 0x0008 | 0x8000 | 0x0080), "32;42;1;4;5"}, + {"both yellow, bold, underline, blink", uint16(0x0006 | 0x0060 | 0x0008 | 0x8000 | 0x0080), "33;43;1;4;5"}, + {"both blue, bold, underline, blink", uint16(0x0001 | 0x0010 | 0x0008 | 0x8000 | 0x0080), "34;44;1;4;5"}, + {"both magenta, bold, underline, blink", uint16(0x0005 | 0x0050 | 0x0008 | 0x8000 | 0x0080), "35;45;1;4;5"}, + {"both cyan, bold, underline, blink", uint16(0x0003 | 0x0030 | 0x0008 | 0x8000 | 0x0080), "36;46;1;4;5"}, + {"both white, bold, underline, blink", uint16(0x0007 | 0x0070 | 0x0008 | 0x8000 | 0x0080), "37;47;1;4;5"}, + {"both default, bold, underline, blink", uint16(defaultFgColor | defaultBgColor | 0x0008 | 0x8000 | 0x0080), "39;49;1;4;5"}, + } + + assertTextAttribute := func(expectedText string, expectedAttributes uint16, ansiColor string) { + actualText, actualAttributes, err := writeAnsiColor(expectedText, ansiColor) + if actualText != expectedText { + t.Errorf("Get %s, want %s", actualText, expectedText) + } + if err != nil { + t.Fatal("Could not get ConsoleScreenBufferInfo") + } + if actualAttributes != expectedAttributes { + t.Errorf("Text: %s, Get 0x%04x, want 0x%04x", expectedText, actualAttributes, expectedAttributes) + } + } + + for _, v := range fgParam { + ResetColor() + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + for _, v := range bgParam { + ChangeColor(uint16(0x0070 | 0x0007)) + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + for _, v := range resetParam { + ChangeColor(uint16(0x0000 | 0x0070 | 0x0008)) + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + ResetColor() + for _, v := range boldParam { + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + ResetColor() + for _, v := range underscoreParam { + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + ResetColor() + for _, v := range blinkParam { + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + for _, v := range mixedParam { + ResetColor() + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go new file mode 100644 index 0000000000..f2ac67c174 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go @@ -0,0 +1,24 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package ansicolor_test + +import ( + "fmt" + "os" + + "github.com/shiena/ansicolor" +) + +func ExampleNewAnsiColorWriter() { + w := ansicolor.NewAnsiColorWriter(os.Stdout) + text := "%sforeground %sbold%s %sbackground%s\n" + fmt.Fprintf(w, text, "\x1b[31m", "\x1b[1m", "\x1b[21m", "\x1b[41;32m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[32m", "\x1b[1m", "\x1b[21m", "\x1b[42;31m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[33m", "\x1b[1m", "\x1b[21m", "\x1b[43;34m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[34m", "\x1b[1m", "\x1b[21m", "\x1b[44;33m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[35m", "\x1b[1m", "\x1b[21m", "\x1b[45;36m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[36m", "\x1b[1m", "\x1b[21m", "\x1b[46;35m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[37m", "\x1b[1m", "\x1b[21m", "\x1b[47;30m", "\x1b[0m") +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go new file mode 100644 index 0000000000..6d2f7c0741 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go @@ -0,0 +1,19 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// +build windows + +package ansicolor + +import "syscall" + +var GetConsoleScreenBufferInfo = getConsoleScreenBufferInfo + +func ChangeColor(color uint16) { + setConsoleTextAttribute(uintptr(syscall.Stdout), color) +} + +func ResetColor() { + ChangeColor(uint16(0x0007)) +} diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go index 6d44f74b38..46cc9d0701 100644 --- a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go +++ b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go @@ -18,7 +18,6 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/syndtr/goleveldb/leveldb/util" ) @@ -370,8 +369,6 @@ func (fw fileWrap) Close() error { err := fw.File.Close() if err != nil { f.fs.log(fmt.Sprintf("close %s.%d: %v", f.Type(), f.Num(), err)) - } else { - fdtrack.Close("leveldb") } return err } @@ -403,7 +400,6 @@ func (f *file) Open() (Reader, error) { return nil, err } ok: - fdtrack.Open("leveldb") f.open = true f.fs.open++ return fileWrap{of, f}, nil @@ -422,7 +418,6 @@ func (f *file) Create() (Writer, error) { if err != nil { return nil, err } - fdtrack.Open("leveldb") f.open = true f.fs.open++ return fileWrap{of, f}, nil diff --git a/README.md b/README.md index b9ab28fdb1..717e726e34 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,18 @@ ## Ethereum Go -Ethereum Go Client, by Jeffrey Wilcke (and some other people). +Official golang implementation of the Ethereum protocol | Linux | OSX | ARM | Windows | Tests ----------|---------|-----|-----|---------|------ -develop | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/Linux%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/OSX%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20develop%20branch)](https://build.ethdev.com/builders/ARM%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20develop%20branch)](https://build.ethdev.com/builders/Windows%20Go%20develop%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=develop)](https://travis-ci.org/ethereum/go-ethereum) [![Coverage Status](https://coveralls.io/repos/ethereum/go-ethereum/badge.svg?branch=develop)](https://coveralls.io/r/ethereum/go-ethereum?branch=develop) -master | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20master%20branch)](https://build.ethdev.com/builders/Linux%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=OSX%20Go%20master%20branch)](https://build.ethdev.com/builders/OSX%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20master%20branch)](https://build.ethdev.com/builders/ARM%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20master%20branch)](https://build.ethdev.com/builders/Windows%20Go%20master%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=master)](https://travis-ci.org/ethereum/go-ethereum) [![Coverage Status](https://coveralls.io/repos/ethereum/go-ethereum/badge.svg?branch=master)](https://coveralls.io/r/ethereum/go-ethereum?branch=master) +develop | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/Linux%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/OSX%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20develop%20branch)](https://build.ethdev.com/builders/ARM%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20develop%20branch)](https://build.ethdev.com/builders/Windows%20Go%20develop%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=develop)](https://travis-ci.org/ethereum/go-ethereum) [![codecov.io](http://codecov.io/github/ethereum/go-ethereum/coverage.svg?branch=develop)](http://codecov.io/github/ethereum/go-ethereum?branch=develop) +master | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20master%20branch)](https://build.ethdev.com/builders/Linux%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=OSX%20Go%20master%20branch)](https://build.ethdev.com/builders/OSX%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20master%20branch)](https://build.ethdev.com/builders/ARM%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20master%20branch)](https://build.ethdev.com/builders/Windows%20Go%20master%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=master)](https://travis-ci.org/ethereum/go-ethereum) [![codecov.io](http://codecov.io/github/ethereum/go-ethereum/coverage.svg?branch=master)](http://codecov.io/github/ethereum/go-ethereum?branch=master) -[![Bugs](https://badge.waffle.io/ethereum/go-ethereum.png?label=bug&title=Bugs)](https://waffle.io/ethereum/go-ethereum) -[![Stories in Ready](https://badge.waffle.io/ethereum/go-ethereum.png?label=ready&title=Ready)](https://waffle.io/ethereum/go-ethereum) -[![Stories in Progress](https://badge.waffle.io/ethereum/go-ethereum.svg?label=in%20progress&title=In Progress)](http://waffle.io/ethereum/go-ethereum) +[![API Reference]( +https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667 +)](https://godoc.org/github.com/ethereum/go-ethereum) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -Automated development builds -====================== +## Automated development builds The following builds are build automatically by our build servers after each push to the [develop](https://github.com/ethereum/go-ethereum/tree/develop) branch. @@ -25,8 +24,7 @@ The following builds are build automatically by our build servers after each pus * [Windows 64-bit](https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Geth-Win64-latest.zip) * [ARM](https://build.ethdev.com/builds/ARM%20Go%20develop%20branch/geth-ARM-latest.tar.bz2) -Building the source -=================== +## Building the source For prerequisites and detailed build instructions please read the [Installation Instructions](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum) @@ -38,34 +36,31 @@ Once the dependencies are installed, run make geth -Executables -=========== +## Executables Go Ethereum comes with several wrappers/executables found in [the `cmd` directory](https://github.com/ethereum/go-ethereum/tree/develop/cmd): -* `geth` Ethereum CLI (ethereum command line interface client) -* `bootnode` runs a bootstrap node for the Discovery Protocol -* `ethtest` test tool which runs with the [tests](https://github.com/ethereum/tests) suite: - `/path/to/test.json > ethtest --test BlockTests --stdin`. -* `evm` is a generic Ethereum Virtual Machine: `evm -code 60ff60ff -gas - 10000 -price 0 -dump`. See `-h` for a detailed description. -* `disasm` disassembles EVM code: `echo "6001" | disasm` -* `rlpdump` prints RLP structures + Command | | +----------|---------| +`geth` | Ethereum CLI (ethereum command line interface client) | +`bootnode` | runs a bootstrap node for the Discovery Protocol | +`ethtest` | test tool which runs with the [tests](https://github.com/ethereum/tests) suite: `/path/to/test.json > ethtest --test BlockTests --stdin`. +`evm` | is a generic Ethereum Virtual Machine: `evm -code 60ff60ff -gas 10000 -price 0 -dump`. See `-h` for a detailed description. | +`disasm` | disassembles EVM code: `echo "6001" | disasm` | +`rlpdump` | prints RLP structures | -Command line options -==================== +## Command line options `geth` can be configured via command line options, environment variables and config files. To get the options available: - geth --help + geth help For further details on options, see the [wiki](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options) -Contribution -============ +## Contribution If you'd like to contribute to go-ethereum please fork, fix, commit and send a pull request. Commits who do not comply with the coding standards diff --git a/build/test-global-coverage.sh b/build/test-global-coverage.sh index 5bb233a31d..a51b6a9e57 100755 --- a/build/test-global-coverage.sh +++ b/build/test-global-coverage.sh @@ -1,26 +1,15 @@ -#!/bin/bash - -# This script runs all package tests and merges the resulting coverage -# profiles. Coverage is accounted per package under test. +#!/usr/bin/env bash set -e +echo "" > coverage.txt -if [ ! -f "build/env.sh" ]; then - echo "$0 must be run from the root of the repository." - exit 2 -fi - -echo "mode: count" > profile.cov - -for pkg in $(go list ./...); do - # drop the namespace prefix. - dir=${pkg##github.com/ethereum/go-ethereum/} - - if [[ $dir != "tests" ]]; then - go test -covermode=count -coverprofile=$dir/profile.tmp $pkg - fi - if [[ -f $dir/profile.tmp ]]; then - tail -n +2 $dir/profile.tmp >> profile.cov - rm $dir/profile.tmp +for d in $(find ./* -maxdepth 10 -type d -not -path "./build" -not -path "./Godeps/*" ); do + if ls $d/*.go &> /dev/null; then + go test -coverprofile=profile.out -covermode=atomic $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + echo '<<<<<< EOF' >> coverage.txt + rm profile.out + fi fi done diff --git a/cmd/evm/main.go b/cmd/evm/main.go index be6546c953..6639069b99 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -102,7 +102,7 @@ func init() { func run(ctx *cli.Context) { vm.Debug = ctx.GlobalBool(DebugFlag.Name) vm.ForceJit = ctx.GlobalBool(ForceJitFlag.Name) - vm.DisableJit = ctx.GlobalBool(DisableJitFlag.Name) + vm.EnableJit = !ctx.GlobalBool(DisableJitFlag.Name) glog.SetToStderr(true) diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 876b8c6bad..c420459189 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -115,17 +115,16 @@ func exportChain(ctx *cli.Context) { } func removeDB(ctx *cli.Context) { - confirm, err := utils.PromptConfirm("Remove local databases?") + confirm, err := utils.PromptConfirm("Remove local database?") if err != nil { utils.Fatalf("%v", err) } if confirm { - fmt.Println("Removing chain and state databases...") + fmt.Println("Removing chaindata...") start := time.Now() - os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "blockchain")) - os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "state")) + os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "chaindata")) fmt.Printf("Removed in %v\n", time.Since(start)) } else { diff --git a/cmd/geth/js.go b/cmd/geth/js.go index bf56423ece..c31deefdd9 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -145,19 +145,15 @@ func apiWordCompleter(line string, pos int) (head string, completions []string, return begin, completionWords, end } -func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive bool, f xeth.Frontend) *jsre { +func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive bool) *jsre { js := &jsre{ps1: "> "} js.wait = make(chan *big.Int) js.client = client js.ds = docserver.New("/") - if f == nil { - f = js - } - // update state in separare forever blocks js.re = re.New(libPath) - if err := js.apiBindings(f); err != nil { + if err := js.apiBindings(js); err != nil { utils.Fatalf("Unable to initialize console - %v", err) } @@ -232,15 +228,10 @@ func (self *jsre) loadAutoCompletion() { } func (self *jsre) batch(statement string) { - val, err := self.re.Run(statement) + err := self.re.EvalAndPrettyPrint(statement) if err != nil { fmt.Printf("error: %v", err) - } else if val.IsDefined() && val.IsObject() { - obj, _ := self.re.Get("ret_result") - fmt.Printf("%v", obj) - } else if val.IsDefined() { - fmt.Printf("%v", val) } if self.atexit != nil { @@ -252,22 +243,22 @@ func (self *jsre) batch(statement string) { // show summary of current geth instance func (self *jsre) welcome() { - self.re.Eval(`console.log('instance: ' + web3.version.client);`) - self.re.Eval(`console.log(' datadir: ' + admin.datadir);`) - self.re.Eval(`console.log("coinbase: " + eth.coinbase);`) - self.re.Eval(`var lastBlockTimestamp = 1000 * eth.getBlock(eth.blockNumber).timestamp`) - self.re.Eval(`console.log("at block: " + eth.blockNumber + " (" + new Date(lastBlockTimestamp).toLocaleDateString() - + " " + new Date(lastBlockTimestamp).toLocaleTimeString() + ")");`) - + self.re.Run(` + (function () { + console.log('instance: ' + web3.version.client); + console.log(' datadir: ' + admin.datadir); + console.log("coinbase: " + eth.coinbase); + var ts = 1000 * eth.getBlock(eth.blockNumber).timestamp; + console.log("at block: " + eth.blockNumber + " (" + new Date(ts) + ")"); + })(); + `) if modules, err := self.supportedApis(); err == nil { loadedModules := make([]string, 0) for api, version := range modules { loadedModules = append(loadedModules, fmt.Sprintf("%s:%s", api, version)) } sort.Strings(loadedModules) - - self.re.Eval(fmt.Sprintf("var modules = '%s';", strings.Join(loadedModules, " "))) - self.re.Eval(`console.log(" modules: " + modules);`) + fmt.Println("modules:", strings.Join(loadedModules, " ")) } } @@ -291,7 +282,7 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { utils.Fatalf("Unable to determine supported api's: %v", err) } - jeth := rpc.NewJeth(api.Merge(apiImpl...), js.re, js.client) + jeth := rpc.NewJeth(api.Merge(apiImpl...), js.re, js.client, f) js.re.Set("jeth", struct{}{}) t, _ := js.re.Get("jeth") jethObj := t.Object() @@ -309,12 +300,12 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { utils.Fatalf("Error loading web3.js: %v", err) } - _, err = js.re.Eval("var web3 = require('web3');") + _, err = js.re.Run("var web3 = require('web3');") if err != nil { utils.Fatalf("Error requiring web3: %v", err) } - _, err = js.re.Eval("web3.setProvider(jeth)") + _, err = js.re.Run("web3.setProvider(jeth)") if err != nil { utils.Fatalf("Error setting web3 provider: %v", err) } @@ -333,13 +324,13 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { } } - _, err = js.re.Eval(shortcuts) + _, err = js.re.Run(shortcuts) if err != nil { utils.Fatalf("Error setting namespaces: %v", err) } - js.re.Eval(`var GlobalRegistrar = eth.contract(` + registrar.GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar.GlobalRegistrarAddr + `");`) + js.re.Run(`var GlobalRegistrar = eth.contract(` + registrar.GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar.GlobalRegistrarAddr + `");`) return nil } @@ -387,6 +378,11 @@ func (self *jsre) interactive() { for { line, err := self.Prompt(<-prompt) if err != nil { + if err == liner.ErrPromptAborted { // ctrl-C + self.resetPrompt() + inputln <- "" + continue + } return } inputln <- line @@ -458,8 +454,7 @@ func (self *jsre) parseInput(code string) { fmt.Println("[native] error", r) } }() - value, err := self.re.Run(code) - if err != nil { + if err := self.re.EvalAndPrettyPrint(code); err != nil { if ottoErr, ok := err.(*otto.Error); ok { fmt.Println(ottoErr.String()) } else { @@ -467,12 +462,17 @@ func (self *jsre) parseInput(code string) { } return } - self.printValue(value) } var indentCount = 0 var str = "" +func (self *jsre) resetPrompt() { + indentCount = 0 + str = "" + self.ps1 = "> " +} + func (self *jsre) setIndent() { open := strings.Count(str, "{") open += strings.Count(str, "(") @@ -486,10 +486,3 @@ func (self *jsre) setIndent() { self.ps1 += " " } } - -func (self *jsre) printValue(v interface{}) { - val, err := self.re.PrettyPrint(v) - if err == nil { - fmt.Printf("%v", val) - } -} diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 4905d502a4..3f3d0f6f9b 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -19,7 +19,6 @@ package main import ( "fmt" - "io" "io/ioutil" _ "net/http/pprof" "os" @@ -38,7 +37,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/metrics" @@ -46,16 +44,14 @@ import ( "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" - "github.com/mattn/go-colorable" - "github.com/mattn/go-isatty" ) const ( ClientIdentifier = "Geth" - Version = "1.0.1" + Version = "1.0.3" VersionMajor = 1 VersionMinor = 0 - VersionPatch = 1 + VersionPatch = 3 ) var ( @@ -398,14 +394,6 @@ func run(ctx *cli.Context) { func attach(ctx *cli.Context) { utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name)) - // Wrap the standard output with a colorified stream (windows) - if isatty.IsTerminal(os.Stdout.Fd()) { - if pr, pw, err := os.Pipe(); err == nil { - go io.Copy(colorable.NewColorableStdout(), pr) - os.Stdout = pw - } - } - var client comms.EthereumClient var err error if ctx.Args().Present() { @@ -425,7 +413,7 @@ func attach(ctx *cli.Context) { ctx.GlobalString(utils.JSpathFlag.Name), client, true, - nil) + ) if ctx.GlobalString(utils.ExecFlag.Name) != "" { repl.batch(ctx.GlobalString(utils.ExecFlag.Name)) @@ -438,14 +426,6 @@ func attach(ctx *cli.Context) { func console(ctx *cli.Context) { utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name)) - // Wrap the standard output with a colorified stream (windows) - if isatty.IsTerminal(os.Stdout.Fd()) { - if pr, pw, err := os.Pipe(); err == nil { - go io.Copy(colorable.NewColorableStdout(), pr) - os.Stdout = pw - } - } - cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx) ethereum, err := eth.New(cfg) if err != nil { @@ -565,9 +545,6 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) { // Start Ethereum itself utils.StartEthereum(eth) - // Start logging file descriptor stats. - fdtrack.Start() - am := eth.AccountManager() account := ctx.GlobalString(utils.UnlockedAccountFlag.Name) accounts := strings.Split(account, " ") diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 462da93059..af2929d102 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -21,30 +21,32 @@ import ( "fmt" "log" "math/big" + "net" "net/http" "os" "path/filepath" "runtime" "strconv" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/metrics" - "github.com/codegangsta/cli" "github.com/ethereum/ethash" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/rpc/api" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" + "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/ethereum/go-ethereum/rpc/useragent" "github.com/ethereum/go-ethereum/xeth" ) @@ -452,7 +454,7 @@ func SetupLogger(ctx *cli.Context) { // SetupVM configured the VM package's global settings func SetupVM(ctx *cli.Context) { - vm.DisableJit = !ctx.GlobalBool(VMEnableJitFlag.Name) + vm.EnableJit = ctx.GlobalBool(VMEnableJitFlag.Name) vm.ForceJit = ctx.GlobalBool(VMForceJitFlag.Name) vm.SetJITCacheSize(ctx.GlobalInt(VMJitCacheFlag.Name)) } @@ -518,15 +520,20 @@ func StartIPC(eth *eth.Ethereum, ctx *cli.Context) error { Endpoint: IpcSocketPath(ctx), } - xeth := xeth.New(eth, nil) - codec := codec.JSON + initializer := func(conn net.Conn) (shared.EthereumApi, error) { + fe := useragent.NewRemoteFrontend(conn, eth.AccountManager()) + xeth := xeth.New(eth, fe) + codec := codec.JSON - apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec, xeth, eth) - if err != nil { - return err + apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec, xeth, eth) + if err != nil { + return nil, err + } + + return api.Merge(apis...), nil } - return comms.StartIpc(config, codec, api.Merge(apis...)) + return comms.StartIpc(config, codec.JSON, initializer) } func StartRPC(eth *eth.Ethereum, ctx *cli.Context) error { diff --git a/core/block_processor.go b/core/block_processor.go index 4772153563..dd7fe8962c 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -349,23 +349,11 @@ func (sm *BlockProcessor) GetBlockReceipts(bhash common.Hash) types.Receipts { // the depricated way by re-processing the block. func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err error) { receipts := GetBlockReceipts(sm.chainDb, block.Hash()) - if len(receipts) > 0 { - // coalesce logs - for _, receipt := range receipts { - logs = append(logs, receipt.Logs()...) - } - return + // coalesce logs + for _, receipt := range receipts { + logs = append(logs, receipt.Logs()...) } - - // TODO: remove backward compatibility - var ( - parent = sm.bc.GetBlock(block.ParentHash()) - state = state.New(parent.Root(), sm.chainDb) - ) - - sm.TransitionState(state, parent, block, true) - - return state.Logs(), nil + return logs, nil } // See YP section 4.3.4. "Block Header Validity" diff --git a/core/blocks.go b/core/blocks.go index 326e4c3fc5..96545bfebe 100644 --- a/core/blocks.go +++ b/core/blocks.go @@ -20,8 +20,5 @@ import "github.com/ethereum/go-ethereum/common" // Set of manually tracked bad hashes (usually hard forks) var BadHashes = map[common.Hash]bool{ - common.HexToHash("f269c503aed286caaa0d114d6a5320e70abbc2febe37953207e76a2873f2ba79"): true, - common.HexToHash("38f5bbbffd74804820ffa4bab0cd540e9de229725afb98c1a7e57936f4a714bc"): true, - common.HexToHash("7064455b364775a16afbdecd75370e912c6e2879f202eda85b9beae547fff3ac"): true, - common.HexToHash("5b7c80070a6eff35f3eb3181edb023465c776d40af2885571e1bc4689f3a44d8"): true, + common.HexToHash("0x05bef30ef572270f654746da22639a7a0c97dd97a7050b9e252391996aaeb689"): true, } diff --git a/core/chain_manager.go b/core/chain_manager.go index 1647031b1c..cf5b8bd78b 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -647,7 +647,9 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) { queue[i] = ChainSplitEvent{block, logs} queueEvent.splitCount++ } - PutBlockReceipts(self.chainDb, block, receipts) + if err := PutBlockReceipts(self.chainDb, block, receipts); err != nil { + glog.V(logger.Warn).Infoln("error writing block receipts:", err) + } stats.processed++ } diff --git a/core/filter.go b/core/filter.go index 8a876396be..c34d6ff6cc 100644 --- a/core/filter.go +++ b/core/filter.go @@ -22,6 +22,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" ) type AccountChange struct { @@ -111,7 +113,7 @@ done: // Get the logs of the block unfiltered, err := self.eth.BlockProcessor().GetLogs(block) if err != nil { - chainlogger.Warnln("err: filter get logs ", err) + glog.V(logger.Warn).Infoln("err: filter get logs ", err) break } diff --git a/core/state/state_object.go b/core/state/state_object.go index 3d4f0b3769..c76feb7743 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -82,8 +82,9 @@ type StateObject struct { // Mark for deletion // When an object is marked for deletion it will be delete from the trie // during the "update" phase of the state transition - remove bool - dirty bool + remove bool + deleted bool + dirty bool } func (self *StateObject) Reset() { diff --git a/core/state/statedb.go b/core/state/statedb.go index 45bdfc084d..577f7162eb 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -203,18 +203,20 @@ func (self *StateDB) UpdateStateObject(stateObject *StateObject) { // Delete the given state object and delete it from the state trie func (self *StateDB) DeleteStateObject(stateObject *StateObject) { + stateObject.deleted = true + addr := stateObject.Address() self.trie.Delete(addr[:]) - - //delete(self.stateObjects, addr.Str()) } // Retrieve a state object given my the address. Nil if not found -func (self *StateDB) GetStateObject(addr common.Address) *StateObject { - //addr = common.Address(addr) - - stateObject := self.stateObjects[addr.Str()] +func (self *StateDB) GetStateObject(addr common.Address) (stateObject *StateObject) { + stateObject = self.stateObjects[addr.Str()] if stateObject != nil { + if stateObject.deleted { + stateObject = nil + } + return stateObject } @@ -236,7 +238,7 @@ func (self *StateDB) SetStateObject(object *StateObject) { // Retrieve a state object or create a new state object if nil func (self *StateDB) GetOrNewStateObject(addr common.Address) *StateObject { stateObject := self.GetStateObject(addr) - if stateObject == nil { + if stateObject == nil || stateObject.deleted { stateObject = self.CreateAccount(addr) } diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 6b7b412209..2de35a4430 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -341,19 +341,19 @@ func opCoinbase(instr instruction, env Environment, context *Context, memory *Me } func opTimestamp(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(new(big.Int).SetUint64(env.Time())) + stack.push(U256(new(big.Int).SetUint64(env.Time()))) } func opNumber(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(U256(env.BlockNumber())) + stack.push(U256(new(big.Int).Set(env.BlockNumber()))) } func opDifficulty(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(new(big.Int).Set(env.Difficulty())) + stack.push(U256(new(big.Int).Set(env.Difficulty()))) } func opGasLimit(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(new(big.Int).Set(env.GasLimit())) + stack.push(U256(new(big.Int).Set(env.GasLimit()))) } func opPop(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { @@ -415,15 +415,12 @@ func opSstore(instr instruction, env Environment, context *Context, memory *Memo env.State().SetState(context.Address(), loc, common.BigToHash(val)) } -func opJump(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { -} -func opJumpi(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { -} -func opJumpdest(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { -} +func opJump(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {} +func opJumpi(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {} +func opJumpdest(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {} func opPc(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(instr.data) + stack.push(new(big.Int).Set(instr.data)) } func opMsize(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { diff --git a/core/vm/jit.go b/core/vm/jit.go index d5c2d78300..084d2a3f33 100644 --- a/core/vm/jit.go +++ b/core/vm/jit.go @@ -83,6 +83,7 @@ type Program struct { code []byte } +// NewProgram returns a new JIT program func NewProgram(code []byte) *Program { program := &Program{ Id: crypto.Sha3Hash(code), @@ -113,6 +114,7 @@ func (p *Program) addInstr(op OpCode, pc uint64, fn instrFn, data *big.Int) { p.mapping[pc] = len(p.instructions) - 1 } +// CompileProgram compiles the given program and return an error when it fails func CompileProgram(program *Program) (err error) { if progStatus(atomic.LoadInt32(&program.status)) == progCompile { return nil @@ -272,6 +274,8 @@ func CompileProgram(program *Program) (err error) { return nil } +// RunProgram runs the program given the enviroment and context and returns an +// error if the execution failed (non-consensus) func RunProgram(program *Program, env Environment, context *Context, input []byte) ([]byte, error) { return runProgram(program, 0, NewMemory(), newstack(), env, context, input) } @@ -352,6 +356,8 @@ func runProgram(program *Program, pcstart uint64, mem *Memory, stack *stack, env pc++ } + context.Input = nil + return context.Return(nil), nil } diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go index 5b3feea992..b9e2c69999 100644 --- a/core/vm/jit_test.go +++ b/core/vm/jit_test.go @@ -46,7 +46,7 @@ func runVmBench(test vmBench, b *testing.B) { } env := NewEnv() - DisableJit = test.nojit + EnableJit = !test.nojit ForceJit = test.forcejit b.ResetTimer() diff --git a/core/vm/settings.go b/core/vm/settings.go index 0cd931b6ae..f9296f6c8b 100644 --- a/core/vm/settings.go +++ b/core/vm/settings.go @@ -17,9 +17,9 @@ package vm var ( - DisableJit bool = true // Disable the JIT VM - ForceJit bool // Force the JIT, skip byte VM - MaxProgSize int // Max cache size for JIT Programs + EnableJit bool // Enables the JIT VM + ForceJit bool // Force the JIT, skip byte VM + MaxProgSize int // Max cache size for JIT Programs ) const defaultJitMaxCache int = 64 diff --git a/core/vm/vm.go b/core/vm/vm.go index c292b45d1a..da764004ad 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -64,7 +64,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { codehash = crypto.Sha3Hash(context.Code) // codehash is used when doing jump dest caching program *Program ) - if !DisableJit { + if EnableJit { // Fetch program status. // * If ready run using JIT // * If unknown, compile in a seperate goroutine diff --git a/crypto/keypair.go b/crypto/keypair.go deleted file mode 100644 index e070f292fc..0000000000 --- a/crypto/keypair.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package crypto - -import ( - "strings" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/secp256k1" -) - -type KeyPair struct { - PrivateKey []byte - PublicKey []byte - address []byte - mnemonic string - // The associated account - // account *StateObject -} - -func GenerateNewKeyPair() *KeyPair { - _, prv := secp256k1.GenerateKeyPair() - keyPair, _ := NewKeyPairFromSec(prv) // swallow error, this one cannot err - return keyPair -} - -func NewKeyPairFromSec(seckey []byte) (*KeyPair, error) { - pubkey, err := secp256k1.GeneratePubKey(seckey) - if err != nil { - return nil, err - } - - return &KeyPair{PrivateKey: seckey, PublicKey: pubkey}, nil -} - -func (k *KeyPair) Address() []byte { - if k.address == nil { - k.address = Sha3(k.PublicKey[1:])[12:] - } - return k.address -} - -func (k *KeyPair) Mnemonic() string { - if k.mnemonic == "" { - k.mnemonic = strings.Join(MnemonicEncode(common.Bytes2Hex(k.PrivateKey)), " ") - } - return k.mnemonic -} - -func (k *KeyPair) AsStrings() (string, string, string, string) { - return k.Mnemonic(), common.Bytes2Hex(k.Address()), common.Bytes2Hex(k.PrivateKey), common.Bytes2Hex(k.PublicKey) -} diff --git a/crypto/mnemonic.go b/crypto/mnemonic.go deleted file mode 100644 index 34698926cb..0000000000 --- a/crypto/mnemonic.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package crypto - -import ( - "fmt" - "strconv" -) - -// TODO: See if we can refactor this into a shared util lib if we need it multiple times -func IndexOf(slice []string, value string) int64 { - for p, v := range slice { - if v == value { - return int64(p) - } - } - return -1 -} - -func MnemonicEncode(message string) []string { - var out []string - n := int64(len(MnemonicWords)) - - for i := 0; i < len(message); i += (len(message) / 8) { - x := message[i : i+8] - bit, _ := strconv.ParseInt(x, 16, 64) - w1 := (bit % n) - w2 := ((bit / n) + w1) % n - w3 := ((bit / n / n) + w2) % n - out = append(out, MnemonicWords[w1], MnemonicWords[w2], MnemonicWords[w3]) - } - return out -} - -func MnemonicDecode(wordsar []string) string { - var out string - n := int64(len(MnemonicWords)) - - for i := 0; i < len(wordsar); i += 3 { - word1 := wordsar[i] - word2 := wordsar[i+1] - word3 := wordsar[i+2] - w1 := IndexOf(MnemonicWords, word1) - w2 := IndexOf(MnemonicWords, word2) - w3 := IndexOf(MnemonicWords, word3) - - y := (w2 - w1) % n - z := (w3 - w2) % n - - // Golang handles modulo with negative numbers different then most languages - // The modulo can be negative, we don't want that. - if z < 0 { - z += n - } - if y < 0 { - y += n - } - x := w1 + n*(y) + n*n*(z) - out += fmt.Sprintf("%08x", x) - } - return out -} diff --git a/crypto/mnemonic_test.go b/crypto/mnemonic_test.go deleted file mode 100644 index 07b364a01e..0000000000 --- a/crypto/mnemonic_test.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package crypto - -import ( - "testing" -) - -func TestMnDecode(t *testing.T) { - words := []string{ - "ink", - "balance", - "gain", - "fear", - "happen", - "melt", - "mom", - "surface", - "stir", - "bottle", - "unseen", - "expression", - "important", - "curl", - "grant", - "fairy", - "across", - "back", - "figure", - "breast", - "nobody", - "scratch", - "worry", - "yesterday", - } - encode := "c61d43dc5bb7a4e754d111dae8105b6f25356492df5e50ecb33b858d94f8c338" - result := MnemonicDecode(words) - if encode != result { - t.Error("We expected", encode, "got", result, "instead") - } -} -func TestMnEncode(t *testing.T) { - encode := "c61d43dc5bb7a4e754d111dae8105b6f25356492df5e50ecb33b858d94f8c338" - result := []string{ - "ink", - "balance", - "gain", - "fear", - "happen", - "melt", - "mom", - "surface", - "stir", - "bottle", - "unseen", - "expression", - "important", - "curl", - "grant", - "fairy", - "across", - "back", - "figure", - "breast", - "nobody", - "scratch", - "worry", - "yesterday", - } - words := MnemonicEncode(encode) - for i, word := range words { - if word != result[i] { - t.Error("Mnenonic does not match:", words, result) - } - } -} diff --git a/crypto/mnemonic_words.go b/crypto/mnemonic_words.go deleted file mode 100644 index 6b8412e897..0000000000 --- a/crypto/mnemonic_words.go +++ /dev/null @@ -1,1646 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package crypto - -var MnemonicWords []string = []string{ - "like", - "just", - "love", - "know", - "never", - "want", - "time", - "out", - "there", - "make", - "look", - "eye", - "down", - "only", - "think", - "heart", - "back", - "then", - "into", - "about", - "more", - "away", - "still", - "them", - "take", - "thing", - "even", - "through", - "long", - "always", - "world", - "too", - "friend", - "tell", - "try", - "hand", - "thought", - "over", - "here", - "other", - "need", - "smile", - "again", - "much", - "cry", - "been", - "night", - "ever", - "little", - "said", - "end", - "some", - "those", - "around", - "mind", - "people", - "girl", - "leave", - "dream", - "left", - "turn", - "myself", - "give", - "nothing", - "really", - "off", - "before", - "something", - "find", - "walk", - "wish", - "good", - "once", - "place", - "ask", - "stop", - "keep", - "watch", - "seem", - "everything", - "wait", - "got", - "yet", - "made", - "remember", - "start", - "alone", - "run", - "hope", - "maybe", - "believe", - "body", - "hate", - "after", - "close", - "talk", - "stand", - "own", - "each", - "hurt", - "help", - "home", - "god", - "soul", - "new", - "many", - "two", - "inside", - "should", - "true", - "first", - "fear", - "mean", - "better", - "play", - "another", - "gone", - "change", - "use", - "wonder", - "someone", - "hair", - "cold", - "open", - "best", - "any", - "behind", - "happen", - "water", - "dark", - "laugh", - "stay", - "forever", - "name", - "work", - "show", - "sky", - "break", - "came", - "deep", - "door", - "put", - "black", - "together", - "upon", - "happy", - "such", - "great", - "white", - "matter", - "fill", - "past", - "please", - "burn", - "cause", - "enough", - "touch", - "moment", - "soon", - "voice", - "scream", - "anything", - "stare", - "sound", - "red", - "everyone", - "hide", - "kiss", - "truth", - "death", - "beautiful", - "mine", - "blood", - "broken", - "very", - "pass", - "next", - "forget", - "tree", - "wrong", - "air", - "mother", - "understand", - "lip", - "hit", - "wall", - "memory", - "sleep", - "free", - "high", - "realize", - "school", - "might", - "skin", - "sweet", - "perfect", - "blue", - "kill", - "breath", - "dance", - "against", - "fly", - "between", - "grow", - "strong", - "under", - "listen", - "bring", - "sometimes", - "speak", - "pull", - "person", - "become", - "family", - "begin", - "ground", - "real", - "small", - "father", - "sure", - "feet", - "rest", - "young", - "finally", - "land", - "across", - "today", - "different", - "guy", - "line", - "fire", - "reason", - "reach", - "second", - "slowly", - "write", - "eat", - "smell", - "mouth", - "step", - "learn", - "three", - "floor", - "promise", - "breathe", - "darkness", - "push", - "earth", - "guess", - "save", - "song", - "above", - "along", - "both", - "color", - "house", - "almost", - "sorry", - "anymore", - "brother", - "okay", - "dear", - "game", - "fade", - "already", - "apart", - "warm", - "beauty", - "heard", - "notice", - "question", - "shine", - "began", - "piece", - "whole", - "shadow", - "secret", - "street", - "within", - "finger", - "point", - "morning", - "whisper", - "child", - "moon", - "green", - "story", - "glass", - "kid", - "silence", - "since", - "soft", - "yourself", - "empty", - "shall", - "angel", - "answer", - "baby", - "bright", - "dad", - "path", - "worry", - "hour", - "drop", - "follow", - "power", - "war", - "half", - "flow", - "heaven", - "act", - "chance", - "fact", - "least", - "tired", - "children", - "near", - "quite", - "afraid", - "rise", - "sea", - "taste", - "window", - "cover", - "nice", - "trust", - "lot", - "sad", - "cool", - "force", - "peace", - "return", - "blind", - "easy", - "ready", - "roll", - "rose", - "drive", - "held", - "music", - "beneath", - "hang", - "mom", - "paint", - "emotion", - "quiet", - "clear", - "cloud", - "few", - "pretty", - "bird", - "outside", - "paper", - "picture", - "front", - "rock", - "simple", - "anyone", - "meant", - "reality", - "road", - "sense", - "waste", - "bit", - "leaf", - "thank", - "happiness", - "meet", - "men", - "smoke", - "truly", - "decide", - "self", - "age", - "book", - "form", - "alive", - "carry", - "escape", - "damn", - "instead", - "able", - "ice", - "minute", - "throw", - "catch", - "leg", - "ring", - "course", - "goodbye", - "lead", - "poem", - "sick", - "corner", - "desire", - "known", - "problem", - "remind", - "shoulder", - "suppose", - "toward", - "wave", - "drink", - "jump", - "woman", - "pretend", - "sister", - "week", - "human", - "joy", - "crack", - "grey", - "pray", - "surprise", - "dry", - "knee", - "less", - "search", - "bleed", - "caught", - "clean", - "embrace", - "future", - "king", - "son", - "sorrow", - "chest", - "hug", - "remain", - "sat", - "worth", - "blow", - "daddy", - "final", - "parent", - "tight", - "also", - "create", - "lonely", - "safe", - "cross", - "dress", - "evil", - "silent", - "bone", - "fate", - "perhaps", - "anger", - "class", - "scar", - "snow", - "tiny", - "tonight", - "continue", - "control", - "dog", - "edge", - "mirror", - "month", - "suddenly", - "comfort", - "given", - "loud", - "quickly", - "gaze", - "plan", - "rush", - "stone", - "town", - "battle", - "ignore", - "spirit", - "stood", - "stupid", - "yours", - "brown", - "build", - "dust", - "hey", - "kept", - "pay", - "phone", - "twist", - "although", - "ball", - "beyond", - "hidden", - "nose", - "taken", - "fail", - "float", - "pure", - "somehow", - "wash", - "wrap", - "angry", - "cheek", - "creature", - "forgotten", - "heat", - "rip", - "single", - "space", - "special", - "weak", - "whatever", - "yell", - "anyway", - "blame", - "job", - "choose", - "country", - "curse", - "drift", - "echo", - "figure", - "grew", - "laughter", - "neck", - "suffer", - "worse", - "yeah", - "disappear", - "foot", - "forward", - "knife", - "mess", - "somewhere", - "stomach", - "storm", - "beg", - "idea", - "lift", - "offer", - "breeze", - "field", - "five", - "often", - "simply", - "stuck", - "win", - "allow", - "confuse", - "enjoy", - "except", - "flower", - "seek", - "strength", - "calm", - "grin", - "gun", - "heavy", - "hill", - "large", - "ocean", - "shoe", - "sigh", - "straight", - "summer", - "tongue", - "accept", - "crazy", - "everyday", - "exist", - "grass", - "mistake", - "sent", - "shut", - "surround", - "table", - "ache", - "brain", - "destroy", - "heal", - "nature", - "shout", - "sign", - "stain", - "choice", - "doubt", - "glance", - "glow", - "mountain", - "queen", - "stranger", - "throat", - "tomorrow", - "city", - "either", - "fish", - "flame", - "rather", - "shape", - "spin", - "spread", - "ash", - "distance", - "finish", - "image", - "imagine", - "important", - "nobody", - "shatter", - "warmth", - "became", - "feed", - "flesh", - "funny", - "lust", - "shirt", - "trouble", - "yellow", - "attention", - "bare", - "bite", - "money", - "protect", - "amaze", - "appear", - "born", - "choke", - "completely", - "daughter", - "fresh", - "friendship", - "gentle", - "probably", - "six", - "deserve", - "expect", - "grab", - "middle", - "nightmare", - "river", - "thousand", - "weight", - "worst", - "wound", - "barely", - "bottle", - "cream", - "regret", - "relationship", - "stick", - "test", - "crush", - "endless", - "fault", - "itself", - "rule", - "spill", - "art", - "circle", - "join", - "kick", - "mask", - "master", - "passion", - "quick", - "raise", - "smooth", - "unless", - "wander", - "actually", - "broke", - "chair", - "deal", - "favorite", - "gift", - "note", - "number", - "sweat", - "box", - "chill", - "clothes", - "lady", - "mark", - "park", - "poor", - "sadness", - "tie", - "animal", - "belong", - "brush", - "consume", - "dawn", - "forest", - "innocent", - "pen", - "pride", - "stream", - "thick", - "clay", - "complete", - "count", - "draw", - "faith", - "press", - "silver", - "struggle", - "surface", - "taught", - "teach", - "wet", - "bless", - "chase", - "climb", - "enter", - "letter", - "melt", - "metal", - "movie", - "stretch", - "swing", - "vision", - "wife", - "beside", - "crash", - "forgot", - "guide", - "haunt", - "joke", - "knock", - "plant", - "pour", - "prove", - "reveal", - "steal", - "stuff", - "trip", - "wood", - "wrist", - "bother", - "bottom", - "crawl", - "crowd", - "fix", - "forgive", - "frown", - "grace", - "loose", - "lucky", - "party", - "release", - "surely", - "survive", - "teacher", - "gently", - "grip", - "speed", - "suicide", - "travel", - "treat", - "vein", - "written", - "cage", - "chain", - "conversation", - "date", - "enemy", - "however", - "interest", - "million", - "page", - "pink", - "proud", - "sway", - "themselves", - "winter", - "church", - "cruel", - "cup", - "demon", - "experience", - "freedom", - "pair", - "pop", - "purpose", - "respect", - "shoot", - "softly", - "state", - "strange", - "bar", - "birth", - "curl", - "dirt", - "excuse", - "lord", - "lovely", - "monster", - "order", - "pack", - "pants", - "pool", - "scene", - "seven", - "shame", - "slide", - "ugly", - "among", - "blade", - "blonde", - "closet", - "creek", - "deny", - "drug", - "eternity", - "gain", - "grade", - "handle", - "key", - "linger", - "pale", - "prepare", - "swallow", - "swim", - "tremble", - "wheel", - "won", - "cast", - "cigarette", - "claim", - "college", - "direction", - "dirty", - "gather", - "ghost", - "hundred", - "loss", - "lung", - "orange", - "present", - "swear", - "swirl", - "twice", - "wild", - "bitter", - "blanket", - "doctor", - "everywhere", - "flash", - "grown", - "knowledge", - "numb", - "pressure", - "radio", - "repeat", - "ruin", - "spend", - "unknown", - "buy", - "clock", - "devil", - "early", - "false", - "fantasy", - "pound", - "precious", - "refuse", - "sheet", - "teeth", - "welcome", - "add", - "ahead", - "block", - "bury", - "caress", - "content", - "depth", - "despite", - "distant", - "marry", - "purple", - "threw", - "whenever", - "bomb", - "dull", - "easily", - "grasp", - "hospital", - "innocence", - "normal", - "receive", - "reply", - "rhyme", - "shade", - "someday", - "sword", - "toe", - "visit", - "asleep", - "bought", - "center", - "consider", - "flat", - "hero", - "history", - "ink", - "insane", - "muscle", - "mystery", - "pocket", - "reflection", - "shove", - "silently", - "smart", - "soldier", - "spot", - "stress", - "train", - "type", - "view", - "whether", - "bus", - "energy", - "explain", - "holy", - "hunger", - "inch", - "magic", - "mix", - "noise", - "nowhere", - "prayer", - "presence", - "shock", - "snap", - "spider", - "study", - "thunder", - "trail", - "admit", - "agree", - "bag", - "bang", - "bound", - "butterfly", - "cute", - "exactly", - "explode", - "familiar", - "fold", - "further", - "pierce", - "reflect", - "scent", - "selfish", - "sharp", - "sink", - "spring", - "stumble", - "universe", - "weep", - "women", - "wonderful", - "action", - "ancient", - "attempt", - "avoid", - "birthday", - "branch", - "chocolate", - "core", - "depress", - "drunk", - "especially", - "focus", - "fruit", - "honest", - "match", - "palm", - "perfectly", - "pillow", - "pity", - "poison", - "roar", - "shift", - "slightly", - "thump", - "truck", - "tune", - "twenty", - "unable", - "wipe", - "wrote", - "coat", - "constant", - "dinner", - "drove", - "egg", - "eternal", - "flight", - "flood", - "frame", - "freak", - "gasp", - "glad", - "hollow", - "motion", - "peer", - "plastic", - "root", - "screen", - "season", - "sting", - "strike", - "team", - "unlike", - "victim", - "volume", - "warn", - "weird", - "attack", - "await", - "awake", - "built", - "charm", - "crave", - "despair", - "fought", - "grant", - "grief", - "horse", - "limit", - "message", - "ripple", - "sanity", - "scatter", - "serve", - "split", - "string", - "trick", - "annoy", - "blur", - "boat", - "brave", - "clearly", - "cling", - "connect", - "fist", - "forth", - "imagination", - "iron", - "jock", - "judge", - "lesson", - "milk", - "misery", - "nail", - "naked", - "ourselves", - "poet", - "possible", - "princess", - "sail", - "size", - "snake", - "society", - "stroke", - "torture", - "toss", - "trace", - "wise", - "bloom", - "bullet", - "cell", - "check", - "cost", - "darling", - "during", - "footstep", - "fragile", - "hallway", - "hardly", - "horizon", - "invisible", - "journey", - "midnight", - "mud", - "nod", - "pause", - "relax", - "shiver", - "sudden", - "value", - "youth", - "abuse", - "admire", - "blink", - "breast", - "bruise", - "constantly", - "couple", - "creep", - "curve", - "difference", - "dumb", - "emptiness", - "gotta", - "honor", - "plain", - "planet", - "recall", - "rub", - "ship", - "slam", - "soar", - "somebody", - "tightly", - "weather", - "adore", - "approach", - "bond", - "bread", - "burst", - "candle", - "coffee", - "cousin", - "crime", - "desert", - "flutter", - "frozen", - "grand", - "heel", - "hello", - "language", - "level", - "movement", - "pleasure", - "powerful", - "random", - "rhythm", - "settle", - "silly", - "slap", - "sort", - "spoken", - "steel", - "threaten", - "tumble", - "upset", - "aside", - "awkward", - "bee", - "blank", - "board", - "button", - "card", - "carefully", - "complain", - "crap", - "deeply", - "discover", - "drag", - "dread", - "effort", - "entire", - "fairy", - "giant", - "gotten", - "greet", - "illusion", - "jeans", - "leap", - "liquid", - "march", - "mend", - "nervous", - "nine", - "replace", - "rope", - "spine", - "stole", - "terror", - "accident", - "apple", - "balance", - "boom", - "childhood", - "collect", - "demand", - "depression", - "eventually", - "faint", - "glare", - "goal", - "group", - "honey", - "kitchen", - "laid", - "limb", - "machine", - "mere", - "mold", - "murder", - "nerve", - "painful", - "poetry", - "prince", - "rabbit", - "shelter", - "shore", - "shower", - "soothe", - "stair", - "steady", - "sunlight", - "tangle", - "tease", - "treasure", - "uncle", - "begun", - "bliss", - "canvas", - "cheer", - "claw", - "clutch", - "commit", - "crimson", - "crystal", - "delight", - "doll", - "existence", - "express", - "fog", - "football", - "gay", - "goose", - "guard", - "hatred", - "illuminate", - "mass", - "math", - "mourn", - "rich", - "rough", - "skip", - "stir", - "student", - "style", - "support", - "thorn", - "tough", - "yard", - "yearn", - "yesterday", - "advice", - "appreciate", - "autumn", - "bank", - "beam", - "bowl", - "capture", - "carve", - "collapse", - "confusion", - "creation", - "dove", - "feather", - "girlfriend", - "glory", - "government", - "harsh", - "hop", - "inner", - "loser", - "moonlight", - "neighbor", - "neither", - "peach", - "pig", - "praise", - "screw", - "shield", - "shimmer", - "sneak", - "stab", - "subject", - "throughout", - "thrown", - "tower", - "twirl", - "wow", - "army", - "arrive", - "bathroom", - "bump", - "cease", - "cookie", - "couch", - "courage", - "dim", - "guilt", - "howl", - "hum", - "husband", - "insult", - "led", - "lunch", - "mock", - "mostly", - "natural", - "nearly", - "needle", - "nerd", - "peaceful", - "perfection", - "pile", - "price", - "remove", - "roam", - "sanctuary", - "serious", - "shiny", - "shook", - "sob", - "stolen", - "tap", - "vain", - "void", - "warrior", - "wrinkle", - "affection", - "apologize", - "blossom", - "bounce", - "bridge", - "cheap", - "crumble", - "decision", - "descend", - "desperately", - "dig", - "dot", - "flip", - "frighten", - "heartbeat", - "huge", - "lazy", - "lick", - "odd", - "opinion", - "process", - "puzzle", - "quietly", - "retreat", - "score", - "sentence", - "separate", - "situation", - "skill", - "soak", - "square", - "stray", - "taint", - "task", - "tide", - "underneath", - "veil", - "whistle", - "anywhere", - "bedroom", - "bid", - "bloody", - "burden", - "careful", - "compare", - "concern", - "curtain", - "decay", - "defeat", - "describe", - "double", - "dreamer", - "driver", - "dwell", - "evening", - "flare", - "flicker", - "grandma", - "guitar", - "harm", - "horrible", - "hungry", - "indeed", - "lace", - "melody", - "monkey", - "nation", - "object", - "obviously", - "rainbow", - "salt", - "scratch", - "shown", - "shy", - "stage", - "stun", - "third", - "tickle", - "useless", - "weakness", - "worship", - "worthless", - "afternoon", - "beard", - "boyfriend", - "bubble", - "busy", - "certain", - "chin", - "concrete", - "desk", - "diamond", - "doom", - "drawn", - "due", - "felicity", - "freeze", - "frost", - "garden", - "glide", - "harmony", - "hopefully", - "hunt", - "jealous", - "lightning", - "mama", - "mercy", - "peel", - "physical", - "position", - "pulse", - "punch", - "quit", - "rant", - "respond", - "salty", - "sane", - "satisfy", - "savior", - "sheep", - "slept", - "social", - "sport", - "tuck", - "utter", - "valley", - "wolf", - "aim", - "alas", - "alter", - "arrow", - "awaken", - "beaten", - "belief", - "brand", - "ceiling", - "cheese", - "clue", - "confidence", - "connection", - "daily", - "disguise", - "eager", - "erase", - "essence", - "everytime", - "expression", - "fan", - "flag", - "flirt", - "foul", - "fur", - "giggle", - "glorious", - "ignorance", - "law", - "lifeless", - "measure", - "mighty", - "muse", - "north", - "opposite", - "paradise", - "patience", - "patient", - "pencil", - "petal", - "plate", - "ponder", - "possibly", - "practice", - "slice", - "spell", - "stock", - "strife", - "strip", - "suffocate", - "suit", - "tender", - "tool", - "trade", - "velvet", - "verse", - "waist", - "witch", - "aunt", - "bench", - "bold", - "cap", - "certainly", - "click", - "companion", - "creator", - "dart", - "delicate", - "determine", - "dish", - "dragon", - "drama", - "drum", - "dude", - "everybody", - "feast", - "forehead", - "former", - "fright", - "fully", - "gas", - "hook", - "hurl", - "invite", - "juice", - "manage", - "moral", - "possess", - "raw", - "rebel", - "royal", - "scale", - "scary", - "several", - "slight", - "stubborn", - "swell", - "talent", - "tea", - "terrible", - "thread", - "torment", - "trickle", - "usually", - "vast", - "violence", - "weave", - "acid", - "agony", - "ashamed", - "awe", - "belly", - "blend", - "blush", - "character", - "cheat", - "common", - "company", - "coward", - "creak", - "danger", - "deadly", - "defense", - "define", - "depend", - "desperate", - "destination", - "dew", - "duck", - "dusty", - "embarrass", - "engine", - "example", - "explore", - "foe", - "freely", - "frustrate", - "generation", - "glove", - "guilty", - "health", - "hurry", - "idiot", - "impossible", - "inhale", - "jaw", - "kingdom", - "mention", - "mist", - "moan", - "mumble", - "mutter", - "observe", - "ode", - "pathetic", - "pattern", - "pie", - "prefer", - "puff", - "rape", - "rare", - "revenge", - "rude", - "scrape", - "spiral", - "squeeze", - "strain", - "sunset", - "suspend", - "sympathy", - "thigh", - "throne", - "total", - "unseen", - "weapon", - "weary", -} diff --git a/eth/backend.go b/eth/backend.go index 487e56071f..f7a4319c8b 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -61,10 +61,11 @@ var ( defaultBootNodes = []*discover.Node{ // ETH/DEV Go Bootnodes - discover.MustParseNode("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303"), - discover.MustParseNode("enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303"), + discover.MustParseNode("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303"), // IE + discover.MustParseNode("enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303"), // BR + discover.MustParseNode("enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303"), // SG // ETH/DEV cpp-ethereum (poc-9.ethdev.com) - discover.MustParseNode("enode://487611428e6c99a11a9795a6abe7b529e81315ca6aad66e2a2fc76e3adf263faba0d35466c2f8f68d561dbefa8878d4df5f1f2ddb1fbeab7f42ffb8cd328bd4a@5.1.83.226:30303"), + discover.MustParseNode("enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303"), } staticNodes = "static-nodes.json" // Path within to search for the static node list diff --git a/eth/gasprice.go b/eth/gasprice.go index 031098e9a1..3caad73c6c 100644 --- a/eth/gasprice.go +++ b/eth/gasprice.go @@ -37,12 +37,11 @@ type blockPriceInfo struct { type GasPriceOracle struct { eth *Ethereum chain *core.ChainManager - pool *core.TxPool events event.Subscription blocks map[uint64]*blockPriceInfo firstProcessed, lastProcessed uint64 lastBaseMutex sync.Mutex - lastBase *big.Int + lastBase, minBase *big.Int } func NewGasPriceOracle(eth *Ethereum) (self *GasPriceOracle) { @@ -50,13 +49,15 @@ func NewGasPriceOracle(eth *Ethereum) (self *GasPriceOracle) { self.blocks = make(map[uint64]*blockPriceInfo) self.eth = eth self.chain = eth.chainManager - self.pool = eth.txPool self.events = eth.EventMux().Subscribe( core.ChainEvent{}, core.ChainSplitEvent{}, - core.TxPreEvent{}, - core.TxPostEvent{}, ) + + minbase := new(big.Int).Mul(self.eth.GpoMinGasPrice, big.NewInt(100)) + minbase = minbase.Div(minbase, big.NewInt(int64(self.eth.GpobaseCorrectionFactor))) + self.minBase = minbase + self.processPastBlocks() go self.listenLoop() return @@ -93,8 +94,6 @@ func (self *GasPriceOracle) listenLoop() { self.processBlock(ev.Block) case core.ChainSplitEvent: self.processBlock(ev.Block) - case core.TxPreEvent: - case core.TxPostEvent: } } self.events.Unsubscribe() @@ -131,6 +130,10 @@ func (self *GasPriceOracle) processBlock(block *types.Block) { newBase := new(big.Int).Mul(lastBase, big.NewInt(1000000+crand)) newBase.Div(newBase, big.NewInt(1000000)) + if newBase.Cmp(self.minBase) < 0 { + newBase = self.minBase + } + bpi := self.blocks[i] if bpi == nil { bpi = &blockPriceInfo{} @@ -146,7 +149,7 @@ func (self *GasPriceOracle) processBlock(block *types.Block) { // returns the lowers possible price with which a tx was or could have been included func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int { - gasUsed := new(big.Int) + gasUsed := big.NewInt(0) receipts := self.eth.BlockProcessor().GetBlockReceipts(block.Hash()) if len(receipts) > 0 { @@ -158,12 +161,12 @@ func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int { if new(big.Int).Mul(gasUsed, big.NewInt(100)).Cmp(new(big.Int).Mul(block.GasLimit(), big.NewInt(int64(self.eth.GpoFullBlockRatio)))) < 0 { // block is not full, could have posted a tx with MinGasPrice - return self.eth.GpoMinGasPrice + return big.NewInt(0) } txs := block.Transactions() if len(txs) == 0 { - return self.eth.GpoMinGasPrice + return big.NewInt(0) } // block is full, find smallest gasPrice minPrice := txs[0].GasPrice() diff --git a/eth/handler.go b/eth/handler.go index 2bd3699013..5d233dd968 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -413,10 +413,12 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { pm.fetcher.Enqueue(p.id, request.Block) - // TODO: Schedule a sync to cover potential gaps (this needs proto update) + // Update the peers total difficulty if needed, schedule a download if gapped if request.TD.Cmp(p.Td()) > 0 { p.SetTd(request.TD) - go pm.synchronise(p) + if request.TD.Cmp(new(big.Int).Add(pm.chainman.Td(), request.Block.Difficulty())) > 0 { + go pm.synchronise(p) + } } case TxMsg: diff --git a/fdtrack/fdtrack.go b/fdtrack/fdtrack.go deleted file mode 100644 index 2f5ab57f44..0000000000 --- a/fdtrack/fdtrack.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// Package fdtrack logs statistics about open file descriptors. -package fdtrack - -import ( - "fmt" - "net" - "sort" - "sync" - "time" - - "github.com/ethereum/go-ethereum/logger/glog" -) - -var ( - mutex sync.Mutex - all = make(map[string]int) -) - -func Open(desc string) { - mutex.Lock() - all[desc] += 1 - mutex.Unlock() -} - -func Close(desc string) { - mutex.Lock() - defer mutex.Unlock() - if c, ok := all[desc]; ok { - if c == 1 { - delete(all, desc) - } else { - all[desc]-- - } - } -} - -func WrapListener(desc string, l net.Listener) net.Listener { - Open(desc) - return &wrappedListener{l, desc} -} - -type wrappedListener struct { - net.Listener - desc string -} - -func (w *wrappedListener) Accept() (net.Conn, error) { - c, err := w.Listener.Accept() - if err == nil { - c = WrapConn(w.desc, c) - } - return c, err -} - -func (w *wrappedListener) Close() error { - err := w.Listener.Close() - if err == nil { - Close(w.desc) - } - return err -} - -func WrapConn(desc string, conn net.Conn) net.Conn { - Open(desc) - return &wrappedConn{conn, desc} -} - -type wrappedConn struct { - net.Conn - desc string -} - -func (w *wrappedConn) Close() error { - err := w.Conn.Close() - if err == nil { - Close(w.desc) - } - return err -} - -func Start() { - go func() { - for range time.Tick(15 * time.Second) { - mutex.Lock() - var sum, tracked = 0, []string{} - for what, n := range all { - sum += n - tracked = append(tracked, fmt.Sprintf("%s:%d", what, n)) - } - mutex.Unlock() - used, _ := fdusage() - sort.Strings(tracked) - glog.Infof("fd usage %d/%d, tracked %d %v", used, fdlimit(), sum, tracked) - } - }() -} diff --git a/fdtrack/fdusage_darwin.go b/fdtrack/fdusage_darwin.go deleted file mode 100644 index 04a3a9baf7..0000000000 --- a/fdtrack/fdusage_darwin.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build darwin - -package fdtrack - -import ( - "os" - "syscall" - "unsafe" -) - -// #cgo CFLAGS: -lproc -// #include -// #include -import "C" - -func fdlimit() int { - var nofile syscall.Rlimit - if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &nofile); err != nil { - return 0 - } - return int(nofile.Cur) -} - -func fdusage() (int, error) { - pid := C.int(os.Getpid()) - // Query for a rough estimate on the amout of data that - // proc_pidinfo will return. - rlen, err := C.proc_pidinfo(pid, C.PROC_PIDLISTFDS, 0, nil, 0) - if rlen <= 0 { - return 0, err - } - // Load the list of file descriptors. We don't actually care about - // the content, only about the size. Since the number of fds can - // change while we're reading them, the loop enlarges the buffer - // until proc_pidinfo says the result fitted. - var buf unsafe.Pointer - defer func() { - if buf != nil { - C.free(buf) - } - }() - for buflen := rlen; ; buflen *= 2 { - buf, err = C.reallocf(buf, C.size_t(buflen)) - if buf == nil { - return 0, err - } - rlen, err = C.proc_pidinfo(pid, C.PROC_PIDLISTFDS, 0, buf, buflen) - if rlen <= 0 { - return 0, err - } else if rlen == buflen { - continue - } - return int(rlen / C.PROC_PIDLISTFD_SIZE), nil - } - panic("unreachable") -} diff --git a/fdtrack/fdusage_linux.go b/fdtrack/fdusage_linux.go deleted file mode 100644 index d9a856a0ca..0000000000 --- a/fdtrack/fdusage_linux.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build linux - -package fdtrack - -import ( - "io" - "os" - "syscall" -) - -func fdlimit() int { - var nofile syscall.Rlimit - if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &nofile); err != nil { - return 0 - } - return int(nofile.Cur) -} - -func fdusage() (int, error) { - f, err := os.Open("/proc/self/fd") - if err != nil { - return 0, err - } - defer f.Close() - const batchSize = 100 - n := 0 - for { - list, err := f.Readdirnames(batchSize) - n += len(list) - if err == io.EOF { - break - } else if err != nil { - return 0, err - } - } - return n, nil -} diff --git a/jsre/jsre.go b/jsre/jsre.go index d4c9828970..0db9e33fc5 100644 --- a/jsre/jsre.go +++ b/jsre/jsre.go @@ -65,8 +65,8 @@ func New(assetPath string) *JSRE { } re.loopWg.Add(1) go re.runEventLoop() - re.Compile("pp.js", pp_js) // load prettyprint func definition re.Set("loadScript", re.loadScript) + re.Set("inspect", prettyPrintJS) return re } @@ -255,35 +255,19 @@ func (self *JSRE) loadScript(call otto.FunctionCall) otto.Value { return otto.TrueValue() } -// PrettyPrint writes v to standard output. -func (self *JSRE) PrettyPrint(v interface{}) (val otto.Value, err error) { - var method otto.Value +// EvalAndPrettyPrint evaluates code and pretty prints the result to +// standard output. +func (self *JSRE) EvalAndPrettyPrint(code string) (err error) { self.do(func(vm *otto.Otto) { - val, err = vm.ToValue(v) + var val otto.Value + val, err = vm.Run(code) if err != nil { return } - method, err = vm.Get("prettyPrint") - if err != nil { - return - } - val, err = method.Call(method, val) + prettyPrint(vm, val) + fmt.Println() }) - return val, err -} - -// Eval evaluates JS function and returns result in a pretty printed string format. -func (self *JSRE) Eval(code string) (s string, err error) { - var val otto.Value - val, err = self.Run(code) - if err != nil { - return - } - val, err = self.PrettyPrint(val) - if err != nil { - return - } - return fmt.Sprintf("%v", val), nil + return err } // Compile compiles and then runs a piece of JS code. diff --git a/jsre/jsre_test.go b/jsre/jsre_test.go index 93dc7d1f9a..8450f546c3 100644 --- a/jsre/jsre_test.go +++ b/jsre/jsre_test.go @@ -103,19 +103,14 @@ func TestNatto(t *testing.T) { func TestBind(t *testing.T) { jsre := New("") + defer jsre.Stop(false) jsre.Bind("no", &testNativeObjectBinding{}) - val, err := jsre.Run(`no.TestMethod("testMsg")`) + _, err := jsre.Run(`no.TestMethod("testMsg")`) if err != nil { t.Errorf("expected no error, got %v", err) } - pp, err := jsre.PrettyPrint(val) - if err != nil { - t.Errorf("expected no error, got %v", err) - } - t.Logf("no: %v", pp) - jsre.Stop(false) } func TestLoadScript(t *testing.T) { @@ -139,4 +134,4 @@ func TestLoadScript(t *testing.T) { t.Errorf("expected '%v', got '%v'", exp, got) } jsre.Stop(false) -} \ No newline at end of file +} diff --git a/jsre/pp_js.go b/jsre/pp_js.go deleted file mode 100644 index 80fe523c14..0000000000 --- a/jsre/pp_js.go +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package jsre - -const pp_js = ` -function pp(object, indent) { - try { - JSON.stringify(object) - } catch(e) { - return pp(e, indent); - } - - var str = ""; - if(object instanceof Array) { - str += "["; - for(var i = 0, l = object.length; i < l; i++) { - str += pp(object[i], indent); - - if(i < l-1) { - str += ", "; - } - } - str += " ]"; - } else if (object instanceof Error) { - str += "\033[31m" + "Error:\033[0m " + object.message; - } else if (isBigNumber(object)) { - str += "\033[32m'" + object.toString(10) + "'"; - } else if(typeof(object) === "object") { - str += "{\n"; - indent += " "; - - var fields = getFields(object); - var last = fields[fields.length - 1]; - fields.forEach(function (key) { - str += indent + key + ": "; - try { - str += pp(object[key], indent); - } catch (e) { - str += pp(e, indent); - } - if(key !== last) { - str += ","; - } - str += "\n"; - }); - str += indent.substr(2, indent.length) + "}"; - } else if(typeof(object) === "string") { - str += "\033[32m'" + object + "'"; - } else if(typeof(object) === "undefined") { - str += "\033[1m\033[30m" + object; - } else if(typeof(object) === "number") { - str += "\033[31m" + object; - } else if(typeof(object) === "function") { - str += "\033[35m" + object.toString().split(" {")[0]; - } else { - str += object; - } - - str += "\033[0m"; - - return str; -} - -var redundantFields = [ - 'valueOf', - 'toString', - 'toLocaleString', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' -]; - -var getFields = function (object) { - var members = Object.getOwnPropertyNames(object); - if (object.constructor && object.constructor.prototype) { - members = members.concat(Object.getOwnPropertyNames(object.constructor.prototype)); - } - - var fields = members.filter(function (member) { - return !isMemberFunction(object, member) - }).sort() - var funcs = members.filter(function (member) { - return isMemberFunction(object, member) - }).sort() - - var results = fields.concat(funcs); - return results.filter(function (field) { - return redundantFields.indexOf(field) === -1; - }); -}; - -var isMemberFunction = function(object, member) { - try { - return typeof(object[member]) === "function"; - } catch(e) { - return false; - } -} - -var isBigNumber = function (object) { - var result = typeof BigNumber !== 'undefined' && object instanceof BigNumber; - - if (!result) { - if (typeof(object) === "object" && object.constructor != null) { - result = object.constructor.toString().indexOf("function BigNumber(") == 0; - } - } - - return result -}; - -function prettyPrint(/* */) { - var args = arguments; - var ret = ""; - for(var i = 0, l = args.length; i < l; i++) { - ret += pp(args[i], "") + "\n"; - } - return ret; -} - -var print = prettyPrint; -` diff --git a/jsre/pretty.go b/jsre/pretty.go new file mode 100644 index 0000000000..99aa9b33e5 --- /dev/null +++ b/jsre/pretty.go @@ -0,0 +1,231 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package jsre + +import ( + "fmt" + "sort" + "strconv" + "strings" + + "github.com/fatih/color" + "github.com/robertkrimen/otto" +) + +const ( + maxPrettyPrintLevel = 3 + indentString = " " +) + +var ( + functionColor = color.New(color.FgMagenta) + specialColor = color.New(color.Bold) + numberColor = color.New(color.FgRed) + stringColor = color.New(color.FgGreen) +) + +// these fields are hidden when printing objects. +var boringKeys = map[string]bool{ + "valueOf": true, + "toString": true, + "toLocaleString": true, + "hasOwnProperty": true, + "isPrototypeOf": true, + "propertyIsEnumerable": true, + "constructor": true, +} + +// prettyPrint writes value to standard output. +func prettyPrint(vm *otto.Otto, value otto.Value) { + ppctx{vm}.printValue(value, 0, false) +} + +func prettyPrintJS(call otto.FunctionCall) otto.Value { + for _, v := range call.ArgumentList { + prettyPrint(call.Otto, v) + fmt.Println() + } + return otto.UndefinedValue() +} + +type ppctx struct{ vm *otto.Otto } + +func (ctx ppctx) indent(level int) string { + return strings.Repeat(indentString, level) +} + +func (ctx ppctx) printValue(v otto.Value, level int, inArray bool) { + switch { + case v.IsObject(): + ctx.printObject(v.Object(), level, inArray) + case v.IsNull(): + specialColor.Print("null") + case v.IsUndefined(): + specialColor.Print("undefined") + case v.IsString(): + s, _ := v.ToString() + stringColor.Printf("%q", s) + case v.IsBoolean(): + b, _ := v.ToBoolean() + specialColor.Printf("%t", b) + case v.IsNaN(): + numberColor.Printf("NaN") + case v.IsNumber(): + s, _ := v.ToString() + numberColor.Printf("%s", s) + default: + fmt.Printf("") + } +} + +func (ctx ppctx) printObject(obj *otto.Object, level int, inArray bool) { + switch obj.Class() { + case "Array": + lv, _ := obj.Get("length") + len, _ := lv.ToInteger() + if len == 0 { + fmt.Printf("[]") + return + } + if level > maxPrettyPrintLevel { + fmt.Print("[...]") + return + } + fmt.Print("[") + for i := int64(0); i < len; i++ { + el, err := obj.Get(strconv.FormatInt(i, 10)) + if err == nil { + ctx.printValue(el, level+1, true) + } + if i < len-1 { + fmt.Printf(", ") + } + } + fmt.Print("]") + + case "Object": + // Print values from bignumber.js as regular numbers. + if ctx.isBigNumber(obj) { + numberColor.Print(toString(obj)) + return + } + // Otherwise, print all fields indented, but stop if we're too deep. + keys := ctx.fields(obj) + if len(keys) == 0 { + fmt.Print("{}") + return + } + if level > maxPrettyPrintLevel { + fmt.Print("{...}") + return + } + fmt.Println("{") + for i, k := range keys { + v, _ := obj.Get(k) + fmt.Printf("%s%s: ", ctx.indent(level+1), k) + ctx.printValue(v, level+1, false) + if i < len(keys)-1 { + fmt.Printf(",") + } + fmt.Println() + } + if inArray { + level-- + } + fmt.Printf("%s}", ctx.indent(level)) + + case "Function": + // Use toString() to display the argument list if possible. + if robj, err := obj.Call("toString"); err != nil { + functionColor.Print("function()") + } else { + desc := strings.Trim(strings.Split(robj.String(), "{")[0], " \t\n") + desc = strings.Replace(desc, " (", "(", 1) + functionColor.Print(desc) + } + + case "RegExp": + stringColor.Print(toString(obj)) + + default: + if v, _ := obj.Get("toString"); v.IsFunction() && level <= maxPrettyPrintLevel { + s, _ := obj.Call("toString") + fmt.Printf("<%s %s>", obj.Class(), s.String()) + } else { + fmt.Printf("<%s>", obj.Class()) + } + } +} + +func (ctx ppctx) fields(obj *otto.Object) []string { + var ( + vals, methods []string + seen = make(map[string]bool) + ) + add := func(k string) { + if seen[k] || boringKeys[k] { + return + } + seen[k] = true + if v, _ := obj.Get(k); v.IsFunction() { + methods = append(methods, k) + } else { + vals = append(vals, k) + } + } + // add own properties + ctx.doOwnProperties(obj.Value(), add) + // add properties of the constructor + if cp := constructorPrototype(obj); cp != nil { + ctx.doOwnProperties(cp.Value(), add) + } + sort.Strings(vals) + sort.Strings(methods) + return append(vals, methods...) +} + +func (ctx ppctx) doOwnProperties(v otto.Value, f func(string)) { + Object, _ := ctx.vm.Object("Object") + rv, _ := Object.Call("getOwnPropertyNames", v) + gv, _ := rv.Export() + for _, v := range gv.([]interface{}) { + f(v.(string)) + } +} + +func (ctx ppctx) isBigNumber(v *otto.Object) bool { + BigNumber, err := ctx.vm.Run("BigNumber.prototype") + if err != nil { + panic(err) + } + cp := constructorPrototype(v) + return cp != nil && cp.Value() == BigNumber +} + +func toString(obj *otto.Object) string { + s, _ := obj.Call("toString") + return s.String() +} + +func constructorPrototype(obj *otto.Object) *otto.Object { + if v, _ := obj.Get("constructor"); v.Object() != nil { + if v, _ = v.Object().Get("prototype"); v.Object() != nil { + return v.Object() + } + } + return nil +} diff --git a/miner/worker.go b/miner/worker.go index df3681470d..aa2132a51c 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -297,14 +297,17 @@ func (self *worker) wait() { } // broadcast before waiting for validation - go func(block *types.Block, logs state.Logs) { + go func(block *types.Block, logs state.Logs, receipts []*types.Receipt) { self.mux.Post(core.NewMinedBlockEvent{block}) self.mux.Post(core.ChainEvent{block, block.Hash(), logs}) if stat == core.CanonStatTy { self.mux.Post(core.ChainHeadEvent{block}) self.mux.Post(logs) } - }(block, work.state.Logs()) + if err := core.PutBlockReceipts(self.chainDb, block, receipts); err != nil { + glog.V(logger.Warn).Infoln("error writing block receipts:", err) + } + }(block, work.state.Logs(), work.receipts) } // check staleness and display confirmation diff --git a/p2p/dial.go b/p2p/dial.go index 8b210bacd2..0fd3a4cf52 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -23,7 +23,6 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/p2p/discover" @@ -213,7 +212,6 @@ func (t *dialTask) Do(srv *Server) { glog.V(logger.Detail).Infof("dial error: %v", err) return } - fd = fdtrack.WrapConn("p2p", fd) mfd := newMeteredConn(fd, false) srv.setupConn(mfd, t.flags, t.dest) diff --git a/p2p/discover/node.go b/p2p/discover/node.go index b6956e197d..a14f294249 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -48,6 +48,10 @@ type Node struct { // In those tests, the content of sha will not actually correspond // with ID. sha common.Hash + + // whether this node is currently being pinged in order to replace + // it in a bucket + contested bool } func newNode(id NodeID, ip net.IP, udpPort, tcpPort uint16) *Node { diff --git a/p2p/discover/table.go b/p2p/discover/table.go index b077f010c7..972bc10777 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -455,24 +455,31 @@ func (tab *Table) ping(id NodeID, addr *net.UDPAddr) error { func (tab *Table) add(new *Node) { b := tab.buckets[logdist(tab.self.sha, new.sha)] tab.mutex.Lock() + defer tab.mutex.Unlock() if b.bump(new) { - tab.mutex.Unlock() return } var oldest *Node if len(b.entries) == bucketSize { oldest = b.entries[bucketSize-1] + if oldest.contested { + // The node is already being replaced, don't attempt + // to replace it. + return + } + oldest.contested = true // Let go of the mutex so other goroutines can access // the table while we ping the least recently active node. tab.mutex.Unlock() - if err := tab.ping(oldest.ID, oldest.addr()); err == nil { + err := tab.ping(oldest.ID, oldest.addr()) + tab.mutex.Lock() + oldest.contested = false + if err == nil { // The node responded, don't replace it. return } - tab.mutex.Lock() } added := b.replace(new, oldest) - tab.mutex.Unlock() if added && tab.nodeAddedHook != nil { tab.nodeAddedHook(new) } diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index 008e63937d..afb31ee69d 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -26,7 +26,6 @@ import ( "time" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/p2p/nat" @@ -200,7 +199,6 @@ func ListenUDP(priv *ecdsa.PrivateKey, laddr string, natm nat.Interface, nodeDBP if err != nil { return nil, err } - fdtrack.Open("p2p") conn, err := net.ListenUDP("udp", addr) if err != nil { return nil, err @@ -238,7 +236,6 @@ func newUDP(priv *ecdsa.PrivateKey, c conn, natm nat.Interface, nodeDBPath strin func (t *udp) close() { close(t.closing) - fdtrack.Close("p2p") t.conn.Close() // TODO: wait for the loops to end. } @@ -458,6 +455,10 @@ func encodePacket(priv *ecdsa.PrivateKey, ptype byte, req interface{}) ([]byte, return packet, nil } +type tempError interface { + Temporary() bool +} + // readLoop runs in its own goroutine. it handles incoming UDP packets. func (t *udp) readLoop() { defer t.conn.Close() @@ -467,7 +468,13 @@ func (t *udp) readLoop() { buf := make([]byte, 1280) for { nbytes, from, err := t.conn.ReadFromUDP(buf) - if err != nil { + if tempErr, ok := err.(tempError); ok && tempErr.Temporary() { + // Ignore temporary read errors. + glog.V(logger.Debug).Infof("Temporary read error: %v", err) + continue + } else if err != nil { + // Shut down the loop for permament errors. + glog.V(logger.Debug).Infof("Read error: %v", err) return } t.handlePacket(from, buf[:nbytes]) diff --git a/p2p/metrics.go b/p2p/metrics.go index 8ee4ed04b6..f98cac2742 100644 --- a/p2p/metrics.go +++ b/p2p/metrics.go @@ -34,7 +34,7 @@ var ( // meteredConn is a wrapper around a network TCP connection that meters both the // inbound and outbound network traffic. type meteredConn struct { - net.Conn + *net.TCPConn // Network connection to wrap with metering } // newMeteredConn creates a new metered connection, also bumping the ingress or @@ -45,13 +45,13 @@ func newMeteredConn(conn net.Conn, ingress bool) net.Conn { } else { egressConnectMeter.Mark(1) } - return &meteredConn{conn} + return &meteredConn{conn.(*net.TCPConn)} } // Read delegates a network read to the underlying connection, bumping the ingress // traffic meter along the way. func (c *meteredConn) Read(b []byte) (n int, err error) { - n, err = c.Conn.Read(b) + n, err = c.TCPConn.Read(b) ingressTrafficMeter.Mark(int64(n)) return } @@ -59,7 +59,7 @@ func (c *meteredConn) Read(b []byte) (n int, err error) { // Write delegates a network write to the underlying connection, bumping the // egress traffic meter along the way. func (c *meteredConn) Write(b []byte) (n int, err error) { - n, err = c.Conn.Write(b) + n, err = c.TCPConn.Write(b) egressTrafficMeter.Mark(int64(n)) return } diff --git a/p2p/server.go b/p2p/server.go index 7351a26544..6060adc71d 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -25,7 +25,6 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/p2p/discover" @@ -373,7 +372,7 @@ func (srv *Server) startListening() error { } laddr := listener.Addr().(*net.TCPAddr) srv.ListenAddr = laddr.String() - srv.listener = fdtrack.WrapListener("p2p", listener) + srv.listener = listener srv.loopWG.Add(1) go srv.listenLoop() // Map the TCP listening port if NAT is configured. @@ -542,6 +541,10 @@ func (srv *Server) encHandshakeChecks(peers map[discover.NodeID]*Peer, c *conn) } } +type tempError interface { + Temporary() bool +} + // listenLoop runs in its own goroutine and accepts // inbound connections. func (srv *Server) listenLoop() { @@ -561,16 +564,31 @@ func (srv *Server) listenLoop() { } for { + // Wait for a handshake slot before accepting. <-slots - fd, err := srv.listener.Accept() - if err != nil { - return - } - mfd := newMeteredConn(fd, true) - glog.V(logger.Debug).Infof("Accepted conn %v\n", mfd.RemoteAddr()) + var ( + fd net.Conn + err error + ) + for { + fd, err = srv.listener.Accept() + if tempErr, ok := err.(tempError); ok && tempErr.Temporary() { + glog.V(logger.Debug).Infof("Temporary read error: %v", err) + continue + } else if err != nil { + glog.V(logger.Debug).Infof("Read error: %v", err) + return + } + break + } + fd = newMeteredConn(fd, true) + glog.V(logger.Debug).Infof("Accepted conn %v\n", fd.RemoteAddr()) + + // Spawn the handler. It will give the slot back when the connection + // has been established. go func() { - srv.setupConn(mfd, inboundConn, nil) + srv.setupConn(fd, inboundConn, nil) slots <- struct{}{} }() } diff --git a/rpc/api/admin.go b/rpc/api/admin.go index 29f342ab63..5e392ae320 100644 --- a/rpc/api/admin.go +++ b/rpc/api/admin.go @@ -37,6 +37,7 @@ import ( "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/ethereum/go-ethereum/rpc/useragent" "github.com/ethereum/go-ethereum/xeth" ) @@ -71,6 +72,7 @@ var ( "admin_httpGet": (*adminApi).HttpGet, "admin_sleepBlocks": (*adminApi).SleepBlocks, "admin_sleep": (*adminApi).Sleep, + "admin_enableUserAgent": (*adminApi).EnableUserAgent, } ) @@ -474,3 +476,10 @@ func (self *adminApi) HttpGet(req *shared.Request) (interface{}, error) { return string(resp), nil } + +func (self *adminApi) EnableUserAgent(req *shared.Request) (interface{}, error) { + if fe, ok := self.xeth.Frontend().(*useragent.RemoteFrontend); ok { + fe.Enable() + } + return true, nil +} diff --git a/rpc/api/eth.go b/rpc/api/eth.go index 820ea761b3..5199bd966d 100644 --- a/rpc/api/eth.go +++ b/rpc/api/eth.go @@ -577,10 +577,10 @@ func (self *ethApi) SubmitWork(req *shared.Request) (interface{}, error) { func (self *ethApi) SubmitHashrate(req *shared.Request) (interface{}, error) { args := new(SubmitHashRateArgs) if err := self.codec.Decode(req.Params, &args); err != nil { - return nil, shared.NewDecodeParamError(err.Error()) + return false, shared.NewDecodeParamError(err.Error()) } self.xeth.RemoteMining().SubmitHashrate(common.HexToHash(args.Id), args.Rate) - return nil, nil + return true, nil } func (self *ethApi) Resend(req *shared.Request) (interface{}, error) { diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index 5a1841cbed..8bd077e209 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -908,14 +908,14 @@ func (args *SubmitWorkArgs) UnmarshalJSON(b []byte) (err error) { type tx struct { tx *types.Transaction - To string - From string - Nonce string - Value string - Data string - GasLimit string - GasPrice string - Hash string + To string `json:"to"` + From string `json:"from"` + Nonce string `json:"nonce"` + Value string `json:"value"` + Data string `json:"data"` + GasLimit string `json:"gas"` + GasPrice string `json:"gasPrice"` + Hash string `json:"hash"` } func newTx(t *types.Transaction) *tx { diff --git a/rpc/api/net.go b/rpc/api/net.go index 39c230e143..9c63696152 100644 --- a/rpc/api/net.go +++ b/rpc/api/net.go @@ -32,7 +32,7 @@ var ( netMapping = map[string]nethandler{ "net_peerCount": (*netApi).PeerCount, "net_listening": (*netApi).IsListening, - "net_version": (*netApi).Version, + "net_version": (*netApi).Version, } ) @@ -97,4 +97,3 @@ func (self *netApi) IsListening(req *shared.Request) (interface{}, error) { func (self *netApi) Version(req *shared.Request) (interface{}, error) { return self.xeth.NetworkVersion(), nil } - diff --git a/rpc/api/personal.go b/rpc/api/personal.go index e9942c1e55..6c73ac83df 100644 --- a/rpc/api/personal.go +++ b/rpc/api/personal.go @@ -17,6 +17,7 @@ package api import ( + "fmt" "time" "github.com/ethereum/go-ethereum/common" @@ -125,18 +126,17 @@ func (self *personalApi) UnlockAccount(req *shared.Request) (interface{}, error) return nil, shared.NewDecodeParamError(err.Error()) } - var err error + if len(args.Passphrase) == 0 { + fe := self.xeth.Frontend() + if fe == nil { + return false, fmt.Errorf("No password provided") + } + return fe.UnlockAccount(common.HexToAddress(args.Address).Bytes()), nil + } + am := self.ethereum.AccountManager() addr := common.HexToAddress(args.Address) - if args.Duration == -1 { - err = am.Unlock(addr, args.Passphrase) - } else { - err = am.TimedUnlock(addr, args.Passphrase, time.Duration(args.Duration)*time.Second) - } - - if err == nil { - return true, nil - } - return false, err + err := am.TimedUnlock(addr, args.Passphrase, time.Duration(args.Duration)*time.Second) + return err == nil, err } diff --git a/rpc/api/personal_args.go b/rpc/api/personal_args.go index 7f00701e32..5a584fb0ce 100644 --- a/rpc/api/personal_args.go +++ b/rpc/api/personal_args.go @@ -86,10 +86,10 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewDecodeParamError(err.Error()) } - args.Duration = -1 + args.Duration = 0 - if len(obj) < 2 { - return shared.NewInsufficientParamsError(len(obj), 2) + if len(obj) < 1 { + return shared.NewInsufficientParamsError(len(obj), 1) } if addrstr, ok := obj[0].(string); ok { @@ -98,10 +98,18 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewInvalidTypeError("address", "not a string") } - if passphrasestr, ok := obj[1].(string); ok { - args.Passphrase = passphrasestr - } else { - return shared.NewInvalidTypeError("passphrase", "not a string") + if len(obj) >= 2 && obj[1] != nil { + if passphrasestr, ok := obj[1].(string); ok { + args.Passphrase = passphrasestr + } else { + return shared.NewInvalidTypeError("passphrase", "not a string") + } + } + + if len(obj) >= 3 && obj[2] != nil { + if duration, ok := obj[2].(float64); ok { + args.Duration = int(duration) + } } return nil diff --git a/rpc/api/ssh_js.go b/rpc/api/shh_js.go similarity index 100% rename from rpc/api/ssh_js.go rename to rpc/api/shh_js.go diff --git a/rpc/codec/codec.go b/rpc/codec/codec.go index 2fdb0d8f3e..786080b44a 100644 --- a/rpc/codec/codec.go +++ b/rpc/codec/codec.go @@ -31,6 +31,8 @@ type ApiCoder interface { ReadRequest() ([]*shared.Request, bool, error) // Parse response message from underlying stream ReadResponse() (interface{}, error) + // Read raw message from underlying stream + Recv() (interface{}, error) // Encode response to encoded form in underlying stream WriteResponse(interface{}) error // Decode single message from data diff --git a/rpc/codec/json.go b/rpc/codec/json.go index d811b20968..cfc449143b 100644 --- a/rpc/codec/json.go +++ b/rpc/codec/json.go @@ -21,6 +21,7 @@ import ( "fmt" "net" "time" + "strings" "github.com/ethereum/go-ethereum/rpc/shared" ) @@ -73,35 +74,41 @@ func (self *JsonCodec) ReadRequest() (requests []*shared.Request, isBatch bool, return nil, false, err } -func (self *JsonCodec) ReadResponse() (interface{}, error) { - bytesInBuffer := 0 - buf := make([]byte, MAX_RESPONSE_SIZE) - - deadline := time.Now().Add(READ_TIMEOUT * time.Second) - if err := self.c.SetDeadline(deadline); err != nil { +func (self *JsonCodec) Recv() (interface{}, error) { + var msg json.RawMessage + err := self.d.Decode(&msg) + if err != nil { + self.c.Close() return nil, err } - for { - n, err := self.c.Read(buf[bytesInBuffer:]) - if err != nil { - return nil, err - } - bytesInBuffer += n + return msg, err +} - var failure shared.ErrorResponse - if err = json.Unmarshal(buf[:bytesInBuffer], &failure); err == nil && failure.Error != nil { +func (self *JsonCodec) ReadResponse() (interface{}, error) { + in, err := self.Recv() + if err != nil { + return nil, err + } + + if msg, ok := in.(json.RawMessage); ok { + var req *shared.Request + if err = json.Unmarshal(msg, &req); err == nil && strings.HasPrefix(req.Method, "agent_") { + return req, nil + } + + var failure *shared.ErrorResponse + if err = json.Unmarshal(msg, &failure); err == nil && failure.Error != nil { return failure, fmt.Errorf(failure.Error.Message) } - var success shared.SuccessResponse - if err = json.Unmarshal(buf[:bytesInBuffer], &success); err == nil { + var success *shared.SuccessResponse + if err = json.Unmarshal(msg, &success); err == nil { return success, nil } } - self.c.Close() - return nil, fmt.Errorf("Unable to read response") + return in, err } // Decode data diff --git a/rpc/comms/comms.go b/rpc/comms/comms.go index f5eeae84fb..731b2f62e4 100644 --- a/rpc/comms/comms.go +++ b/rpc/comms/comms.go @@ -49,7 +49,7 @@ var ( ) type EthereumClient interface { - // Close underlaying connection + // Close underlying connection Close() // Send request Send(interface{}) error diff --git a/rpc/comms/http.go b/rpc/comms/http.go index c08b744a13..c165aa27e1 100644 --- a/rpc/comms/http.go +++ b/rpc/comms/http.go @@ -29,7 +29,6 @@ import ( "io" "io/ioutil" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rpc/codec" @@ -178,7 +177,6 @@ func listenHTTP(addr string, h http.Handler) (*stopServer, error) { if err != nil { return nil, err } - l = fdtrack.WrapListener("rpc", l) s := &stopServer{l: l, idle: make(map[net.Conn]struct{})} s.Server = &http.Server{ Addr: addr, diff --git a/rpc/comms/inproc.go b/rpc/comms/inproc.go index f279f0163d..e8058e32bf 100644 --- a/rpc/comms/inproc.go +++ b/rpc/comms/inproc.go @@ -60,7 +60,7 @@ func (self *InProcClient) Send(req interface{}) error { } func (self *InProcClient) Recv() (interface{}, error) { - return self.lastRes, self.lastErr + return *shared.NewRpcResponse(self.lastId, self.lastJsonrpc, self.lastRes, self.lastErr), nil } func (self *InProcClient) SupportedModules() (map[string]string, error) { diff --git a/rpc/comms/ipc.go b/rpc/comms/ipc.go index 0250aa01e0..d897bf3137 100644 --- a/rpc/comms/ipc.go +++ b/rpc/comms/ipc.go @@ -46,33 +46,18 @@ func (self *ipcClient) Send(req interface{}) error { var err error if r, ok := req.(*shared.Request); ok { if err = self.coder.WriteResponse(r); err != nil { - if _, ok := err.(*net.OpError); ok { // connection lost, retry once - if err = self.reconnect(); err == nil { - err = self.coder.WriteResponse(r) - } + if err = self.reconnect(); err == nil { + err = self.coder.WriteResponse(r) } } + return err } - - return fmt.Errorf("Invalid request (%T)", req) + return err } func (self *ipcClient) Recv() (interface{}, error) { - res, err := self.coder.ReadResponse() - if err != nil { - return nil, err - } - - if r, ok := res.(shared.SuccessResponse); ok { - return r.Result, nil - } - - if r, ok := res.(shared.ErrorResponse); ok { - return r.Error, nil - } - - return res, err + return self.coder.ReadResponse() } func (self *ipcClient) SupportedModules() (map[string]string, error) { @@ -91,7 +76,7 @@ func (self *ipcClient) SupportedModules() (map[string]string, error) { return nil, err } - if sucRes, ok := res.(shared.SuccessResponse); ok { + if sucRes, ok := res.(*shared.SuccessResponse); ok { data, _ := json.Marshal(sucRes.Result) modules := make(map[string]string) err = json.Unmarshal(data, &modules) @@ -109,8 +94,8 @@ func NewIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) { } // Start IPC server -func StartIpc(cfg IpcConfig, codec codec.Codec, offeredApi shared.EthereumApi) error { - return startIpc(cfg, codec, offeredApi) +func StartIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { + return startIpc(cfg, codec, initializer) } func newIpcConnId() int { diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go index 432bf93b53..24aefa5f34 100644 --- a/rpc/comms/ipc_unix.go +++ b/rpc/comms/ipc_unix.go @@ -22,7 +22,6 @@ import ( "net" "os" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rpc/codec" @@ -48,19 +47,18 @@ func (self *ipcClient) reconnect() error { return err } -func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error { +func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { os.Remove(cfg.Endpoint) // in case it still exists from a previous run - l, err := net.Listen("unix", cfg.Endpoint) + l, err := net.ListenUnix("unix", &net.UnixAddr{Name: cfg.Endpoint, Net: "unix"}) if err != nil { return err } - l = fdtrack.WrapListener("ipc", l) os.Chmod(cfg.Endpoint, 0600) go func() { for { - conn, err := l.Accept() + conn, err := l.AcceptUnix() if err != nil { glog.V(logger.Error).Infof("Error accepting ipc connection - %v\n", err) continue @@ -69,6 +67,13 @@ func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error { id := newIpcConnId() glog.V(logger.Debug).Infof("New IPC connection with id %06d started\n", id) + api, err := initializer(conn) + if err != nil { + glog.V(logger.Error).Infof("Unable to initialize IPC connection - %v\n", err) + conn.Close() + continue + } + go handle(id, conn, api, codec) } diff --git a/rpc/comms/ipc_windows.go b/rpc/comms/ipc_windows.go index ee49f069bf..b2fe2b29db 100644 --- a/rpc/comms/ipc_windows.go +++ b/rpc/comms/ipc_windows.go @@ -667,7 +667,7 @@ func (self *ipcClient) reconnect() error { return err } -func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error { +func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { os.Remove(cfg.Endpoint) // in case it still exists from a previous run l, err := Listen(cfg.Endpoint) @@ -687,6 +687,13 @@ func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error { id := newIpcConnId() glog.V(logger.Debug).Infof("New IPC connection with id %06d started\n", id) + api, err := initializer(conn) + if err != nil { + glog.V(logger.Error).Infof("Unable to initialize IPC connection - %v\n", err) + conn.Close() + continue + } + go handle(id, conn, api, codec) } diff --git a/rpc/jeth.go b/rpc/jeth.go index 07add2bad8..158bfb64cb 100644 --- a/rpc/jeth.go +++ b/rpc/jeth.go @@ -18,12 +18,17 @@ package rpc import ( "encoding/json" - "fmt" + "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/jsre" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rpc/comms" "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/ethereum/go-ethereum/rpc/useragent" + "github.com/ethereum/go-ethereum/xeth" + "github.com/robertkrimen/otto" ) @@ -31,10 +36,21 @@ type Jeth struct { ethApi shared.EthereumApi re *jsre.JSRE client comms.EthereumClient + fe xeth.Frontend } -func NewJeth(ethApi shared.EthereumApi, re *jsre.JSRE, client comms.EthereumClient) *Jeth { - return &Jeth{ethApi, re, client} +func NewJeth(ethApi shared.EthereumApi, re *jsre.JSRE, client comms.EthereumClient, fe xeth.Frontend) *Jeth { + // enable the jeth as the user agent + req := shared.Request{ + Id: 0, + Method: useragent.EnableUserAgentMethod, + Jsonrpc: shared.JsonRpcVersion, + Params: []byte("[]"), + } + client.Send(&req) + client.Recv() + + return &Jeth{ethApi, re, client, fe} } func (self *Jeth) err(call otto.FunctionCall, code int, msg string, id interface{}) (response otto.Value) { @@ -72,16 +88,34 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) { if err != nil { return self.err(call, -32603, err.Error(), req.Id) } - respif, err = self.client.Recv() + recv: + respif, err = self.client.Recv() if err != nil { return self.err(call, -32603, err.Error(), req.Id) } + agentreq, isRequest := respif.(*shared.Request) + if isRequest { + self.handleRequest(agentreq) + goto recv // receive response after agent interaction + } + + sucres, isSuccessResponse := respif.(*shared.SuccessResponse) + errres, isErrorResponse := respif.(*shared.ErrorResponse) + if !isSuccessResponse && !isErrorResponse { + return self.err(call, -32603, fmt.Sprintf("Invalid response type (%T)", respif), req.Id) + } + call.Otto.Set("ret_jsonrpc", shared.JsonRpcVersion) call.Otto.Set("ret_id", req.Id) - res, _ := json.Marshal(respif) + var res []byte + if isSuccessResponse { + res, err = json.Marshal(sucres.Result) + } else if isErrorResponse { + res, err = json.Marshal(errres.Error) + } call.Otto.Set("ret_result", string(res)) call.Otto.Set("response_idx", i) @@ -105,3 +139,48 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) { return } + +// handleRequest will handle user agent requests by interacting with the user and sending +// the user response back to the geth service +func (self *Jeth) handleRequest(req *shared.Request) bool { + var err error + var args []interface{} + if err = json.Unmarshal(req.Params, &args); err != nil { + glog.V(logger.Info).Infof("Unable to parse agent request - %v\n", err) + return false + } + + switch req.Method { + case useragent.AskPasswordMethod: + return self.askPassword(req.Id, req.Jsonrpc, args) + case useragent.ConfirmTransactionMethod: + return self.confirmTransaction(req.Id, req.Jsonrpc, args) + } + + return false +} + +// askPassword will ask the user to supply the password for a given account +func (self *Jeth) askPassword(id interface{}, jsonrpc string, args []interface{}) bool { + var err error + var passwd string + if len(args) >= 1 { + if account, ok := args[0].(string); ok { + fmt.Printf("Unlock account %s\n", account) + passwd, err = utils.PromptPassword("Passphrase: ", true) + } else { + return false + } + } + + if err = self.client.Send(shared.NewRpcResponse(id, jsonrpc, passwd, err)); err != nil { + glog.V(logger.Info).Infof("Unable to send user agent ask password response - %v\n", err) + } + + return err == nil +} + +func (self *Jeth) confirmTransaction(id interface{}, jsonrpc string, args []interface{}) bool { + // Accept all tx which are send from this console + return self.client.Send(shared.NewRpcResponse(id, jsonrpc, true, nil)) == nil +} diff --git a/fdtrack/fdusage.go b/rpc/useragent/agent.go similarity index 74% rename from fdtrack/fdusage.go rename to rpc/useragent/agent.go index 689625a8f5..df0739e659 100644 --- a/fdtrack/fdusage.go +++ b/rpc/useragent/agent.go @@ -14,16 +14,11 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . -// +build !linux,!darwin +// package user agent provides frontends and agents which can interact with the user +package useragent -package fdtrack - -import "errors" - -func fdlimit() int { - return 0 -} - -func fdusage() (int, error) { - return 0, errors.New("not implemented") -} +var ( + AskPasswordMethod = "agent_askPassword" + ConfirmTransactionMethod = "agent_confirmTransaction" + EnableUserAgentMethod = "admin_enableUserAgent" +) diff --git a/rpc/useragent/remote_frontend.go b/rpc/useragent/remote_frontend.go new file mode 100644 index 0000000000..0dd4a60497 --- /dev/null +++ b/rpc/useragent/remote_frontend.go @@ -0,0 +1,141 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package useragent + +import ( + "encoding/json" + "fmt" + "net" + + "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/rpc/shared" +) + +// remoteFrontend implements xeth.Frontend and will communicate with an external +// user agent over a connection +type RemoteFrontend struct { + enabled bool + mgr *accounts.Manager + d *json.Decoder + e *json.Encoder + n int +} + +// NewRemoteFrontend creates a new frontend which will interact with an user agent +// over the given connection +func NewRemoteFrontend(conn net.Conn, mgr *accounts.Manager) *RemoteFrontend { + return &RemoteFrontend{false, mgr, json.NewDecoder(conn), json.NewEncoder(conn), 0} +} + +// Enable will enable user interaction +func (fe *RemoteFrontend) Enable() { + fe.enabled = true +} + +// UnlockAccount asks the user agent for the user password and tries to unlock the account. +// It will try 3 attempts before giving up. +func (fe *RemoteFrontend) UnlockAccount(address []byte) bool { + if !fe.enabled { + return false + } + + err := fe.send(AskPasswordMethod, common.Bytes2Hex(address)) + if err != nil { + glog.V(logger.Error).Infof("Unable to send password request to agent - %v\n", err) + return false + } + + passwdRes, err := fe.recv() + if err != nil { + glog.V(logger.Error).Infof("Unable to recv password response from agent - %v\n", err) + return false + } + + if passwd, ok := passwdRes.Result.(string); ok { + err = fe.mgr.Unlock(common.BytesToAddress(address), passwd) + } + + if err == nil { + return true + } + + glog.V(logger.Debug).Infoln("3 invalid account unlock attempts") + return false +} + +// ConfirmTransaction asks the user for approval +func (fe *RemoteFrontend) ConfirmTransaction(tx string) bool { + if !fe.enabled { + return true // backwards compatibility + } + + err := fe.send(ConfirmTransactionMethod, tx) + if err != nil { + glog.V(logger.Error).Infof("Unable to send tx confirmation request to agent - %v\n", err) + return false + } + + confirmResponse, err := fe.recv() + if err != nil { + glog.V(logger.Error).Infof("Unable to recv tx confirmation response from agent - %v\n", err) + return false + } + + if confirmed, ok := confirmResponse.Result.(bool); ok { + return confirmed + } + + return false +} + +// send request to the agent +func (fe *RemoteFrontend) send(method string, params ...interface{}) error { + fe.n += 1 + + p, err := json.Marshal(params) + if err != nil { + glog.V(logger.Info).Infof("Unable to send agent request %v\n", err) + return err + } + + req := shared.Request{ + Method: method, + Jsonrpc: shared.JsonRpcVersion, + Id: fe.n, + Params: p, + } + + return fe.e.Encode(&req) +} + +// recv user response from agent +func (fe *RemoteFrontend) recv() (*shared.SuccessResponse, error) { + var res json.RawMessage + if err := fe.d.Decode(&res); err != nil { + return nil, err + } + + var response shared.SuccessResponse + if err := json.Unmarshal(res, &response); err == nil { + return &response, nil + } + + return nil, fmt.Errorf("Invalid user agent response") +} diff --git a/rpc/xeth.go b/rpc/xeth.go index 65a1edeb8a..9527a96c00 100644 --- a/rpc/xeth.go +++ b/rpc/xeth.go @@ -53,7 +53,7 @@ func (self *Xeth) Call(method string, params []interface{}) (map[string]interfac Method: method, Params: data, } - // Send the request over and process the response + // Send the request over and retrieve the response if err := self.client.Send(req); err != nil { return nil, err } @@ -61,9 +61,17 @@ func (self *Xeth) Call(method string, params []interface{}) (map[string]interfac if err != nil { return nil, err } - value, ok := res.(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("Invalid response type: have %v, want %v", reflect.TypeOf(res), reflect.TypeOf(make(map[string]interface{}))) + // Ensure the response is valid, and extract the results + success, isSuccessResponse := res.(*shared.SuccessResponse) + failure, isFailureResponse := res.(*shared.ErrorResponse) + switch { + case isFailureResponse: + return nil, fmt.Errorf("Method invocation failed: %v", failure.Error) + + case isSuccessResponse: + return success.Result.(map[string]interface{}), nil + + default: + return nil, fmt.Errorf("Invalid response type: %v", reflect.TypeOf(res)) } - return value, nil } diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 8cb7b78825..d47c2b101d 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -150,7 +150,7 @@ func runBlockTests(bt map[string]*BlockTest, skipTests []string) error { // test the block if err := runBlockTest(test); err != nil { - return err + return fmt.Errorf("%s: %v", name, err) } glog.Infoln("Block test passed: ", name) diff --git a/tests/files/BlockchainTests/bcValidBlockTest.json b/tests/files/BlockchainTests/bcValidBlockTest.json index 67a4b123a5..66b3c25eb5 100755 --- a/tests/files/BlockchainTests/bcValidBlockTest.json +++ b/tests/files/BlockchainTests/bcValidBlockTest.json @@ -2,7 +2,7 @@ "ExtraData1024" : { "blocks" : [ { - "rlp" : "0xf90667f905fba0b05b12d82d9f5ea5f1a1d1e0ae300b6765d849c05e85c6e3325adb6a237479e2a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fefd882560b8455b7f276b9040001020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000a0575d3f5fddc1ae8149849dc8e570ec26acceeb71368b7e110112f91e04df574188a786d7a6465bed98f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0" + "rlp" : "0xf90667f905fba08c2fd497eec8ef215f5314aa333dec79cdd7d3ed4ac4b0278b7cb7e896141beba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fe3de82560b8455d5f36db9040001020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000a0fd3fc8e3e2037d4da6ddb2cd53ccf71bfe20e0180b750681615da9f392b2b5cb88483597d2f41121d1f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0" } ], "genesisBlockHeader" : { @@ -12,9 +12,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "b05b12d82d9f5ea5f1a1d1e0ae300b6765d849c05e85c6e3325adb6a237479e2", - "mixHash" : "2138e36442388fbdac952de3df1f45378988bbc0c9908dc75a088a50118df47a", - "nonce" : "4d10a3ed53d49c2a", + "hash" : "8c2fd497eec8ef215f5314aa333dec79cdd7d3ed4ac4b0278b7cb7e896141beb", + "mixHash" : "94113ea0cff9f8e6238d4690bfb792c01f278981cb69324f99b3f7d74a0555f0", + "nonce" : "31a7ad4c847d6419", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -23,8 +23,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0925002c3260b44e44c3edebad1cc442142b03020209df1ab8bb86752edbd2cd7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a02138e36442388fbdac952de3df1f45378988bbc0c9908dc75a088a50118df47a884d10a3ed53d49c2ac0c0", - "lastblockhash" : "b05b12d82d9f5ea5f1a1d1e0ae300b6765d849c05e85c6e3325adb6a237479e2", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0925002c3260b44e44c3edebad1cc442142b03020209df1ab8bb86752edbd2cd7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a094113ea0cff9f8e6238d4690bfb792c01f278981cb69324f99b3f7d74a0555f08831a7ad4c847d6419c0c0", + "lastblockhash" : "8c2fd497eec8ef215f5314aa333dec79cdd7d3ed4ac4b0278b7cb7e896141beb", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x64", @@ -66,20 +66,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x9b60", - "hash" : "4f1efc7a5fc299d3005126217a0a59a1b546d57fba01e9a56ce8d4644989576d", - "mixHash" : "c767990fd2c6a53ff263f07e4865138f6069150ca9a6795c9cb4445e2f688ea4", - "nonce" : "babc01507e64ab08", + "hash" : "8673ec3c2dc51b15ae7d459f4d1b4fb8c2b0540a6ff36c44a89bdd2635f40259", + "mixHash" : "df5262c6a6a63550d25f3f5eb79f0adf4f10bd8d5f391a2e7a0351e042eb3700", + "nonce" : "d0a5076139120a1b", "number" : "0x01", - "parentHash" : "e1202f3547324ec0e187240fd556e9149c61c0e8f3700f974f33b806ec76015f", + "parentHash" : "2dbce99ecc0642021115fd662f970c97db29f0ab77d8cbcfe2fdac5a9c4e751a", "receiptTrie" : "ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707", "stateRoot" : "423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969", - "timestamp" : "0x55b7f279", + "timestamp" : "0x55d5f36f", "transactionsTrie" : "7f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80ae", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf902a6f901f9a0e1202f3547324ec0e187240fd556e9149c61c0e8f3700f974f33b806ec76015fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969a07f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80aea0ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8829b608455b7f27980a0c767990fd2c6a53ff263f07e4865138f6069150ca9a6795c9cb4445e2f688ea488babc01507e64ab08f8a7f8a5800a8307a1208081ffb857604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff1ca00e7d3c664c49aa9f5ce4eb76c8547450466262a78bd093160f492ea0853c68e9a03f843e72210ff1da4fd9e375339872bcf0fad05c014e280ffc755e173700dd62c0", + "rlp" : "0xf902a6f901f9a02dbce99ecc0642021115fd662f970c97db29f0ab77d8cbcfe2fdac5a9c4e751aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969a07f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80aea0ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de829b608455d5f36f80a0df5262c6a6a63550d25f3f5eb79f0adf4f10bd8d5f391a2e7a0351e042eb370088d0a5076139120a1bf8a7f8a5800a8307a1208081ffb857604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff1ca00e7d3c664c49aa9f5ce4eb76c8547450466262a78bd093160f492ea0853c68e9a03f843e72210ff1da4fd9e375339872bcf0fad05c014e280ffc755e173700dd62c0", "transactions" : [ { "data" : "0x604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff", @@ -102,20 +102,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020040", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fd815", "gasUsed" : "0x29e8", - "hash" : "c4a1935a0c4982b76074c9408d4929a68f4ab126eb3aa9744fbb9c8b5b7108c4", - "mixHash" : "f7c83c4dd1027d640134a0796c36836f16bb156b9ad6aac4a7be6c03c1bde51c", - "nonce" : "8a08c681aff3f007", + "hash" : "1c9757e5d46f60bdbf30ad82313b09613b3eacd03250d4e57cd64b4c0536a45f", + "mixHash" : "e92fb366af9ae483a489a07f3efee04e9a1f37a7f8293743c446e5340007d585", + "nonce" : "c80b72a0f5bec0b0", "number" : "0x02", - "parentHash" : "4f1efc7a5fc299d3005126217a0a59a1b546d57fba01e9a56ce8d4644989576d", + "parentHash" : "8673ec3c2dc51b15ae7d459f4d1b4fb8c2b0540a6ff36c44a89bdd2635f40259", "receiptTrie" : "f07efe64d675e0da95ad02d9acabe60870e522a1ef3c2703ddcac44b58a3634c", "stateRoot" : "44b99148dcf8c520293cfa3c86244b4998e57de44313d21d1b0267dc0a68a5d0", - "timestamp" : "0x55b7f27a", + "timestamp" : "0x55d5f371", "transactionsTrie" : "581b9ae3564d0a429f48551804ec427b549b0f9ff92f0e2e96a4898167f82409", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90285f901f9a04f1efc7a5fc299d3005126217a0a59a1b546d57fba01e9a56ce8d4644989576da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a044b99148dcf8c520293cfa3c86244b4998e57de44313d21d1b0267dc0a68a5d0a0581b9ae3564d0a429f48551804ec427b549b0f9ff92f0e2e96a4898167f82409a0f07efe64d675e0da95ad02d9acabe60870e522a1ef3c2703ddcac44b58a3634cb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefd88229e88455b7f27a80a0f7c83c4dd1027d640134a0796c36836f16bb156b9ad6aac4a7be6c03c1bde51c888a08c681aff3f007f886f884010a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c000000000000000000000000000000000000000000000000000000000000000001ba0e9f25400a2683c5323e1f0a2c1d1bbfbc7a525e861993b9f21e414acfa876df0a04e3cb018a144be08a3cf6abc8abfcb0f159190af5d697283f05b326ba59ccc10c0", + "rlp" : "0xf90285f901f9a08673ec3c2dc51b15ae7d459f4d1b4fb8c2b0540a6ff36c44a89bdd2635f40259a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a044b99148dcf8c520293cfa3c86244b4998e57de44313d21d1b0267dc0a68a5d0a0581b9ae3564d0a429f48551804ec427b549b0f9ff92f0e2e96a4898167f82409a0f07efe64d675e0da95ad02d9acabe60870e522a1ef3c2703ddcac44b58a3634cb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fd8158229e88455d5f37180a0e92fb366af9ae483a489a07f3efee04e9a1f37a7f8293743c446e5340007d58588c80b72a0f5bec0b0f886f884010a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c000000000000000000000000000000000000000000000000000000000000000001ba0e9f25400a2683c5323e1f0a2c1d1bbfbc7a525e861993b9f21e414acfa876df0a04e3cb018a144be08a3cf6abc8abfcb0f159190af5d697283f05b326ba59ccc10c0", "transactions" : [ { "data" : "0xcbf0b0c00000000000000000000000000000000000000000000000000000000000000000", @@ -138,20 +138,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020080", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fcc2c", "gasUsed" : "0x5558", - "hash" : "2bea41e919041367b4b757b26e14a7bf59962caeea87be6970fac230e70277fd", - "mixHash" : "caf1160147f0e9f35b8040ded51058cdb92ff2c0f5fe17b57377ad04a51eb32f", - "nonce" : "fa1c1726b129b73d", + "hash" : "35f8fc45e4c6c4917c6335ec17af3b62f417d89d7190388bd9ded21937fcb0ec", + "mixHash" : "f97c32aacf87573135d2cc28fad71cf7887f12365f789310dd6a0ee8056b36aa", + "nonce" : "1cbda4bcf4227d5e", "number" : "0x03", - "parentHash" : "c4a1935a0c4982b76074c9408d4929a68f4ab126eb3aa9744fbb9c8b5b7108c4", + "parentHash" : "1c9757e5d46f60bdbf30ad82313b09613b3eacd03250d4e57cd64b4c0536a45f", "receiptTrie" : "826e862432492d77d6484d0bc7f1446ee70b2c65e8375af09c1d03e306c93e96", "stateRoot" : "bf1799991c6f2f23f1d93ede356e877388ad45e6731ac5e071db76e23df23fc6", - "timestamp" : "0x55b7f27c", + "timestamp" : "0x55d5f373", "transactionsTrie" : "eb87d8102765efd55c70863ab739867ed1bd718611d2b37058d6b7ebd0941a97", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90285f901f9a0c4a1935a0c4982b76074c9408d4929a68f4ab126eb3aa9744fbb9c8b5b7108c4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bf1799991c6f2f23f1d93ede356e877388ad45e6731ac5e071db76e23df23fc6a0eb87d8102765efd55c70863ab739867ed1bd718611d2b37058d6b7ebd0941a97a0826e862432492d77d6484d0bc7f1446ee70b2c65e8375af09c1d03e306c93e96b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefd88255588455b7f27c80a0caf1160147f0e9f35b8040ded51058cdb92ff2c0f5fe17b57377ad04a51eb32f88fa1c1726b129b73df886f884020a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c001100000000000110000000000000110000000000000110000000000000000111ba02db741161d0014df4fdc93cfb33867295da3b2d9bcc9af8e2d6bb478e1a877d0a0439808cf9ba3e46e97e20a05450daa2a6dca8b21fc47041b5fa492fb322f39e4c0", + "rlp" : "0xf90285f901f9a01c9757e5d46f60bdbf30ad82313b09613b3eacd03250d4e57cd64b4c0536a45fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bf1799991c6f2f23f1d93ede356e877388ad45e6731ac5e071db76e23df23fc6a0eb87d8102765efd55c70863ab739867ed1bd718611d2b37058d6b7ebd0941a97a0826e862432492d77d6484d0bc7f1446ee70b2c65e8375af09c1d03e306c93e96b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fcc2c8255588455d5f37380a0f97c32aacf87573135d2cc28fad71cf7887f12365f789310dd6a0ee8056b36aa881cbda4bcf4227d5ef886f884020a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c001100000000000110000000000000110000000000000110000000000000000111ba02db741161d0014df4fdc93cfb33867295da3b2d9bcc9af8e2d6bb478e1a877d0a0439808cf9ba3e46e97e20a05450daa2a6dca8b21fc47041b5fa492fb322f39e4c0", "transactions" : [ { "data" : "0xcbf0b0c00110000000000011000000000000011000000000000011000000000000000011", @@ -176,9 +176,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "e1202f3547324ec0e187240fd556e9149c61c0e8f3700f974f33b806ec76015f", - "mixHash" : "9e1cfca29377121b0aef8a9236f3b123d49dabd48046861bcc1e25fc62c99ff5", - "nonce" : "8756853304b83657", + "hash" : "2dbce99ecc0642021115fd662f970c97db29f0ab77d8cbcfe2fdac5a9c4e751a", + "mixHash" : "e660eaee8fd51b47772bc099e9d42b44b725985863e65c3beaf973aa8c08288d", + "nonce" : "6bd62d8354f7f889", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -187,8 +187,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a09e1cfca29377121b0aef8a9236f3b123d49dabd48046861bcc1e25fc62c99ff5888756853304b83657c0c0", - "lastblockhash" : "2bea41e919041367b4b757b26e14a7bf59962caeea87be6970fac230e70277fd", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0e660eaee8fd51b47772bc099e9d42b44b725985863e65c3beaf973aa8c08288d886bd62d8354f7f889c0c0", + "lastblockhash" : "35f8fc45e4c6c4917c6335ec17af3b62f417d89d7190388bd9ded21937fcb0ec", "postState" : { "0000000000000000000000000000000000000000" : { "balance" : "0x0100", @@ -229,6 +229,152 @@ } } }, + "RecallSuicidedContractInOneBlock" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020000", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x9b60", + "hash" : "cf83ae01626704224c3cb3689a2808d33587e348463bc27db5da8b574b2ed9f4", + "mixHash" : "64f49eed71bbc033392ba8543967d7417a677348ccb9125b5e3993b233032d2b", + "nonce" : "6afddfbe3fc0727c", + "number" : "0x01", + "parentHash" : "e0dffadd3df956f9c6dffdad1481b2de060890e85dde5d4c769ed97ca1019a15", + "receiptTrie" : "ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707", + "stateRoot" : "423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969", + "timestamp" : "0x55d5f375", + "transactionsTrie" : "7f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80ae", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf902a6f901f9a0e0dffadd3df956f9c6dffdad1481b2de060890e85dde5d4c769ed97ca1019a15a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969a07f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80aea0ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de829b608455d5f37580a064f49eed71bbc033392ba8543967d7417a677348ccb9125b5e3993b233032d2b886afddfbe3fc0727cf8a7f8a5800a8307a1208081ffb857604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff1ca00e7d3c664c49aa9f5ce4eb76c8547450466262a78bd093160f492ea0853c68e9a03f843e72210ff1da4fd9e375339872bcf0fad05c014e280ffc755e173700dd62c0", + "transactions" : [ + { + "data" : "0x604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff", + "gasLimit" : "0x07a120", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x0e7d3c664c49aa9f5ce4eb76c8547450466262a78bd093160f492ea0853c68e9", + "s" : "0x3f843e72210ff1da4fd9e375339872bcf0fad05c014e280ffc755e173700dd62", + "to" : "", + "v" : "0x1c", + "value" : "0xff" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020040", + "extraData" : "0x", + "gasLimit" : "0x2fd815", + "gasUsed" : "0x7f40", + "hash" : "ac96fa4af300f71025f7442cf278abe45dc789a167bff8e102ea3f3bb1dee2ca", + "mixHash" : "55bb9767542a6acd7e02cebbff51330846c1e2c4ca703f4655b8be478165d8bd", + "nonce" : "ba79253406610fb9", + "number" : "0x02", + "parentHash" : "cf83ae01626704224c3cb3689a2808d33587e348463bc27db5da8b574b2ed9f4", + "receiptTrie" : "4e6849e0b3c4415a7266cce7d4e494a5a743fca2f95755667fce336c52771c9d", + "stateRoot" : "a3c6cbad55204a40a6661061ea40fbc40491d5e97ca2d5858a025ad5f2178edf", + "timestamp" : "0x55d5f376", + "transactionsTrie" : "4fe1aa9540114cce1ee19a4751bede622013e27f1025c7ef5d955f0132f978db", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf9030cf901f9a0cf83ae01626704224c3cb3689a2808d33587e348463bc27db5da8b574b2ed9f4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0a3c6cbad55204a40a6661061ea40fbc40491d5e97ca2d5858a025ad5f2178edfa04fe1aa9540114cce1ee19a4751bede622013e27f1025c7ef5d955f0132f978dba04e6849e0b3c4415a7266cce7d4e494a5a743fca2f95755667fce336c52771c9db90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fd815827f408455d5f37680a055bb9767542a6acd7e02cebbff51330846c1e2c4ca703f4655b8be478165d8bd88ba79253406610fb9f9010cf884010a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c000000000000000000000000000000000000000000000000000000000000000001ba0e9f25400a2683c5323e1f0a2c1d1bbfbc7a525e861993b9f21e414acfa876df0a04e3cb018a144be08a3cf6abc8abfcb0f159190af5d697283f05b326ba59ccc10f884020a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c001100000000000110000000000000110000000000000110000000000000000111ba02db741161d0014df4fdc93cfb33867295da3b2d9bcc9af8e2d6bb478e1a877d0a0439808cf9ba3e46e97e20a05450daa2a6dca8b21fc47041b5fa492fb322f39e4c0", + "transactions" : [ + { + "data" : "0xcbf0b0c00000000000000000000000000000000000000000000000000000000000000000", + "gasLimit" : "0x07a120", + "gasPrice" : "0x0a", + "nonce" : "0x01", + "r" : "0xe9f25400a2683c5323e1f0a2c1d1bbfbc7a525e861993b9f21e414acfa876df0", + "s" : "0x4e3cb018a144be08a3cf6abc8abfcb0f159190af5d697283f05b326ba59ccc10", + "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", + "v" : "0x1b", + "value" : "0x01" + }, + { + "data" : "0xcbf0b0c00110000000000011000000000000011000000000000011000000000000000011", + "gasLimit" : "0x07a120", + "gasPrice" : "0x0a", + "nonce" : "0x02", + "r" : "0x2db741161d0014df4fdc93cfb33867295da3b2d9bcc9af8e2d6bb478e1a877d0", + "s" : "0x439808cf9ba3e46e97e20a05450daa2a6dca8b21fc47041b5fa492fb322f39e4", + "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", + "v" : "0x1b", + "value" : "0x01" + } + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020000", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "e0dffadd3df956f9c6dffdad1481b2de060890e85dde5d4c769ed97ca1019a15", + "mixHash" : "13558d7be6a18d42bcf54c92ac59c16de2f867012bf6896ea67fea10d3f5bd02", + "nonce" : "515d58cf8b44534a", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "7dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a013558d7be6a18d42bcf54c92ac59c16de2f867012bf6896ea67fea10d3f5bd0288515d58cf8b44534ac0c0", + "lastblockhash" : "ac96fa4af300f71025f7442cf278abe45dc789a167bff8e102ea3f3bb1dee2ca", + "postState" : { + "0000000000000000000000000000000000000000" : { + "balance" : "0x0100", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "balance" : "0x01", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489f30a40", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x09184e6794bf", + "code" : "0x", + "nonce" : "0x03", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x09184e72a000", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, "SimpleTx" : { "blocks" : [ { @@ -239,18 +385,18 @@ "extraData" : "0x", "gasLimit" : "0x2fefd8", "gasUsed" : "0x5208", - "hash" : "9a09e1629419f50a178d08223268dce04d3e9b40c47e23b930af5e6f93b2322c", - "mixHash" : "d72a653d355a6fb95dfca8a70dfb7a1a0c14c43eefd9935d4e2a76863a2675d2", - "nonce" : "ad238c92cd105000", + "hash" : "1233b33c3768c89bd2e949d05a429c8ed5206b1b8bef36d755b088a3c47bf855", + "mixHash" : "22b3f6f80e88965d5e57331e657fc2def2969152c348273fd3a556f62dc8825a", + "nonce" : "6c9b38c24303299c", "number" : "0x01", - "parentHash" : "141fc55a58be70b15bf8449b005772d708f366b088093b57e4c50b31973317f0", + "parentHash" : "c6cde6f56d64db59c89e4543a1c2c1264f8190b02bc762683bbea75a6d61784e", "receiptTrie" : "bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52", "stateRoot" : "964e6c9995e7e3757e934391b4f16b50c20409ee4eb9abd4c4617cb805449b9a", - "timestamp" : "0x55b7f27f", + "timestamp" : "0x55d5f379", "transactionsTrie" : "53d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dc", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90260f901f9a0141fc55a58be70b15bf8449b005772d708f366b088093b57e4c50b31973317f0a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0964e6c9995e7e3757e934391b4f16b50c20409ee4eb9abd4c4617cb805449b9aa053d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dca0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f27f80a0d72a653d355a6fb95dfca8a70dfb7a1a0c14c43eefd9935d4e2a76863a2675d288ad238c92cd105000f861f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1c0", + "rlp" : "0xf90260f901f9a0c6cde6f56d64db59c89e4543a1c2c1264f8190b02bc762683bbea75a6d61784ea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0964e6c9995e7e3757e934391b4f16b50c20409ee4eb9abd4c4617cb805449b9aa053d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dca0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455d5f37980a022b3f6f80e88965d5e57331e657fc2def2969152c348273fd3a556f62dc8825a886c9b38c24303299cf861f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1c0", "transactions" : [ { "data" : "0x", @@ -275,9 +421,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "141fc55a58be70b15bf8449b005772d708f366b088093b57e4c50b31973317f0", - "mixHash" : "dc198bc5b76f3985177efaad99b25bccfbfe9d56328e7ab41ab6a8054ae3203a", - "nonce" : "534d14675dbebd2c", + "hash" : "c6cde6f56d64db59c89e4543a1c2c1264f8190b02bc762683bbea75a6d61784e", + "mixHash" : "8c73628251e10dcd7cac339d4d5d60c28897d59f832435f77c327e4fc04d5e4b", + "nonce" : "a5a076acffc3d021", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -286,8 +432,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0dc198bc5b76f3985177efaad99b25bccfbfe9d56328e7ab41ab6a8054ae3203a88534d14675dbebd2cc0c0", - "lastblockhash" : "9a09e1629419f50a178d08223268dce04d3e9b40c47e23b930af5e6f93b2322c", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a08c73628251e10dcd7cac339d4d5d60c28897d59f832435f77c327e4fc04d5e4b88a5a076acffc3d021c0c0", + "lastblockhash" : "1233b33c3768c89bd2e949d05a429c8ed5206b1b8bef36d755b088a3c47bf855", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x0a", @@ -329,20 +475,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0xf618", - "hash" : "d0c476cd471208ea9000f14343f820bacf5bb84818f164c91ee482b4d15777e5", - "mixHash" : "eb2d5fce544f077d65d201bee95b3047c4ae82f2f47c34e07bccd61348827370", - "nonce" : "3574397101ab284e", + "hash" : "7b4977120a0ee41f3f6a37d35887745fa3ec4f040b19c86c04f1705dcc7cb597", + "mixHash" : "d94fe632206c4afc4f52a75d128ccc6de848e9a458c2217ac8265a647c907750", + "nonce" : "ba192f1cb643c16f", "number" : "0x01", - "parentHash" : "d7a1383adceae842ac7e0c749ec52ad9154f0091db88877d81c6ad722c234892", + "parentHash" : "37cbb5aa6f955d7fc4048cc3dca511979b8a37679835d510cfeb4c6cbe6cde16", "receiptTrie" : "86e489f2e34f4665b59315779d2bb5c16dc9bf7066aad3c89557556a40d76492", "stateRoot" : "63dd9ae8517e40e5e48d7efc1440411c120b3e880ed01d0f6874380cf69d45bf", - "timestamp" : "0x55b7f280", + "timestamp" : "0x55d5f37b", "transactionsTrie" : "9ca199690a5ad007f08fac5b524d2fa2fa1e0397f7534f1d9c7e388c571aa2c4", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90323f901f9a0d7a1383adceae842ac7e0c749ec52ad9154f0091db88877d81c6ad722c234892a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a063dd9ae8517e40e5e48d7efc1440411c120b3e880ed01d0f6874380cf69d45bfa09ca199690a5ad007f08fac5b524d2fa2fa1e0397f7534f1d9c7e388c571aa2c4a086e489f2e34f4665b59315779d2bb5c16dc9bf7066aad3c89557556a40d76492b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882f6188455b7f28080a0eb2d5fce544f077d65d201bee95b3047c4ae82f2f47c34e07bccd61348827370883574397101ab284ef90123f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1f85f800182520894000000000000000000000000000b9331677e6ebf0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3f85f030182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3c0", + "rlp" : "0xf90323f901f9a037cbb5aa6f955d7fc4048cc3dca511979b8a37679835d510cfeb4c6cbe6cde16a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a063dd9ae8517e40e5e48d7efc1440411c120b3e880ed01d0f6874380cf69d45bfa09ca199690a5ad007f08fac5b524d2fa2fa1e0397f7534f1d9c7e388c571aa2c4a086e489f2e34f4665b59315779d2bb5c16dc9bf7066aad3c89557556a40d76492b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de82f6188455d5f37b80a0d94fe632206c4afc4f52a75d128ccc6de848e9a458c2217ac8265a647c90775088ba192f1cb643c16ff90123f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1f85f800182520894000000000000000000000000000b9331677e6ebf0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3f85f030182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3c0", "transactions" : [ { "data" : "0x", @@ -389,9 +535,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "d7a1383adceae842ac7e0c749ec52ad9154f0091db88877d81c6ad722c234892", - "mixHash" : "a4cf31bdf7b647a9c5b4927e113c52fb135ee98648df831149ea161cb06d2291", - "nonce" : "d71919b098132f9c", + "hash" : "37cbb5aa6f955d7fc4048cc3dca511979b8a37679835d510cfeb4c6cbe6cde16", + "mixHash" : "d618479348484fbc60b890b62529d620231bb098ed243c6067c7f01c90df9048", + "nonce" : "85fb6f380fc20c15", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -400,8 +546,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bba25a960aa5c66a2cbd42582b5859a1b8f01db4ccc9eda59e82c315e50dc871a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0a4cf31bdf7b647a9c5b4927e113c52fb135ee98648df831149ea161cb06d229188d71919b098132f9cc0c0", - "lastblockhash" : "d0c476cd471208ea9000f14343f820bacf5bb84818f164c91ee482b4d15777e5", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bba25a960aa5c66a2cbd42582b5859a1b8f01db4ccc9eda59e82c315e50dc871a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0d618479348484fbc60b890b62529d620231bb098ed243c6067c7f01c90df90488885fb6f380fc20c15c0c0", + "lastblockhash" : "7b4977120a0ee41f3f6a37d35887745fa3ec4f040b19c86c04f1705dcc7cb597", "postState" : { "000000000000000000000000000b9331677e6ebf" : { "balance" : "0x0a", @@ -485,20 +631,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0xc350", - "hash" : "3c9b70cb4d3df2d3c3f78efe8ea133e88c229acb0434909b70265424ea0ffc50", - "mixHash" : "19d3895481b5be9641325654014804396c0032528cc127002e0925ddfb596584", - "nonce" : "b28baa17581f6103", + "hash" : "77a8d519b4f678feecda052fa9cd6bac5c1d7313c66af8b434fdf2afe4c0db70", + "mixHash" : "6b4d051c23def9cefc87924bc76619f857a4a6de07a9dadf11552d16b11d00ac", + "nonce" : "ff16b3b8f6dc207a", "number" : "0x01", - "parentHash" : "6985f169ef6a9a8ee58645e7bd93d825672632f2098640eecfdba0c851ec008b", + "parentHash" : "7880053bd588b13a5c3535f212df856c730606b9e51267219e908216bc006a03", "receiptTrie" : "5e947bdcb71ec84c3e4f884827f8bcc98412c54bffa8ee25770d55ddbcb05f23", "stateRoot" : "d4d1286d3c22aaacd7bd2adcc2934ba68740c4c5360c89f99a3a6a727a8bcbbd", - "timestamp" : "0x55b7f282", + "timestamp" : "0x55d5f37e", "transactionsTrie" : "0f6203a75e815282560cdf61871ed2fa253b910d74f0f772bbb980d2f13dedd9", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf903fef901f9a06985f169ef6a9a8ee58645e7bd93d825672632f2098640eecfdba0c851ec008ba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0d4d1286d3c22aaacd7bd2adcc2934ba68740c4c5360c89f99a3a6a727a8bcbbda00f6203a75e815282560cdf61871ed2fa253b910d74f0f772bbb980d2f13dedd9a05e947bdcb71ec84c3e4f884827f8bcc98412c54bffa8ee25770d55ddbcb05f23b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882c3508455b7f28280a019d3895481b5be9641325654014804396c0032528cc127002e0925ddfb59658488b28baa17581f6103f901fef901fb803282c3508080b901ae60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b561ba04d2aeb53154952b3a3d4718d8a11476c1165f8b53fad1c16e7c27d2a0df29298a0695d3859403ff7ae34072e8f48f29d603aef37fff7d01e55f32de724c9492239c0", + "rlp" : "0xf903fef901f9a07880053bd588b13a5c3535f212df856c730606b9e51267219e908216bc006a03a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0d4d1286d3c22aaacd7bd2adcc2934ba68740c4c5360c89f99a3a6a727a8bcbbda00f6203a75e815282560cdf61871ed2fa253b910d74f0f772bbb980d2f13dedd9a05e947bdcb71ec84c3e4f884827f8bcc98412c54bffa8ee25770d55ddbcb05f23b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de82c3508455d5f37e80a06b4d051c23def9cefc87924bc76619f857a4a6de07a9dadf11552d16b11d00ac88ff16b3b8f6dc207af901fef901fb803282c3508080b901ae60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b561ba04d2aeb53154952b3a3d4718d8a11476c1165f8b53fad1c16e7c27d2a0df29298a0695d3859403ff7ae34072e8f48f29d603aef37fff7d01e55f32de724c9492239c0", "transactions" : [ { "data" : "0x60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b56", @@ -523,9 +669,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x64", - "hash" : "6985f169ef6a9a8ee58645e7bd93d825672632f2098640eecfdba0c851ec008b", - "mixHash" : "f0a4f86d751e9307fadaa929b37cfa5fe1a02999157e04ef9ccc061e85a26981", - "nonce" : "fb14a9a8b9e31de0", + "hash" : "7880053bd588b13a5c3535f212df856c730606b9e51267219e908216bc006a03", + "mixHash" : "02f48916fece039bbb816bbc50f0a08ff9ffb5f7c91d66de884e1a0884969b01", + "nonce" : "e89cfda8dde9b93f", "number" : "0x00", "parentHash" : "efb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -534,8 +680,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a0efb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8648454c98c8142a0f0a4f86d751e9307fadaa929b37cfa5fe1a02999157e04ef9ccc061e85a2698188fb14a9a8b9e31de0c0c0", - "lastblockhash" : "3c9b70cb4d3df2d3c3f78efe8ea133e88c229acb0434909b70265424ea0ffc50", + "genesisRLP" : "0xf901fcf901f7a0efb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8648454c98c8142a002f48916fece039bbb816bbc50f0a08ff9ffb5f7c91d66de884e1a0884969b0188e89cfda8dde9b93fc0c0", + "lastblockhash" : "77a8d519b4f678feecda052fa9cd6bac5c1d7313c66af8b434fdf2afe4c0db70", "postState" : { "8888f1f195afa192cfee860698584c030f4c9db1" : { "balance" : "0x45639182451a25a0", @@ -570,20 +716,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x5208", - "hash" : "3fd20fa702f48c4bd057083e98287a1334a132372cee46797c719b49788383d1", - "mixHash" : "abbe70ebd0a3e21bbb974a81353e9ab7c1aeebec833fc8df6c0691659a1a61ca", - "nonce" : "255b34be2e6ca2f8", + "hash" : "36d8fbfc8833d1fde1acd0117797d69bf3034c07280c7846f4a7c5f690c0d1bd", + "mixHash" : "04a94f9f31db791e1c1043f7c2b1a2898df6a80a54ab0878f42473b3c2af5cb9", + "nonce" : "bbbb6e598e5760eb", "number" : "0x01", - "parentHash" : "3b5df92257c6c44e65ec28717e78f50a0aaa7e01f1cafcb439fd1020a24dfbca", + "parentHash" : "859886d7bd1ee6db9677192606fca39f236ad52aa269fd2084f169cdc0184181", "receiptTrie" : "443970a57a806576827076eb900c8c0727c18df44f4ced9fee3c74f2401617f6", "stateRoot" : "3087516fb6d1378db34011edb02d4ba48be6b74e60e38163ff4f42097d87215b", - "timestamp" : "0x55b7f285", + "timestamp" : "0x55d5f37f", "transactionsTrie" : "ac17c4b8de7653cfabc0272d6e1803064949cdd66fd57a713ae1ffe24bfb5293", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90261f901f9a03b5df92257c6c44e65ec28717e78f50a0aaa7e01f1cafcb439fd1020a24dfbcaa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a03087516fb6d1378db34011edb02d4ba48be6b74e60e38163ff4f42097d87215ba0ac17c4b8de7653cfabc0272d6e1803064949cdd66fd57a713ae1ffe24bfb5293a0443970a57a806576827076eb900c8c0727c18df44f4ced9fee3c74f2401617f6b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f28580a0abbe70ebd0a3e21bbb974a81353e9ab7c1aeebec833fc8df6c0691659a1a61ca88255b34be2e6ca2f8f862f860800183014c0894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca04d52b16e9e2813953622dc36e9fc90c1d12fa114a0f7eec136f8129eef11be4ca039aa3ab1e3a55f591c272f7e48f82d1570d27f64cfcd4abd581c05be11d646c0c0", + "rlp" : "0xf90261f901f9a0859886d7bd1ee6db9677192606fca39f236ad52aa269fd2084f169cdc0184181a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a03087516fb6d1378db34011edb02d4ba48be6b74e60e38163ff4f42097d87215ba0ac17c4b8de7653cfabc0272d6e1803064949cdd66fd57a713ae1ffe24bfb5293a0443970a57a806576827076eb900c8c0727c18df44f4ced9fee3c74f2401617f6b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de8252088455d5f37f80a004a94f9f31db791e1c1043f7c2b1a2898df6a80a54ab0878f42473b3c2af5cb988bbbb6e598e5760ebf862f860800183014c0894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca04d52b16e9e2813953622dc36e9fc90c1d12fa114a0f7eec136f8129eef11be4ca039aa3ab1e3a55f591c272f7e48f82d1570d27f64cfcd4abd581c05be11d646c0c0", "transactions" : [ { "data" : "0x", @@ -608,9 +754,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "3b5df92257c6c44e65ec28717e78f50a0aaa7e01f1cafcb439fd1020a24dfbca", - "mixHash" : "661dd4e25905645d3764cb8919a20028b95c936823f7d2f6857fd244f1c8df0f", - "nonce" : "e2549b0340f4e9b1", + "hash" : "859886d7bd1ee6db9677192606fca39f236ad52aa269fd2084f169cdc0184181", + "mixHash" : "44883e5b7f534d928f2e629de72c8c81bb600b74d5ed8205b473a8c55597a540", + "nonce" : "475a338100c88919", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -619,8 +765,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0661dd4e25905645d3764cb8919a20028b95c936823f7d2f6857fd244f1c8df0f88e2549b0340f4e9b1c0c0", - "lastblockhash" : "3fd20fa702f48c4bd057083e98287a1334a132372cee46797c719b49788383d1", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a044883e5b7f534d928f2e629de72c8c81bb600b74d5ed8205b473a8c55597a54088475a338100c88919c0c0", + "lastblockhash" : "36d8fbfc8833d1fde1acd0117797d69bf3034c07280c7846f4a7c5f690c0d1bd", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x0a", @@ -662,20 +808,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x00", - "hash" : "ff4052223054747805f51212eaa245d7e2d2c1102ceaf68085e67d97f12e7ee3", - "mixHash" : "6d61bf247c58b5dbc32070eeae92e472e88b57f07bbfcd70d474be3acea3a10b", - "nonce" : "4effe5f5d22168b2", + "hash" : "4518faee37d63fa607e3d185f998608455c1335ff24548396f951d739d84caf6", + "mixHash" : "3f8815db0719f146b997d1b87e75ad11c09db9557321074dd38b21d0def784ea", + "nonce" : "2357882b0f288034", "number" : "0x01", - "parentHash" : "55b8b40d89cec89769874ae436fdb4dba5a76160a1dd002fc17766bcf6a66916", + "parentHash" : "8a83ada0e0f4251ae1f4de435f56ed7723df9afd12bba44addff5e5ef41b8e41", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "stateRoot" : "8503769bb14067be7c5e438c353094e5a9a6c72f375fad4a76878a8882ceb496", - "timestamp" : "0x55b7f287", + "timestamp" : "0x55d5f380", "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf901fcf901f7a055b8b40d89cec89769874ae436fdb4dba5a76160a1dd002fc17766bcf6a66916a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a08503769bb14067be7c5e438c353094e5a9a6c72f375fad4a76878a8882ceb496a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8808455b7f28780a06d61bf247c58b5dbc32070eeae92e472e88b57f07bbfcd70d474be3acea3a10b884effe5f5d22168b2c0c0", + "rlp" : "0xf901fcf901f7a08a83ada0e0f4251ae1f4de435f56ed7723df9afd12bba44addff5e5ef41b8e41a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a08503769bb14067be7c5e438c353094e5a9a6c72f375fad4a76878a8882ceb496a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de808455d5f38080a03f8815db0719f146b997d1b87e75ad11c09db9557321074dd38b21d0def784ea882357882b0f288034c0c0", "transactions" : [ ], "uncleHeaders" : [ @@ -689,9 +835,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "55b8b40d89cec89769874ae436fdb4dba5a76160a1dd002fc17766bcf6a66916", - "mixHash" : "7fb89eaf6dee42a4e9414aa660f84c738befb439f2b82b0f1bb1973086cc4b67", - "nonce" : "b9e2a6a44f2d6132", + "hash" : "8a83ada0e0f4251ae1f4de435f56ed7723df9afd12bba44addff5e5ef41b8e41", + "mixHash" : "5b4b6d03199c1615a7262b7d7a30bdcd948b4f559c8273da457360a140023fcc", + "nonce" : "7f37019fd56f6bdb", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -700,8 +846,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a07fb89eaf6dee42a4e9414aa660f84c738befb439f2b82b0f1bb1973086cc4b6788b9e2a6a44f2d6132c0c0", - "lastblockhash" : "ff4052223054747805f51212eaa245d7e2d2c1102ceaf68085e67d97f12e7ee3", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a05b4b6d03199c1615a7262b7d7a30bdcd948b4f559c8273da457360a140023fcc887f37019fd56f6bdbc0c0", + "lastblockhash" : "4518faee37d63fa607e3d185f998608455c1335ff24548396f951d739d84caf6", "postState" : { "8888f1f195afa192cfee860698584c030f4c9db1" : { "balance" : "0x4563918244f40000", @@ -736,20 +882,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x014820", - "hash" : "d83bf2449124bae9734e39cbeef25384762572485cedd6b4e49d9f9d62c3ab27", - "mixHash" : "eddeaa4c7bd8fb0837d216aee7ee2bc13ec083ed49368611c8db4b22e5717938", - "nonce" : "ec769ba593955274", + "hash" : "274d394e8c4917a6f69a0de847c4a0dea8a6497d4d8ecca7c585f57d903ad72a", + "mixHash" : "2e8f712996da2d6de99d6de00d650c1f64b2e1c62387956eba6e75c38a38d1cf", + "nonce" : "9b96a98327192017", "number" : "0x01", - "parentHash" : "0162a6c3efcdab1d020ee96966b6d2389647b765e854575c6fc51acc1d62a39f", + "parentHash" : "2a6269150eab64ecdc6ee16dd899acbf09c2f304c1ab658b4df62b83c234a550", "receiptTrie" : "4cf33491338ba5c04157a50abc2ba539a9f84a982ff43af45b0b0382e9bbbad7", "stateRoot" : "374444ef3d413eeeb69c71cfefba8380d463a8fbd233a32b7e0035afa5c400d1", - "timestamp" : "0x55b7f289", + "timestamp" : "0x55d5f382", "transactionsTrie" : "c52db987225c0bbeb1808b41fa870bc5f134073ed79c2d1a9c8b28545de80f49", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90385f901faa00162a6c3efcdab1d020ee96966b6d2389647b765e854575c6fc51acc1d62a39fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0374444ef3d413eeeb69c71cfefba8380d463a8fbd233a32b7e0035afa5c400d1a0c52db987225c0bbeb1808b41fa870bc5f134073ed79c2d1a9c8b28545de80f49a04cf33491338ba5c04157a50abc2ba539a9f84a982ff43af45b0b0382e9bbbad7b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8830148208455b7f28980a0eddeaa4c7bd8fb0837d216aee7ee2bc13ec083ed49368611c8db4b22e571793888ec769ba593955274f90184f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0272bb540c27b214d5cb7deb7ee3a5b0045574474f59a494033efa146c67d0cd2a0272179cc62995b02183f47adcc6a11a66b7cc66c543f9bd4eea28c0368415f62f85f010182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0cd5d6b8050014bc9d170d316d1d5ce8a321e964033c81a267db9abf46871798ba029109ebdc6c46e732e68f26acbc79c4b27ee90123edb2b2d9cc303533584a685f85f020182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0d9e6314ad1ab598ed8948dcc9e68382e8ea532019c9d6363a30b827237d7c89ba058ab0d9c0d6054dbdb626ae4211aca67517f93ceeebdb71e5a8a06117bf52e3ef85f030182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca07b2200ec5136ce610f849f66d04175024134620b94ee509897025c25b1c1b0e7a076cc6272ea4917f4f3a875030a69b6ceef2e11ad21c9c2acaf4964f2344e665ac0", + "rlp" : "0xf90385f901faa02a6269150eab64ecdc6ee16dd899acbf09c2f304c1ab658b4df62b83c234a550a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0374444ef3d413eeeb69c71cfefba8380d463a8fbd233a32b7e0035afa5c400d1a0c52db987225c0bbeb1808b41fa870bc5f134073ed79c2d1a9c8b28545de80f49a04cf33491338ba5c04157a50abc2ba539a9f84a982ff43af45b0b0382e9bbbad7b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de830148208455d5f38280a02e8f712996da2d6de99d6de00d650c1f64b2e1c62387956eba6e75c38a38d1cf889b96a98327192017f90184f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0272bb540c27b214d5cb7deb7ee3a5b0045574474f59a494033efa146c67d0cd2a0272179cc62995b02183f47adcc6a11a66b7cc66c543f9bd4eea28c0368415f62f85f010182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0cd5d6b8050014bc9d170d316d1d5ce8a321e964033c81a267db9abf46871798ba029109ebdc6c46e732e68f26acbc79c4b27ee90123edb2b2d9cc303533584a685f85f020182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0d9e6314ad1ab598ed8948dcc9e68382e8ea532019c9d6363a30b827237d7c89ba058ab0d9c0d6054dbdb626ae4211aca67517f93ceeebdb71e5a8a06117bf52e3ef85f030182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca07b2200ec5136ce610f849f66d04175024134620b94ee509897025c25b1c1b0e7a076cc6272ea4917f4f3a875030a69b6ceef2e11ad21c9c2acaf4964f2344e665ac0", "transactions" : [ { "data" : "0x", @@ -807,9 +953,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "0162a6c3efcdab1d020ee96966b6d2389647b765e854575c6fc51acc1d62a39f", - "mixHash" : "7b7a8a26a239e764118d70095fd7b09ea8fb472a3d5a9114c10dc0fccbe9a5fd", - "nonce" : "01e806c57d7064b0", + "hash" : "2a6269150eab64ecdc6ee16dd899acbf09c2f304c1ab658b4df62b83c234a550", + "mixHash" : "bb09ae3a7189ef5816e52078d798f7fc20db94b79dab95a1c5ef9fbb6e049a6f", + "nonce" : "529ca9d230a6b676", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -818,8 +964,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a07b7a8a26a239e764118d70095fd7b09ea8fb472a3d5a9114c10dc0fccbe9a5fd8801e806c57d7064b0c0c0", - "lastblockhash" : "d83bf2449124bae9734e39cbeef25384762572485cedd6b4e49d9f9d62c3ab27", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0bb09ae3a7189ef5816e52078d798f7fc20db94b79dab95a1c5ef9fbb6e049a6f88529ca9d230a6b676c0c0", + "lastblockhash" : "274d394e8c4917a6f69a0de847c4a0dea8a6497d4d8ecca7c585f57d903ad72a", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x28", @@ -861,20 +1007,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x5208", - "hash" : "a8b5b078d574e979676b1e08456bd062ac71cfd0c9a7c0730e46a37895f8f0f3", - "mixHash" : "028f31c5f12a9b859fd49a3d0fde134f95c09a8b55e98654517e7c2c97cd9fac", - "nonce" : "d1064ddf066b7fef", + "hash" : "adc8932eaf583e4b4b34d178d26996631eb75b051772584bf0d6b41600a7b847", + "mixHash" : "6c3e4bf7ae0cb93ee67b01ea59a3f20de0a57b3200fdb3e0e955a6324b0a7dde", + "nonce" : "8825a74a706f6238", "number" : "0x01", - "parentHash" : "3214af7096561dcdb66ed0658d523dc5d88fcad38d837e2a574d6f0f451e2401", + "parentHash" : "f7b70a12006718c3e4627bdfe3c919fd9eabbf76ff7479f32cf3ddb49c63e6ad", "receiptTrie" : "61d9e5e4b662b22b0f085689e02d37aa14ec80fbdf37f867d9e90a6a7faeb8d3", "stateRoot" : "c1ce557179e21d2943e2a22ceb238403d0f353f1abafc424286cfe27621adcca", - "timestamp" : "0x55b7f28c", + "timestamp" : "0x55d5f384", "transactionsTrie" : "0b02bd3fe4650efdbb64e9df234e189c6fb8ae493fecf5880a90ba3e322c63a4", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90261f901f9a03214af7096561dcdb66ed0658d523dc5d88fcad38d837e2a574d6f0f451e2401a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0c1ce557179e21d2943e2a22ceb238403d0f353f1abafc424286cfe27621adccaa00b02bd3fe4650efdbb64e9df234e189c6fb8ae493fecf5880a90ba3e322c63a4a061d9e5e4b662b22b0f085689e02d37aa14ec80fbdf37f867d9e90a6a7faeb8d3b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f28c80a0028f31c5f12a9b859fd49a3d0fde134f95c09a8b55e98654517e7c2c97cd9fac88d1064ddf066b7feff862f860808083014c0894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0ecde765b594ddb833b31bf9a628c37b339bf902ee753a33f9c1a97b4926af0e6a03066e5a2a101f72195110cbcf749e379afc6bc8232d7c3ea3d7b81ed5397a5b3c0", + "rlp" : "0xf90261f901f9a0f7b70a12006718c3e4627bdfe3c919fd9eabbf76ff7479f32cf3ddb49c63e6ada01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0c1ce557179e21d2943e2a22ceb238403d0f353f1abafc424286cfe27621adccaa00b02bd3fe4650efdbb64e9df234e189c6fb8ae493fecf5880a90ba3e322c63a4a061d9e5e4b662b22b0f085689e02d37aa14ec80fbdf37f867d9e90a6a7faeb8d3b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de8252088455d5f38480a06c3e4bf7ae0cb93ee67b01ea59a3f20de0a57b3200fdb3e0e955a6324b0a7dde888825a74a706f6238f862f860808083014c0894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0ecde765b594ddb833b31bf9a628c37b339bf902ee753a33f9c1a97b4926af0e6a03066e5a2a101f72195110cbcf749e379afc6bc8232d7c3ea3d7b81ed5397a5b3c0", "transactions" : [ { "data" : "0x", @@ -899,9 +1045,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "3214af7096561dcdb66ed0658d523dc5d88fcad38d837e2a574d6f0f451e2401", - "mixHash" : "9ba11764c6f074b44ee8fd4461cfb580cc0fd51fea59e32bfe15bbf127ff2304", - "nonce" : "690f0fd809cfd732", + "hash" : "f7b70a12006718c3e4627bdfe3c919fd9eabbf76ff7479f32cf3ddb49c63e6ad", + "mixHash" : "2bc2e574eea3a4fe7f92ec525312ab9b5c350bc0139e1d444d478c06347b29b5", + "nonce" : "7ce9a2d4a8a46868", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -910,8 +1056,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a09ba11764c6f074b44ee8fd4461cfb580cc0fd51fea59e32bfe15bbf127ff230488690f0fd809cfd732c0c0", - "lastblockhash" : "a8b5b078d574e979676b1e08456bd062ac71cfd0c9a7c0730e46a37895f8f0f3", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a02bc2e574eea3a4fe7f92ec525312ab9b5c350bc0139e1d444d478c06347b29b5887ce9a2d4a8a46868c0c0", + "lastblockhash" : "adc8932eaf583e4b4b34d178d26996631eb75b051772584bf0d6b41600a7b847", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x0a", @@ -953,20 +1099,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x560b", - "hash" : "173d6a2fb94fc7b2710860907f2c6f0ec8d321a559c66fea1c8f85b7642877db", - "mixHash" : "22324b542887e000ad8e42492e7d92c0b066d4c97c3e9bad41e98e858b4ca664", - "nonce" : "96b8a08d3ccbe745", + "hash" : "9db645ca22e25dbe760ed94e4b979a24aaced81feddf8058f1447b6be2252a9c", + "mixHash" : "19077b96c944a3f30c8e3cdc38fd8b2e4ab2fdac14d71c03ea13a416d7ef32ca", + "nonce" : "6889326f8c6fb276", "number" : "0x01", - "parentHash" : "cef2d831b979a7c3a28438aed5a71f4b5cefae2c2eb8e8ee7d9912b64bb7ab74", + "parentHash" : "8e221317873233bc0e5ee34f33c1d376f0db5bc65ba5bd427c02e1ca0663ba25", "receiptTrie" : "c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296", "stateRoot" : "bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bf", - "timestamp" : "0x55b7f28f", + "timestamp" : "0x55d5f386", "transactionsTrie" : "498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90265f901f9a0cef2d831b979a7c3a28438aed5a71f4b5cefae2c2eb8e8ee7d9912b64bb7ab74a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fefd882560b8455b7f28f80a022324b542887e000ad8e42492e7d92c0b066d4c97c3e9bad41e98e858b4ca6648896b8a08d3ccbe745f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0", + "rlp" : "0xf90265f901f9a08e221317873233bc0e5ee34f33c1d376f0db5bc65ba5bd427c02e1ca0663ba25a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fe3de82560b8455d5f38680a019077b96c944a3f30c8e3cdc38fd8b2e4ab2fdac14d71c03ea13a416d7ef32ca886889326f8c6fb276f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0", "transactions" : [ { "data" : "0x", @@ -991,9 +1137,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "cef2d831b979a7c3a28438aed5a71f4b5cefae2c2eb8e8ee7d9912b64bb7ab74", - "mixHash" : "c9897e804a25a198b1fb3c6350d5be02e45d8bbe2ce062bbb14d641490a08c0e", - "nonce" : "d354735f6dc31f19", + "hash" : "8e221317873233bc0e5ee34f33c1d376f0db5bc65ba5bd427c02e1ca0663ba25", + "mixHash" : "512588f77e4b6b7deb3651e89214c54ae9d7b0b51650baad9cec23d162ce91c0", + "nonce" : "f89ef32e65f27ed8", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -1002,8 +1148,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0925002c3260b44e44c3edebad1cc442142b03020209df1ab8bb86752edbd2cd7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0c9897e804a25a198b1fb3c6350d5be02e45d8bbe2ce062bbb14d641490a08c0e88d354735f6dc31f19c0c0", - "lastblockhash" : "173d6a2fb94fc7b2710860907f2c6f0ec8d321a559c66fea1c8f85b7642877db", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0925002c3260b44e44c3edebad1cc442142b03020209df1ab8bb86752edbd2cd7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0512588f77e4b6b7deb3651e89214c54ae9d7b0b51650baad9cec23d162ce91c088f89ef32e65f27ed8c0c0", + "lastblockhash" : "9db645ca22e25dbe760ed94e4b979a24aaced81feddf8058f1447b6be2252a9c", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x012a05f264", @@ -1044,6 +1190,480 @@ } } }, + "timeDiff0" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000040000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x038630", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x560b", + "hash" : "e016b3366903c44b33a0b79af1e286fc13b80fb54d2cbaf62c289be14e2bf958", + "mixHash" : "5f90930a01b1cc113338264120191d7deb9beaefc6b9c2de9dc604bc3be6dae7", + "nonce" : "85aaae2774202ad0", + "number" : "0x01", + "parentHash" : "5e135c4bdefcd8851f92a3a4670e8bf7662961b66876bbb65b572a31358d6d14", + "receiptTrie" : "5e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26", + "stateRoot" : "201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914", + "timestamp" : "0x55d5f388", + "transactionsTrie" : "c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90262f901f9a05e135c4bdefcd8851f92a3a4670e8bf7662961b66876bbb65b572a31358d6d14a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914a0c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7a05e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008303863001832fe3de82560b8455d5f38880a05f90930a01b1cc113338264120191d7deb9beaefc6b9c2de9dc604bc3be6dae78885aaae2774202ad0f863f861800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d87821388801ba0149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393a03cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36c0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0xc350", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393", + "s" : "0x3cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x1388" + } + ], + "uncleHeaders" : [ + ] + }, + { + "rlp" : "0xf901fcf901f7a0e016b3366903c44b33a0b79af1e286fc13b80fb54d2cbaf62c289be14e2bf958a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a002832fd800808455d5f38880a08f4407a10797e7dffabcf54459eb6f63ba0d6925ba7b6e999848d334123b09fe88436e39fd86607230c0c0" + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "5e135c4bdefcd8851f92a3a4670e8bf7662961b66876bbb65b572a31358d6d14", + "mixHash" : "cd34e2cf76dab4ec5e90d8aee1c23968edf59d1264c238769b457959768b2792", + "nonce" : "0f7a20795f299b7b", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a080832fefd8808454c98c8142a0cd34e2cf76dab4ec5e90d8aee1c23968edf59d1264c238769b457959768b2792880f7a20795f299b7bc0c0", + "lastblockhash" : "e016b3366903c44b33a0b79af1e286fc13b80fb54d2cbaf62c289be14e2bf958", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x13ec", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x4563918244f75c6e", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174873780a", + "code" : "0x", + "nonce" : "0x01", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x64", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, + "timeDiff12" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000040000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x038630", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x560b", + "hash" : "022df90fbe4b089dfa6b0a879b9787b262ede8171a1170878e0f694e5e13977d", + "mixHash" : "8226205217edade35ca29967d4dd7a7aa5d9d2453d2e608d023cd8f5a1fb7298", + "nonce" : "27b3c785ac56dee5", + "number" : "0x01", + "parentHash" : "29b2b142238c3820d4ede0193cf4bf11c7a242c38074e1820d410f54f219cc50", + "receiptTrie" : "5e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26", + "stateRoot" : "201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914", + "timestamp" : "0x55d5f38c", + "transactionsTrie" : "c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90262f901f9a029b2b142238c3820d4ede0193cf4bf11c7a242c38074e1820d410f54f219cc50a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914a0c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7a05e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008303863001832fe3de82560b8455d5f38c80a08226205217edade35ca29967d4dd7a7aa5d9d2453d2e608d023cd8f5a1fb72988827b3c785ac56dee5f863f861800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d87821388801ba0149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393a03cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36c0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0xc350", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393", + "s" : "0x3cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x1388" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x", + "gasLimit" : "0x2fd800", + "gasUsed" : "0x00", + "hash" : "5765fc0b211f0686440ad73a8a7b40c2d1bbba1a380755c2fc02ba2fd0ed3920", + "mixHash" : "3d33c0eb4de9bd8df7f581bef8f2a8e184bac0f7b49f7b8bf567b0599edfdeef", + "nonce" : "d08ba7d2e8860f81", + "number" : "0x02", + "parentHash" : "022df90fbe4b089dfa6b0a879b9787b262ede8171a1170878e0f694e5e13977d", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78", + "timestamp" : "0x55d5f398", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf901fcf901f7a0022df90fbe4b089dfa6b0a879b9787b262ede8171a1170878e0f694e5e13977da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a002832fd800808455d5f39880a03d33c0eb4de9bd8df7f581bef8f2a8e184bac0f7b49f7b8bf567b0599edfdeef88d08ba7d2e8860f81c0c0", + "transactions" : [ + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "29b2b142238c3820d4ede0193cf4bf11c7a242c38074e1820d410f54f219cc50", + "mixHash" : "c3fa7245f0b834661ee019eb3d5c93b1b0feefed21ac808b714e846c4b0f0eb2", + "nonce" : "8de870f337f9fdee", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a080832fefd8808454c98c8142a0c3fa7245f0b834661ee019eb3d5c93b1b0feefed21ac808b714e846c4b0f0eb2888de870f337f9fdeec0c0", + "lastblockhash" : "5765fc0b211f0686440ad73a8a7b40c2d1bbba1a380755c2fc02ba2fd0ed3920", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x13ec", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489eb5c6e", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174873780a", + "code" : "0x", + "nonce" : "0x01", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x64", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, + "timeDiff13" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000040000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x038630", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x560b", + "hash" : "32e292b358e8af8d64ff76b578c54498b589c0796110fce0208ea7b9bac8c823", + "mixHash" : "662a7e387a457a9ea534c61809c9b2179a939aeb7b2f43ee99cb79e3acd0a892", + "nonce" : "4b4187434fff8ace", + "number" : "0x01", + "parentHash" : "32a200899b03f628f35544e00bf4df519224e7a2b0bdf4ec17cf49e79d6aba23", + "receiptTrie" : "5e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26", + "stateRoot" : "201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914", + "timestamp" : "0x55d5f3a4", + "transactionsTrie" : "c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90262f901f9a032a200899b03f628f35544e00bf4df519224e7a2b0bdf4ec17cf49e79d6aba23a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914a0c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7a05e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008303863001832fe3de82560b8455d5f3a480a0662a7e387a457a9ea534c61809c9b2179a939aeb7b2f43ee99cb79e3acd0a892884b4187434fff8acef863f861800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d87821388801ba0149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393a03cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36c0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0xc350", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393", + "s" : "0x3cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x1388" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0385c0", + "extraData" : "0x", + "gasLimit" : "0x2fd800", + "gasUsed" : "0x00", + "hash" : "ce62a266c155dbb5a54d1751eff2157eb4aaf30cec6ba4fada794064be5f3c4c", + "mixHash" : "47fdbc9960f9e8ac28228008b70eae19c80df8f091df7a2f99f423c458f7cd2a", + "nonce" : "1d8e8adcf90009c6", + "number" : "0x02", + "parentHash" : "32e292b358e8af8d64ff76b578c54498b589c0796110fce0208ea7b9bac8c823", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78", + "timestamp" : "0x55d5f3b1", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf901fcf901f7a032e292b358e8af8d64ff76b578c54498b589c0796110fce0208ea7b9bac8c823a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830385c002832fd800808455d5f3b180a047fdbc9960f9e8ac28228008b70eae19c80df8f091df7a2f99f423c458f7cd2a881d8e8adcf90009c6c0c0", + "transactions" : [ + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "32a200899b03f628f35544e00bf4df519224e7a2b0bdf4ec17cf49e79d6aba23", + "mixHash" : "888f553018e58e19b120c7a23bd9257ce0a5e47674dde39ff5cdc879f1cd89bd", + "nonce" : "f5b845e1ecbbcc28", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a080832fefd8808454c98c8142a0888f553018e58e19b120c7a23bd9257ce0a5e47674dde39ff5cdc879f1cd89bd88f5b845e1ecbbcc28c0c0", + "lastblockhash" : "ce62a266c155dbb5a54d1751eff2157eb4aaf30cec6ba4fada794064be5f3c4c", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x13ec", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489eb5c6e", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174873780a", + "code" : "0x", + "nonce" : "0x01", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x64", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, + "timeDiff14" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000040000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x038630", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x560b", + "hash" : "844baa5fea0b9e184029509c7f0ecdcc88cdd4afa2eb16f47c6e17693228a8d4", + "mixHash" : "0132a62f6f12967c7dd21b6293422880c6972a2e4949265d4ad1b7d8cf242990", + "nonce" : "7e0dac58cdfdcb85", + "number" : "0x01", + "parentHash" : "6aab9fc348a1137614fd7493bffd8069faf8623440bf2669f3b3e1b6739d122b", + "receiptTrie" : "5e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26", + "stateRoot" : "201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914", + "timestamp" : "0x55d5f3b6", + "transactionsTrie" : "c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90262f901f9a06aab9fc348a1137614fd7493bffd8069faf8623440bf2669f3b3e1b6739d122ba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914a0c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7a05e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008303863001832fe3de82560b8455d5f3b680a00132a62f6f12967c7dd21b6293422880c6972a2e4949265d4ad1b7d8cf242990887e0dac58cdfdcb85f863f861800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d87821388801ba0149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393a03cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36c0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0xc350", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393", + "s" : "0x3cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x1388" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0385c0", + "extraData" : "0x", + "gasLimit" : "0x2fd800", + "gasUsed" : "0x00", + "hash" : "8a2f8db544b6d65d1ca99a61a9afea0f7ff97f253ef293adb764fd893298b986", + "mixHash" : "7905c4293448b50ee78be5e43e3cf31950d8743e82c1733b7d0a038f4f8121d5", + "nonce" : "1906d96c17fa4d0b", + "number" : "0x02", + "parentHash" : "844baa5fea0b9e184029509c7f0ecdcc88cdd4afa2eb16f47c6e17693228a8d4", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78", + "timestamp" : "0x55d5f3c4", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf901fcf901f7a0844baa5fea0b9e184029509c7f0ecdcc88cdd4afa2eb16f47c6e17693228a8d4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830385c002832fd800808455d5f3c480a07905c4293448b50ee78be5e43e3cf31950d8743e82c1733b7d0a038f4f8121d5881906d96c17fa4d0bc0c0", + "transactions" : [ + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "6aab9fc348a1137614fd7493bffd8069faf8623440bf2669f3b3e1b6739d122b", + "mixHash" : "7df1f98666a1a1530a41bdc26363e97d6654bb20824c17bc9f0e53163ca6d655", + "nonce" : "94892f238c65f5dd", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a080832fefd8808454c98c8142a07df1f98666a1a1530a41bdc26363e97d6654bb20824c17bc9f0e53163ca6d6558894892f238c65f5ddc0c0", + "lastblockhash" : "8a2f8db544b6d65d1ca99a61a9afea0f7ff97f253ef293adb764fd893298b986", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x13ec", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489eb5c6e", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174873780a", + "code" : "0x", + "nonce" : "0x01", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x64", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, "txEqualValue" : { "blocks" : [ { @@ -1052,20 +1672,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x5208", - "hash" : "0d1095c688a64015ceda25220045e676c959383aa5e26b4a96b294291c3c09fa", - "mixHash" : "278ab67208b96a18d072e19ff9b1ee7e94a02633a9fd4ade2ba9db3d66d3df54", - "nonce" : "b5f17c43df51ed1d", + "hash" : "ed9d2f59e63cdd914799f58ba90cfd88e74fb6cfce9f0471e65ab387edca0186", + "mixHash" : "7f2b44632d02c094801cc87f5a4c3b046df84b2560490e387d73e0d03c1cee02", + "nonce" : "c91331bc23d7928d", "number" : "0x01", - "parentHash" : "a1be177a6a2793204e15c15d4824097984977ed938cf1f067e165059e348c0a7", + "parentHash" : "aa26c99940f2c9da1900dd7c8fc3734691572d7f9f323644d8666217bde3cd42", "receiptTrie" : "e13e6a83dd076e2589464165628f05caf91a7c54975779549344656b17a89962", "stateRoot" : "ae2d2b287506883322f1c2dae3015b4f2a393332eb0f0aacf11750175ee1ef53", - "timestamp" : "0x55b7f291", + "timestamp" : "0x55d5f3cf", "transactionsTrie" : "498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90265f901f9a0a1be177a6a2793204e15c15d4824097984977ed938cf1f067e165059e348c0a7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ae2d2b287506883322f1c2dae3015b4f2a393332eb0f0aacf11750175ee1ef53a0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0e13e6a83dd076e2589464165628f05caf91a7c54975779549344656b17a89962b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f29180a0278ab67208b96a18d072e19ff9b1ee7e94a02633a9fd4ade2ba9db3d66d3df5488b5f17c43df51ed1df866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0", + "rlp" : "0xf90265f901f9a0aa26c99940f2c9da1900dd7c8fc3734691572d7f9f323644d8666217bde3cd42a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ae2d2b287506883322f1c2dae3015b4f2a393332eb0f0aacf11750175ee1ef53a0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0e13e6a83dd076e2589464165628f05caf91a7c54975779549344656b17a89962b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de8252088455d5f3cf80a07f2b44632d02c094801cc87f5a4c3b046df84b2560490e387d73e0d03c1cee0288c91331bc23d7928df866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0", "transactions" : [ { "data" : "0x", @@ -1090,9 +1710,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "a1be177a6a2793204e15c15d4824097984977ed938cf1f067e165059e348c0a7", - "mixHash" : "398a711c44ddec4affa9fe0f6d5a8b661c0e476d4286b0b457d1fa5f949d56d6", - "nonce" : "854dce3725faf400", + "hash" : "aa26c99940f2c9da1900dd7c8fc3734691572d7f9f323644d8666217bde3cd42", + "mixHash" : "e7fc98b9e9f997750f11975832e15a84aca2f6c01f81e96e0a3bc1535b17aac6", + "nonce" : "5cbb7f6f582ab25c", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -1101,8 +1721,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0398a711c44ddec4affa9fe0f6d5a8b661c0e476d4286b0b457d1fa5f949d56d688854dce3725faf400c0c0", - "lastblockhash" : "0d1095c688a64015ceda25220045e676c959383aa5e26b4a96b294291c3c09fa", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0e7fc98b9e9f997750f11975832e15a84aca2f6c01f81e96e0a3bc1535b17aac6885cbb7f6f582ab25cc0c0", + "lastblockhash" : "ed9d2f59e63cdd914799f58ba90cfd88e74fb6cfce9f0471e65ab387edca0186", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x012a05f200", @@ -1144,20 +1764,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x5208", - "hash" : "feb5732416765067a7c68878fc57ffbb12277f5ad51afb8cd8da7758bce9d1c4", - "mixHash" : "dd069a437769855ba9337ae52b802a4ce92f7e54864ae597ec98000175357482", - "nonce" : "d5854365d85492e6", + "hash" : "094eb118175f79f80fdbc3140d379e0c0b04bef7cd285ea61a1184a8201f5a1f", + "mixHash" : "c3af16a9ee71f47e48ed294aab34d26141e9b3badbf537f42afba78e73e485fd", + "nonce" : "2d1073468aa45fcc", "number" : "0x01", - "parentHash" : "28ec23fed489293ad9db90e7745921dcd8cbf31f72ddb2cd3164e120d5c81797", + "parentHash" : "4460b49f668be62df7cfb79e680a532688a1ea2b84f31e7c5cfca612871efef8", "receiptTrie" : "67bf4b6c7db8be32886532357198d3a32f204c9001b0980747ab8fa9e937e1a2", "stateRoot" : "f0f9da9e88dbc17e483569ef49113473ac1d0fef5f63a3b2564b2c1ee8898ab0", - "timestamp" : "0x55b7f294", + "timestamp" : "0x55d5f3d7", "transactionsTrie" : "2e4a44bb8e3ee134ec210f7f92c1138ad2e3c29f19a821fd17f262254cd15840", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90265f901f9a028ec23fed489293ad9db90e7745921dcd8cbf31f72ddb2cd3164e120d5c81797a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0f0f9da9e88dbc17e483569ef49113473ac1d0fef5f63a3b2564b2c1ee8898ab0a02e4a44bb8e3ee134ec210f7f92c1138ad2e3c29f19a821fd17f262254cd15840a067bf4b6c7db8be32886532357198d3a32f204c9001b0980747ab8fa9e937e1a2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f29480a0dd069a437769855ba9337ae52b802a4ce92f7e54864ae597ec9800017535748288d5854365d85492e6f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d878501dcd65000801ba0ebb726ae53468a164a482cd9e3a5a23607185985c93b922e3be620b04b30e9bda0047360f7f081043ccb735c9fa5c20fc4ecba55ceca57bf96f4d7686371af0dc9c0", + "rlp" : "0xf90265f901f9a04460b49f668be62df7cfb79e680a532688a1ea2b84f31e7c5cfca612871efef8a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0f0f9da9e88dbc17e483569ef49113473ac1d0fef5f63a3b2564b2c1ee8898ab0a02e4a44bb8e3ee134ec210f7f92c1138ad2e3c29f19a821fd17f262254cd15840a067bf4b6c7db8be32886532357198d3a32f204c9001b0980747ab8fa9e937e1a2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de8252088455d5f3d780a0c3af16a9ee71f47e48ed294aab34d26141e9b3badbf537f42afba78e73e485fd882d1073468aa45fccf866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d878501dcd65000801ba0ebb726ae53468a164a482cd9e3a5a23607185985c93b922e3be620b04b30e9bda0047360f7f081043ccb735c9fa5c20fc4ecba55ceca57bf96f4d7686371af0dc9c0", "transactions" : [ { "data" : "0x", @@ -1182,9 +1802,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "28ec23fed489293ad9db90e7745921dcd8cbf31f72ddb2cd3164e120d5c81797", - "mixHash" : "6c5322280e970809d6bf1811b49359fccf694286ea3be7c8f676666d6771c730", - "nonce" : "95c7f750a8e77586", + "hash" : "4460b49f668be62df7cfb79e680a532688a1ea2b84f31e7c5cfca612871efef8", + "mixHash" : "29fc027153197af656eba7187179b7e5e45d6235fe1b26f2e692e084a5c9596d", + "nonce" : "f0b89f070195f820", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -1193,8 +1813,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a06c5322280e970809d6bf1811b49359fccf694286ea3be7c8f676666d6771c7308895c7f750a8e77586c0c0", - "lastblockhash" : "feb5732416765067a7c68878fc57ffbb12277f5ad51afb8cd8da7758bce9d1c4", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a029fc027153197af656eba7187179b7e5e45d6235fe1b26f2e692e084a5c9596d88f0b89f070195f820c0c0", + "lastblockhash" : "094eb118175f79f80fdbc3140d379e0c0b04bef7cd285ea61a1184a8201f5a1f", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x01dcd65000", diff --git a/tests/state_test.go b/tests/state_test.go index eb1900e1b8..7090b05410 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -27,14 +27,13 @@ import ( func init() { if os.Getenv("JITVM") == "true" { vm.ForceJit = true - } else { - vm.DisableJit = true + vm.EnableJit = true } } func BenchmarkStateCall1024(b *testing.B) { fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json") - if err := BenchVmTest(fn, bconf{"Call1024BalanceTooLow", true, false}, b); err != nil { + if err := BenchVmTest(fn, bconf{"Call1024BalanceTooLow", true, os.Getenv("JITVM") == "true"}, b); err != nil { b.Error(err) } } diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 695e508522..def9b0c36d 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -71,8 +71,8 @@ func BenchStateTest(p string, conf bconf, b *testing.B) error { return fmt.Errorf("test not found: %s", conf.name) } - pNoJit := vm.DisableJit - vm.DisableJit = conf.nojit + pJit := vm.EnableJit + vm.EnableJit = conf.jit pForceJit := vm.ForceJit vm.ForceJit = conf.precomp @@ -94,7 +94,7 @@ func BenchStateTest(p string, conf bconf, b *testing.B) error { benchStateTest(test, env, b) } - vm.DisableJit = pNoJit + vm.EnableJit = pJit vm.ForceJit = pForceJit return nil diff --git a/tests/vm_test.go b/tests/vm_test.go index afa1424d57..96718db3ce 100644 --- a/tests/vm_test.go +++ b/tests/vm_test.go @@ -17,20 +17,21 @@ package tests import ( + "os" "path/filepath" "testing" ) func BenchmarkVmAckermann32Tests(b *testing.B) { fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") - if err := BenchVmTest(fn, bconf{"ackermann32", true, false}, b); err != nil { + if err := BenchVmTest(fn, bconf{"ackermann32", true, os.Getenv("JITVM") == "true"}, b); err != nil { b.Error(err) } } func BenchmarkVmFibonacci16Tests(b *testing.B) { fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") - if err := BenchVmTest(fn, bconf{"fibonacci16", true, false}, b); err != nil { + if err := BenchVmTest(fn, bconf{"fibonacci16", true, os.Getenv("JITVM") == "true"}, b); err != nil { b.Error(err) } } diff --git a/tests/vm_test_util.go b/tests/vm_test_util.go index b29dcd20f6..71a4f5e335 100644 --- a/tests/vm_test_util.go +++ b/tests/vm_test_util.go @@ -52,7 +52,7 @@ func RunVmTestWithReader(r io.Reader, skipTests []string) error { type bconf struct { name string precomp bool - nojit bool + jit bool } func BenchVmTest(p string, conf bconf, b *testing.B) error { @@ -67,8 +67,8 @@ func BenchVmTest(p string, conf bconf, b *testing.B) error { return fmt.Errorf("test not found: %s", conf.name) } - pNoJit := vm.DisableJit - vm.DisableJit = conf.nojit + pJit := vm.EnableJit + vm.EnableJit = conf.jit pForceJit := vm.ForceJit vm.ForceJit = conf.precomp @@ -99,7 +99,7 @@ func BenchVmTest(p string, conf bconf, b *testing.B) error { benchVmTest(test, env, b) } - vm.DisableJit = pNoJit + vm.EnableJit = pJit vm.ForceJit = pForceJit return nil diff --git a/xeth/xeth.go b/xeth/xeth.go index 5110aa62c3..8bd45998f1 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -89,8 +89,7 @@ type XEth struct { messagesMu sync.RWMutex messages map[int]*whisperFilter - // regmut sync.Mutex - // register map[string][]*interface{} // TODO improve return type + transactMu sync.Mutex agent *miner.RemoteAgent @@ -823,18 +822,22 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st } from.SetBalance(common.MaxBig) - from.SetGasLimit(self.backend.ChainManager().GasLimit()) + from.SetGasLimit(common.MaxBig) + msg := callmsg{ from: from, - to: common.HexToAddress(toStr), gas: common.Big(gasStr), gasPrice: common.Big(gasPriceStr), value: common.Big(valueStr), data: common.FromHex(dataStr), } + if len(toStr) > 0 { + addr := common.HexToAddress(toStr) + msg.to = &addr + } if msg.gas.Cmp(big.NewInt(0)) == 0 { - msg.gas = DefaultGas() + msg.gas = big.NewInt(50000000) } if msg.gasPrice.Cmp(big.NewInt(0)) == 0 { @@ -885,6 +888,10 @@ func isAddress(addr string) bool { return addrReg.MatchString(addr) } +func (self *XEth) Frontend() Frontend { + return self.frontend +} + func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, error) { // this minimalistic recoding is enough (works for natspec.js) @@ -948,8 +955,9 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS } */ - // TODO: align default values to have the same type, e.g. not depend on - // common.Value conversions later on + self.transactMu.Lock() + defer self.transactMu.Unlock() + var nonce uint64 if len(nonceStr) != 0 { nonce = common.Big(nonceStr).Uint64() @@ -994,7 +1002,7 @@ func (self *XEth) sign(tx *types.Transaction, from common.Address, didUnlock boo // callmsg is the message type used for call transations. type callmsg struct { from *state.StateObject - to common.Address + to *common.Address gas, gasPrice *big.Int value *big.Int data []byte @@ -1003,7 +1011,7 @@ type callmsg struct { // accessor boilerplate to implement core.Message func (m callmsg) From() (common.Address, error) { return m.from.Address(), nil } func (m callmsg) Nonce() uint64 { return m.from.Nonce() } -func (m callmsg) To() *common.Address { return &m.to } +func (m callmsg) To() *common.Address { return m.to } func (m callmsg) GasPrice() *big.Int { return m.gasPrice } func (m callmsg) Gas() *big.Int { return m.gas } func (m callmsg) Value() *big.Int { return m.value }