good morning!!!!

Skip to content
Snippets Groups Projects
Commit 70c86566 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

Added a KeyPairFromSec function which creates a new keypair based on the given seckey

parent 17674fb8
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ package ethchain
import (
"github.com/ethereum/eth-go/ethutil"
"github.com/obscuren/secp256k1-go"
"math/big"
)
......@@ -14,6 +15,15 @@ type KeyPair struct {
state *State
}
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 NewKeyPairFromValue(val *ethutil.Value) *KeyPair {
keyPair := &KeyPair{PrivateKey: val.Get(0).Bytes(), PublicKey: val.Get(1).Bytes()}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment