Create a wallet

You are provided multiple options to create and import a wallet

Generate a new private key:

const privateKey = generatePrivateKey(); // Bech32 encoded private key
console.log(privateKey);

Choosing Wallet

Use different methods to select a wallet and query balances, UTxOs

Select a wallet using a private key:

lucid.selectWallet.fromPrivateKey(privateKey);
💡

Selecting a wallet is necessary for building and submitting transactions. Make sure to select a wallet using one of these methods before attempting to create or submit transactions. The method you use will depend on your use case and the type of wallet integration you're working with.


Query wallet

const address = await lucid.wallet().address(); // Bech32 address