Creating Keys
GoLang
Pre-requisites
Steps
NOTE: All examples will be written from the context of coding our Zero-to-Micropay demo app on a Mac
- Create a new file called
keys.go
- Open
keys.go
in the IDE/editor of your choice and enter:package main import ( "fmt" "github.com/hashgraph/hedera-sdk-go" ) func main() { secret := hedera.GenerateSecretKey() fmt.Printf("secret = %v\n", secret) public := secret.Public() fmt.Printf("public = %v\n", public) }
- From terminal run:
$> go run keys.go
NOTE: this app will print your secret and public keys to the terminal output. This is not recommended for keys you would use for anything other than testing. It is your responsibility to follow best practices to protect keys that will be used for purposes other than testing.
- You can now use the public key printed from
keys.go
to generate an account on Hedera.