From ee05592cc3da656a03ac9ba7fb5773fb4daa07fd Mon Sep 17 00:00:00 2001 From: revett Date: Mon, 18 Sep 2017 20:30:10 +0100 Subject: [PATCH 1/5] Do not commit binary --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 485237e..46ef516 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ # Added by Authors vendor/ -go-tcw.* \ No newline at end of file +go-tcw.* +neo-go-sdk \ No newline at end of file From 4f207cbcb7693c0cee85dc4c054ec5197d0c0a5b Mon Sep 17 00:00:00 2001 From: revett Date: Mon, 18 Sep 2017 20:30:28 +0100 Subject: [PATCH 2/5] Simple main.go --- main.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 main.go diff --git a/main.go b/main.go new file mode 100644 index 0000000..324994b --- /dev/null +++ b/main.go @@ -0,0 +1,54 @@ +package main + +import ( + "fmt" + "os" + + "github.com/CityOfZion/neo-go-sdk/neo" +) + +func main() { + if len(os.Args) != 3 || os.Args[1] != "--wif" { + outputUsage() + } + + wif := os.Args[2] + + if len(wif) != 52 { + outputError("WIF entered is not 52 characters long.") + } + + privateKey, err := neo.NewPrivateKeyFromWIF(wif) + if err != nil { + outputError("Unable to convert WIF to private key.") + } + + publicAddress, err := privateKey.PublicAddress() + if err != nil { + outputError("Error when deriving public address from private key.") + } + + fmt.Println("Details:") + fmt.Printf(" - Private key: \t\t%s\n", privateKey.Output()) + fmt.Printf(" - Private key (base64): \t%s\n", privateKey.OutputBase64()) + fmt.Printf(" - Public address (compressed): %s\n", publicAddress) + fmt.Printf(" - WIF (compressed): \t\t%s\n", wif) +} + +func outputError(message string) { + fmt.Printf("[ERROR] %s\n", message) + fmt.Println("Try: neo-go-sdk --help") + os.Exit(1) +} + +func outputUsage() { + fmt.Println("Tool to help debug a NEO public and private key pair.") + fmt.Println("") + fmt.Println("Usage:") + fmt.Println("\tneo-go-sdk --wif ") + fmt.Println("") + fmt.Println("Options:") + fmt.Println("\t--wif\tWIF (wallet import format) for NEO private key.") + fmt.Println("\t--help\tPrint usage.") + os.Exit(1) +} From 9f67b39fc2076ed1a9abdd68776f00bda0ba77cd Mon Sep 17 00:00:00 2001 From: revett Date: Mon, 18 Sep 2017 20:30:42 +0100 Subject: [PATCH 3/5] Make command to build CLI --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 9e17636..2b49e2f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ BRANCH = "master" VERSION = $(shell cat ./VERSION) +build-cli: + @go build . + check-version: @echo "=> Checking if VERSION exists as Git tag..." (! git rev-list ${VERSION}) From 836510f40d3be27657594ad6669c22b66191ff94 Mon Sep 17 00:00:00 2001 From: revett Date: Mon, 18 Sep 2017 20:30:58 +0100 Subject: [PATCH 4/5] 1.3.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 26aaba0..f0bb29e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.0 +1.3.0 From b9c21c3d6cc2a429c3375fe5442d12e7fb9f21cb Mon Sep 17 00:00:00 2001 From: revett Date: Mon, 18 Sep 2017 20:33:48 +0100 Subject: [PATCH 5/5] README update --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a18a917..0d9464d 100644 --- a/README.md +++ b/README.md @@ -83,4 +83,5 @@ See [GoDoc](https://godoc.org/github.com/CityOfZion/neo-go-sdk/neo) for full doc ## License - Open-source [MIT](https://github.com/CityOfZion/neo-go-sdk/blob/master/LICENSE). -- Main author is [@revett](https://github.com/revett). \ No newline at end of file +- Main author is [@revett](https://github.com/revett). +- This project adheres to the [Contributor Covenant Code of Conduct](https://github.com/goreleaser/goreleaser/blob/master/CODE_OF_CONDUCT.md). \ No newline at end of file