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 = new Lucid();

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()
  .payTo("addr..", {lovelace: 40000000n})
  .commit();
const signedTx = await tx.sign().commit();
const txHash = await signedTx.submit();

Modular providers

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

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

const lucid = new Lucid({
  provider: new Blockfrost(
    "https://cardano-preprod.blockfrost.io/api/v0",
    "<projectId>",
  ),
});

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.selectWalletFromApi(api);

Convenient and secure datum conversion

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

const Listing = Data.Object({
  owner: Data.Bytes(),
  amount: Data.Integer(),
  private: Data.Boolean(),
});
type Listing = typeof Listing;

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

developed by

SpaceBudz