github.com/hashgraph/hedera-sdk-go/v2@v2.48.0/examples/generate_key/main.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashgraph/hedera-sdk-go/v2"
     7  )
     8  
     9  func main() {
    10  	// Generating key
    11  	privateKey, err := hedera.GeneratePrivateKey()
    12  	if err != nil {
    13  		panic(fmt.Sprintf("%v : error generating PrivateKey", err))
    14  	}
    15  
    16  	// Retrieve the public key
    17  	publicKey := privateKey.PublicKey()
    18  
    19  	fmt.Printf("private = %v\n", privateKey)
    20  	fmt.Printf("public = %v\n", publicKey)
    21  }