Ed25519 Accounts
The Aptos .NET SDK provides a simple way to create and manage Ed25519 accounts. In this guide we will provide snippets of creating or importing existing accounts.
Creating Ed25519Accounts
Section titled “Creating Ed25519Accounts”Ed25519Accounts are created to sign transactions and interact with the blockchain.
Using a Private Key
Section titled “Using a Private Key”To generate an account from a private key, you will need to create the Ed25519PrivateKey
object and pass into the
Ed25519Account
constructor. The private key can be given a string
or byte[]
representation.
var privateKey = new Ed25519PrivateKey("0x1234...abcdef");var account = new Ed25519Account(privateKey);
Using a Mneomonic Phrase
Section titled “Using a Mneomonic Phrase”To generate an account from a phrase, you can use Ed25519Account.FromDerivationPath
and pass in the phrase and the derivation path.
The derivation path that is typically used throughout the Aptos ecosystem is m/44'/637'/0'/0'/0'
.
var account = Ed25519Account.FromDerivationPath( "m/44'/637'/0'/0'/0'", "apple banana cat dog elephant fox ...");
Generating a Random Account
Section titled “Generating a Random Account”To create a random account, you can use the Account.Generate()
method.
var account = Account.Generate();
Additional Resources
Section titled “Additional Resources” Ed25519Account Reference The full API reference for the Ed25519Account class.