diff --git a/seed2key/README.md b/seed2key/README.md new file mode 100644 index 0000000..3e4d67d --- /dev/null +++ b/seed2key/README.md @@ -0,0 +1,12 @@ +# Description + +This is a tiny utility for converting a Status seed phrase into a private key. + +I created it so I could use my normal Status account with the [status-console-client](https://github.com/status-im/status-console-client). + +# Usage + +```bash + $ echo "this is my secret seed phrase" | go run main.go +0x334d5305f760c5767e25fd23480a46790ba9c6cc3519196a96675259515128fa +``` diff --git a/seed2key/main.go b/seed2key/main.go new file mode 100644 index 0000000..3376745 --- /dev/null +++ b/seed2key/main.go @@ -0,0 +1,29 @@ +package main + +import ( + "bufio" + "fmt" + "os" + + "github.com/ethereum/go-ethereum/crypto" + "github.com/status-im/status-go/extkeys" +) + +func main() { + // read the seed phrase from stdin + reader := bufio.NewReader(os.Stdin) + seedPhrase, err := reader.ReadString('\n') + if err != nil { + fmt.Printf("failed to read seed phrase from stdin\n") + os.Exit(1) + } + // convert the seed phrase to a private key + mnemonic := extkeys.NewMnemonic() + masterKey, err := extkeys.NewMaster(mnemonic.MnemonicSeed(seedPhrase, "")) + if err != nil { + fmt.Printf("can not create master extended key: %v\n", err) + os.Exit(1) + } + // print the private key + fmt.Printf("%#x\n", crypto.FromECDSA(masterKey.ToECDSA())) +}