Build on Cardano the easy way

Run the following to import Lucid:

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

Interoperability

Lucid can be run pretty much anywhere. From backend server, browser, to mobile. The library is written in Deno with TypeScript and can additionally be bundled into an NPM package or web bundle.

// Deno

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

const lucid = await Lucid.new();

Clean and intuitive transaction API

Don't bother anymore with balancing your transaction inputs/outputs, calculating fees and script costs. Lucid abstracts away all that complexity.

const tx = await lucid.newTx()
  .payToAddress("addr..", {lovelace: 40000000n})
  .complete();
const signedTx = await tx.sign().complete();
const txHash = await signedTx.submit();

Modular providers

Use one of the existing blockchain providers in Lucid or implement your own provider.

import { Lucid, Blockfrost } from "https://deno.land/x/lucid/mod.ts"

const lucid = await Lucid.new(
  new Blockfrost(
    "https://cardano-mainnet.blockfrost.io/api/v0",
    "<project_id>",
  ),
);

Diverse wallet selection

Select CIP-0030 compatible browser wallets, import a wallet from a private key or simply view a certain address.

const api = await window.cardano.nami.enable();
lucid.selectWallet(api);

Convenient and secure datum usability

Instead of having to deal with raw plutus data Lucid allows you to leverage the underlying data structures and primitives of JavaScript.

const ListingSchema = Data.Object({
  owner: Data.Bytes(),
  amount: Data.Integer(),
  private: Data.Boolean(),
});
type Listing = Data.Static<typeof ListingSchema>;
const Listing = ListingSchema as unknown as Listing;

const listing = Data.to(
  { owner: "31313131313131", amount: 5252352323n, private: false },
  Listing,
);

developed by

SpaceBudz