Merge branch 'develop' of github.com-obscure:ethereum/go-ethereum into develop

This commit is contained in:
obscuren 2014-04-11 12:50:36 -04:00
commit 8280dd65e6
3 changed files with 31 additions and 25 deletions

@ -3,16 +3,17 @@ Ethereum
[![Build Status](https://travis-ci.org/ethereum/go-ethereum.png?branch=master)](https://travis-ci.org/ethereum/go-ethereum) [![Build Status](https://travis-ci.org/ethereum/go-ethereum.png?branch=master)](https://travis-ci.org/ethereum/go-ethereum)
Ethereum Go Client (c) Jeffrey Wilcke Ethereum Go Client © 2014 Jeffrey Wilcke.
The current state is "Proof of Concept 3.5". Current state: Proof of Concept 3.5.
For the development Go Package please see [eth-go package](https://github.com/ethereum/eth-go). For the development package please see the [eth-go package](https://github.com/ethereum/eth-go).
Build Build
======= =======
For build instruction please see the [Wiki](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum(Go)) For build instruction please see the [Wiki](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum(Go))
General command line options General command line options
==================== ====================
@ -42,26 +43,24 @@ See the "help" command for *developer* options.
Contribution Contribution
============ ============
If you'd like to contribute to Ethereum Go please fork, fix, commit and If you would like to contribute to Ethereum Go, please fork, fix, commit and
send a pull request. Commits who do not comply with the coding standards send a pull request to the main repository. Commits which do not comply with the coding standards explained below
are ignored. If you send pull requests make absolute sure that you will be ignored. If you send a pull request, make sure that you
commit on the `develop` branch and that you do not merge to master. commit to the `develop` branch and that you do not merge to `master`.
Commits that are directly based on master are simply ignored. Commits that are directly based off of the `master` branch instead of the `develop` branch will be ignored.
To make life easier try [git flow](http://nvie.com/posts/a-successful-git-branching-model/) it sets To make this process simpler try following the [git flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model, as it sets this process up and streamlines work flow.
this all up and streamlines your work flow.
Coding standards Coding standards
================ ================
Sources should be formatted according to the [Go Formatting Code should be formatted according to the [Go Formatting
Style](http://golang.org/doc/effective_go.html#formatting). Style](http://golang.org/doc/effective_go.html#formatting).
Unless structs fields are supposed to be directly accessible, provide Unless struct fields are supposed to be directly accessible, provide
Getters and hide the fields through Go's exporting facility. getters and hide the fields through Go's exporting facility.
When you comment put meaningfull comments. Describe in detail what you Make comments in your code meaningful and only use them when necessary. Describe in detail what your code is trying to achieve. For example, this would be redundant and unnecessary commenting:
want to achieve.
*wrong* *wrong*
@ -72,12 +71,7 @@ if x > y {
} }
``` ```
Everyone reading the source probably know what you wanted to achieve Everyone reading the source code should know what this code snippet was meant to achieve, and so those are **not** meaningful comments.
with above code. Those are **not** meaningful comments.
While the project isn't 100% tested I want you to write tests non the While this project is constantly tested and run, code tests should be written regardless. There is not time to evaluate every person's code specifically, so it is expected of you to write tests for the code so that it does not have to be tested manually. In fact, contributing by simply writing tests is perfectly fine!
less. I haven't got time to evaluate everyone's code in detail so I
expect you to write tests for me so I don't have to test your code
manually. (If you want to contribute by just writing tests that's fine
too!)

@ -11,6 +11,7 @@ import (
"os" "os"
"os/signal" "os/signal"
"runtime" "runtime"
"strings"
) )
const Debug = true const Debug = true
@ -78,7 +79,17 @@ func main() {
} }
if r == "y" { if r == "y" {
utils.ImportPrivateKey(ImportKey) mnemonic := strings.Split(ImportKey, " ")
if len(mnemonic) == 24 {
fmt.Println("Got mnemonic key, importing.")
key := ethutil.MnemonicDecode(mnemonic)
utils.ImportPrivateKey(key)
} else if len(mnemonic) == 1 {
fmt.Println("Got hex key, importing.")
utils.ImportPrivateKey(ImportKey)
} else {
fmt.Println("Did not recognise format, exiting.")
}
os.Exit(0) os.Exit(0)
} }
} else { } else {

@ -12,6 +12,7 @@ func CreateKeyPair(force bool) {
pub, prv := secp256k1.GenerateKeyPair() pub, prv := secp256k1.GenerateKeyPair()
pair := &ethutil.Key{PrivateKey: prv, PublicKey: pub} pair := &ethutil.Key{PrivateKey: prv, PublicKey: pub}
ethutil.Config.Db.Put([]byte("KeyRing"), pair.RlpEncode()) ethutil.Config.Db.Put([]byte("KeyRing"), pair.RlpEncode())
mne := ethutil.MnemonicEncode(ethutil.Hex(prv))
fmt.Printf(` fmt.Printf(`
Generating new address and keypair. Generating new address and keypair.
@ -22,8 +23,8 @@ addr: %x
prvk: %x prvk: %x
pubk: %x pubk: %x
++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++
save these words so you can restore your account later: %s
`, pair.Address(), prv, pub) `, pair.Address(), prv, pub, mne)
} }
} }