Skip to Content
DocumentationWalletsLoad Wallet from Environment

Load Wallet from Environment

Loads a wallet (more specifically a KeyPairSigner) from an environment variable. The keypair should be in the same ‘array of numbers’ format as used by solana-keygen.

Returns: Promise<KeyPairSigner>

const wallet = await connection.loadWalletFromEnvironment(envVariableName);

Options

  • envVariableName: string - Name of environment variable containing the keypair (default: “PRIVATE_KEY”)

See also: Create Wallet, Load Wallet from File

Last updated on