File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed
tools/addrgen/internal/cmd Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import (
12
12
13
13
"github.com/spf13/cobra"
14
14
15
- "github.com/iotexproject/iotex-core/iotxaddress "
15
+ "github.com/iotexproject/iotex-core/crypto "
16
16
"github.com/iotexproject/iotex-core/logger"
17
17
)
18
18
@@ -22,17 +22,17 @@ var createConfigCmd = &cobra.Command{
22
22
Short : "Creates a yaml config using generated pub/pri key pair." ,
23
23
Long : `Creates a yaml config using generated pub/pri key pair.` ,
24
24
Run : func (cmd * cobra.Command , args []string ) {
25
- addr , err := iotxaddress . NewAddress ( iotxaddress . IsTestnet , iotxaddress . ChainID )
25
+ public , private , err := crypto . EC283 . NewKeyPair ( )
26
26
if err != nil {
27
- logger .Fatal ().Err (err ).Msg ("failed to create address " )
27
+ logger .Fatal ().Err (err ).Msg ("failed to create key pair " )
28
28
}
29
29
cfgStr := fmt .Sprintf (
30
30
`chain:
31
31
producerPrivKey: "%x"
32
32
producerPubKey: "%x"
33
33
` ,
34
- addr . PrivateKey ,
35
- addr . PublicKey ,
34
+ private ,
35
+ public ,
36
36
)
37
37
if err := ioutil .WriteFile (_outputFile , []byte (cfgStr ), 0666 ); err != nil {
38
38
logger .Fatal ().Err (err ).Msgf ("failed to write file" )
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import (
12
12
13
13
"github.com/spf13/cobra"
14
14
15
- "github.com/iotexproject/iotex-core/iotxaddress "
15
+ "github.com/iotexproject/iotex-core/crypto "
16
16
"github.com/iotexproject/iotex-core/logger"
17
17
)
18
18
@@ -31,15 +31,14 @@ var _addrNum int
31
31
func generate (args []string ) string {
32
32
items := make ([]string , _addrNum )
33
33
for i := 0 ; i < _addrNum ; i ++ {
34
- addr , err := iotxaddress . NewAddress ( iotxaddress . IsTestnet , iotxaddress . ChainID )
34
+ public , private , err := crypto . EC283 . NewKeyPair ( )
35
35
if err != nil {
36
- logger .Fatal ().Err (err ).Msg ("failed to create address " )
36
+ logger .Fatal ().Err (err ).Msg ("failed to create key pair " )
37
37
}
38
38
items [i ] = fmt .Sprintf (
39
- "{\" PublicKey\" : \" %x\" , \" PrivateKey\" : \" %x\" , \" RawAddress\" : \" %s\" }" ,
40
- addr .PublicKey ,
41
- addr .PrivateKey ,
42
- addr .RawAddress ,
39
+ "{\" PublicKey\" : \" %x\" , \" PrivateKey\" : \" %x\" }" ,
40
+ private ,
41
+ public ,
43
42
)
44
43
}
45
44
return "[" + strings .Join (items , "," ) + "]"
You can’t perform that action at this time.
0 commit comments