Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
9bd67de6
Commit
9bd67de6
authored
Jun 29, 2014
by
zelig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove keys file, now subsumed under ethcrypto/key_manager
parent
27e1352c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
108 deletions
+0
-108
keys.go
utils/keys.go
+0
-108
No files found.
utils/keys.go
deleted
100644 → 0
View file @
27e1352c
package
utils
import
(
"fmt"
"github.com/ethereum/eth-go/ethutil"
"github.com/obscuren/secp256k1-go"
)
func
CreateKeyPair
(
force
bool
)
{
if
force
{
ethutil
.
GetKeyRing
()
.
Reset
()
fmt
.
Println
(
"resetting"
)
}
if
ethutil
.
GetKeyRing
()
.
Get
(
0
)
==
nil
{
_
,
prv
:=
secp256k1
.
GenerateKeyPair
()
keyPair
,
err
:=
ethutil
.
GetKeyRing
()
.
NewKeyPair
(
prv
)
if
err
!=
nil
{
panic
(
err
)
}
mne
:=
ethutil
.
MnemonicEncode
(
ethutil
.
Hex
(
keyPair
.
PrivateKey
))
fmt
.
Printf
(
`
Generating new address and keypair.
Please keep your keys somewhere save.
++++++++++++++++ KeyRing +++++++++++++++++++
addr: %x
prvk: %x
pubk: %x
++++++++++++++++++++++++++++++++++++++++++++
save these words so you can restore your account later: %s
`
,
keyPair
.
Address
(),
keyPair
.
PrivateKey
,
keyPair
.
PublicKey
,
mne
)
}
}
func
ImportPrivateKey
(
sec
string
)
{
ethutil
.
GetKeyRing
()
.
Reset
()
keyPair
,
err
:=
ethutil
.
GetKeyRing
()
.
NewKeyPair
(
ethutil
.
FromHex
(
sec
))
if
err
!=
nil
{
panic
(
err
)
}
mne
:=
ethutil
.
MnemonicEncode
(
ethutil
.
Hex
(
keyPair
.
PrivateKey
))
fmt
.
Printf
(
`
Generating new address and keypair.
Please keep your keys somewhere save.
++++++++++++++++ KeyRing +++++++++++++++++++
addr: %x
prvk: %x
pubk: %x
++++++++++++++++++++++++++++++++++++++++++++
save these words so you can restore your account later: %s
`
,
keyPair
.
Address
(),
keyPair
.
PrivateKey
,
keyPair
.
PublicKey
,
mne
)
}
/*
func CreateKeyPair(force bool) {
data, _ := ethutil.Config.Db.Get([]byte("KeyRing"))
if len(data) == 0 || force {
pub, prv := secp256k1.GenerateKeyPair()
pair := ðutil.Key{PrivateKey: prv, PublicKey: pub}
ethutil.Config.Db.Put([]byte("KeyRing"), pair.RlpEncode())
mne := ethutil.MnemonicEncode(ethutil.Hex(prv))
fmt.Printf(`
Generating new address and keypair.
Please keep your keys somewhere save.
++++++++++++++++ KeyRing +++++++++++++++++++
addr: %x
prvk: %x
pubk: %x
++++++++++++++++++++++++++++++++++++++++++++
save these words so you can restore your account later: %s
`, pair.Address(), prv, pub, mne)
}
}
*/
/*
func ImportPrivateKey(prvKey string) {
key := ethutil.FromHex(prvKey)
msg := []byte("tmp")
// Couldn't think of a better way to get the pub key
sig, _ := secp256k1.Sign(msg, key)
pub, _ := secp256k1.RecoverPubkey(msg, sig)
pair := ðutil.Key{PrivateKey: key, PublicKey: pub}
ethutil.Config.Db.Put([]byte("KeyRing"), pair.RlpEncode())
fmt.Printf(`
Importing private key
++++++++++++++++ KeyRing +++++++++++++++++++
addr: %x
prvk: %x
pubk: %x
++++++++++++++++++++++++++++++++++++++++++++
`, pair.Address(), key, pub)
}
*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment