github.com/SmartMeshFoundation/Spectrum@v0.0.0-20220621030607-452a266fee1e/cmd/gennodekey/main.go (about)

     1  package main
     2  
     3  import (
     4  	"encoding/hex"
     5  	"github.com/SmartMeshFoundation/Spectrum/crypto"
     6  	"fmt"
     7  )
     8  
     9  func main() {
    10  	prv, _ := crypto.GenerateKey()
    11  	buf := crypto.FromECDSA(prv)
    12  	s := hex.EncodeToString(buf)
    13  	fmt.Println("privatekey:", s)
    14  	fmt.Println("address:", crypto.PubkeyToAddress(prv.PublicKey).Hex())
    15  }