aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-16 06:51:55 +0800
committerobscuren <geffobscura@gmail.com>2014-06-16 06:51:55 +0800
commitdccef707280bd852ae536e69dea82ad0555ba0a9 (patch)
tree138872a04429e1abc1cf15245bbc111e0566cf70 /ethutil
parent1fbea2e438d56484ebfa509d7433cc418e17a79b (diff)
downloadgo-tangerine-dccef707280bd852ae536e69dea82ad0555ba0a9.tar
go-tangerine-dccef707280bd852ae536e69dea82ad0555ba0a9.tar.gz
go-tangerine-dccef707280bd852ae536e69dea82ad0555ba0a9.tar.bz2
go-tangerine-dccef707280bd852ae536e69dea82ad0555ba0a9.tar.lz
go-tangerine-dccef707280bd852ae536e69dea82ad0555ba0a9.tar.xz
go-tangerine-dccef707280bd852ae536e69dea82ad0555ba0a9.tar.zst
go-tangerine-dccef707280bd852ae536e69dea82ad0555ba0a9.zip
Method for creating a new key from scratch
Diffstat (limited to 'ethutil')
-rw-r--r--ethutil/keypair.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/ethutil/keypair.go b/ethutil/keypair.go
index cf5882e2c..29fb1bac5 100644
--- a/ethutil/keypair.go
+++ b/ethutil/keypair.go
@@ -12,6 +12,12 @@ type KeyPair struct {
account *StateObject
}
+func GenerateNewKeyPair() (*KeyPair, error) {
+ _, prv := secp256k1.GenerateKeyPair()
+
+ return NewKeyPairFromSec(prv)
+}
+
func NewKeyPairFromSec(seckey []byte) (*KeyPair, error) {
pubkey, err := secp256k1.GeneratePubKey(seckey)
if err != nil {