Account

Interface representing a single account within a Stacks wallet. Contains the private keys and metadata needed for STX transactions, Gaia storage, and app-specific key derivation.


Usage

import { generateWallet, getStxAddress, Account } from '@stacks/wallet-sdk';

const wallet = await generateWallet({
  secretKey: 'your 24-word seed phrase ...',
  password: 'password',
});

const account: Account = wallet.accounts[0];

console.log(account.index);          // 0
console.log(account.stxPrivateKey);  // hex string — used for STX transactions
console.log(account.dataPrivateKey); // hex string — used for Gaia/profiles
console.log(account.appsKey);       // xprv... — root for app-specific keys
console.log(account.salt);           // hex string — wallet-level salt

Reference Linkarrow-up-right


Definition


Properties

Property
Type
Description

stxPrivateKey

string

Hex-encoded private key for signing STX transactions.

dataPrivateKey

string

Hex-encoded private key for Gaia storage and profile operations.

salt

string

Wallet-level salt used when deriving app-specific keys.

username

string | undefined

BNS username registered for this account, if any.

profile

Profile | undefined

Public profile associated with this account's username.

appsKey

string

Extended private key (xprv...) used as the root for deriving app-specific keys.

index

number

The index of this account in the wallet (0-based).

Last updated

Was this helpful?