Complete example
Step by step
Let’s break down what’s happening:1
Import the prelude
thread_rng for random number generation.2
Generate a private key
3
Derive the view key
4
Derive the address
5
Display the results
aleo1 for all networks.Expected output
When you run this example, you’ll see output like:The private key is sensitive information. Never share it or commit it to version control.
Variations
Using different networks
You can use MainnetV0 or CanaryV0 instead of Testnet3:Restoring from an existing private key
If you already have a private key string:Next steps
Token transfer
Learn how to transfer credits between accounts
Working with accounts
Deep dive into account management