aboutsummaryrefslogtreecommitdiffstats
path: root/test/keygen.go
blob: b2c7897238bbd435623adca27fafdc6712bd2d08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main

import (
    "encoding/hex"
    "fmt"

    "github.com/dexon-foundation/dexon/crypto"
)

func main() {
    for i := 0; i < 4; i++ {
        privKey, err := crypto.GenerateKey()
        if err != nil {
            panic(err)
        }
        address := crypto.PubkeyToAddress(privKey.PublicKey).String()
        pk := hex.EncodeToString(crypto.CompressPubkey(&privKey.PublicKey))

        fmt.Printf(`
    "%s": {
      "balance": "1000000000000000000000",
      "staked": "500000000000000000000",
      "publicKey": "0x%s"
    },`, address, pk)

        crypto.SaveECDSA(fmt.Sprintf("test%d.nodekey", i), privKey)
    }
}