Skip to Content
DocumentationWalletsCreate Multiple Wallets

Create Multiple Wallets

Creates multiple Solana wallets (more specifically KeyPairSigner objects) at once.

Returns: Promise<Array<KeyPairSigner>>

const wallets = await connection.createWallets(numberOfWallets);

Parameters

  • numberOfWallets: number - The number of wallets to create

Examples

Create multiple wallets with default settings:

// Create 5 wallets with default settings const wallets = await connection.createWallets(5); console.log(`Created ${wallets.length} wallets`); // Access individual wallets const [alice, bob, charlie, dave, eve] = wallets; console.log("Alice's address:", alice.address); console.log("Bob's address:", bob.address);

Create wallets for testing:

// Create 3 wallets for testing const testWallets = await connection.createWallets(3); // Use them in your tests for (const wallet of testWallets) { console.log(`Wallet ${wallet.address} created`); // Each wallet will have 1 SOL airdropped by default const balance = await connection.getLamportBalance(wallet.address); console.log(`Balance: ${balance} lamports`); }

Create wallets for different purposes:

// Create wallets for different roles const [adminWallet, userWallet, treasuryWallet] = await connection.createWallets(3); console.log("Admin wallet:", adminWallet.address); console.log("User wallet:", userWallet.address); console.log("Treasury wallet:", treasuryWallet.address);

See also

Last updated on