Documentation
Core Concepts
Wallet Creation
From Address

Make Wallet From Address

You can instantiate a wallet from a specified Bech32 (opens in a new tab) Address to get a CIP-30 (opens in a new tab) wallet object by calling the makeWalletFromAddress function.

Specify Provider

It can be Blockfrost (opens in a new tab), Koios (opens in a new tab), Maestro (opens in a new tab), etc. Even your custom provider, as long as it implements the Provider interface.

For example, with Blockfrost provider:

import { Blockfrost, Provider } from "@lucid-evolution/lucid";
 
/**
 * The endpoint based on the Cardano network,
 * please refer to Blockfrost documentations.
 */
const blockfrostURL: string = process.env.BF_URL!;
 
/**
 * Your secret Blockfrost Project ID
 */
const blockfrostPID: string = process.env.BF_PID!;
 
const blockfrost: Provider = new Blockfrost(
  blockfrostURL,
  blockfrostPID,
);

Other providers follow a similar pattern.

Create CIP-30 Wallet

import { makeWalletFromAddress } from "@lucid-evolution/lucid";
 
const provider = blockfrost;
const network: Network = "Mainnet"; // "Mainnet" | "Preview" | "Preprod" | "Custom"
 
const address = "addr1_... your address here"; // Bech32
const utxos = await provider.getUtxos(address); // UTxO[]
 
const wallet = makeWalletFromAddress(provider, network, address, utxos); // CIP-30