The first step on your journey to minting tokens on Spark is to announce your token identifier and metadata on L1. This is a one time operation that locks in LRC-20 token settings and restrictions. All token data is embedded in an OP_RETURN output.

Step 1: Get Your L1 Wallet Address

In the earlier step you initialized your wallet. Now get your wallets L1 funding address.

const l1Address = wallet.getL1FundingAddress();
console.log(l1Address); // example: bcrt1....

Step 2: Get Your L1 Wallet Address

Next you need to fund this address with a UTXO to fulfill the network fees needed for your announcement transaction. If testing on Lightspark regtest you can use our faucet.

Step 3: Broadcast the L1 Announcement Transaction

Now you are ready to announce your token on L1.

await wallet.announceTokenL1(
  tokenName,
  tokenTicker,
  decimals,
  maxSupply,
  isFreezable
);

Parameters

The announce call takes in the following metadata:

ParameterTypeDescription
tokenNamestringHuman-readable token name (e.g., “USD Coin”)
tokenTickerstringTrading symbol (e.g., “USDC”)
decimalsnumberNumber of decimal places (e.g., 6 for USDC, 8 for BTC)
maxSupplybigintMaximum token supply in base units. Set to 0n for unlimited supply
isFreezeablebooleanWhether the token can be frozen

Returns

Promise<string>; // Bitcoin transaction ID of the announcement

Example Token Definitions

Creating an Unlimited Supply Token

const txId = await wallet.announceTokenL1({
  tokenName: "USD Coin",
  tokenTicker: "USDC",
  maxSupply: 0n, // Unlimited supply
  decimals: 6, // 1 USDC = 1_000_000 base units
  isFreezeable: true,
});

console.log("Announcement TX:", txId);

Creating a Fixed Supply Token

// Create a token with max supply of 1 million
const txId = await wallet.announceTokenL1({
  tokenName: "My Fixed Token",
  tokenTicker: "MFT",
  maxSupply: 1_000_000_000_000n, // 1,000,000.000000 tokens
  decimals: 6,
  feeRate: 2,
  isFreezeable: false,
});

console.log("Announcement TX:", txId);

Notes

  • Issuer wallets are 1:1 with tokens. A single Issuer Wallet can not manage multiple tokens.
  • The announcement transaction requires Bitcoin network fees
  • Transaction confirmation typically takes 1-2 blocks (~10-20 minutes)
  • Token metadata is immutable after announcement
  • Save the announcement transaction ID so you can refer to it later
  • If isFreezeable is true, the token can be frozen later using freezeToken

Next Steps

Once your token is created, you can mint some tokens.