Create a wallet

How to create a wallet and select it.

There are multiple options to create and import a wallet in Lucid. In this section we are using the private key method.

In case you do not have private key yet, you can generate one with Lucid:

import { Addresses } from "https://deno.land/x/lucid/mod.ts";

const privateKey = Addresses.generatePrivateKey(); // Extended bech32 encoded private key
console.log(privateKey);

Now we select a private key wallet with our Lucid instance:

lucid.selectWalletFromPrivateKey(privateKey);
Note: In almost all cases you want to select a wallet. It's necessary to build and submit transactions.