Launch a token yourself
This page launches one coin from your own wallet, for yourself. You are the launcher, you pay the gas, and the creator's fees are yours.
Every launch names a launchpad. You have two choices:
- A launchpad of your own. Registering one is a single transaction and a one-time bond, 0.01 ETH on Base. With no payees it takes no cut of your coin's fees. This is the path the example below takes.
- An open launchpad someone else runs. You need only its id. Its payees take their share of your coin's fees. See Launch on someone else's launchpad.
Launchpad 0 is Bankr's own. It takes only launches Bankr signs, so always pass the id of the launchpad you launch on.
A complete example
This script registers a launchpad the first time it runs, then launches a coin on it. Set LAUNCHPAD_ID to launch more coins on the same launchpad without paying the bond again.
It needs a wallet with about 0.03 ETH on Base, its key as LAUNCHER_KEY, and a Base RPC URL as BASE_RPC_URL. Install with bun add @bankr/launch-sdk viem.
// launch-token.ts: launches one coin from your own wallet. Run it: `bun launch-token.ts`.
import {
createPublicClient,
createWalletClient,
formatEther,
http,
parseEther,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
import {
createLaunchClient,
percentToBps,
percentToPips,
pipsToPercent,
type LaunchInput,
} from "@bankr/launch-sdk";
const transport = http(process.env.BASE_RPC_URL);
const publicClient = createPublicClient({ chain: base, transport });
const me = privateKeyToAccount(process.env.LAUNCHER_KEY as `0x${string}`);
const walletClient = createWalletClient({
account: me,
chain: base,
transport,
});
const client = createLaunchClient({
chain: "base",
publicClient,
walletClient,
});
const { launchpads } = client.contracts();
// 1. A launchpad of your own, registered once. It has no payees, so it takes no cut of your coin's fees.
let launchpadId = process.env.LAUNCHPAD_ID
? BigInt(process.env.LAUNCHPAD_ID)
: null;
if (launchpadId === null) {
// A launchpad launches where the chain reports paused: false and gated: false. Registration goes through either way.
const { paused, gated } = await client.status();
if (paused || gated)
throw new Error("A launchpad cannot launch on this chain.");
const registration = await launchpads.register({
operator: me.address,
payees: [],
});
const hash = await walletClient.sendTransaction({
to: registration.to,
data: registration.data,
value: registration.value, // the bond
});
const receipt = await publicClient.waitForTransactionReceipt({ hash });
launchpadId = launchpads.launchpadIdFromReceipt(receipt);
console.log(
`registered launchpad ${launchpadId} for ${formatEther(registration.value)} ETH`,
);
console.log(`set LAUNCHPAD_ID=${launchpadId} to launch on it again`);
}
// 2. The coin. Everything you leave out takes the launchpad's default.
const input = {
name: "My Coin",
symbol: "MINE",
metadataUri: "ipfs://your-metadata-cid", // a link to your token's metadata JSON
launcher: me.address,
launchpadId,
// A 1% trading fee. Snipe protection: the fee opens at 40% and falls to 1% over the first 30 seconds.
schedule: {
startPips: percentToPips("40"),
steadyPips: percentToPips("1"),
decaySecs: 30,
},
// 10% of the supply vests to you, on the launchpad's schedule.
vesting: { bps: percentToBps("10") },
// You buy 0.01 ETH of the coin inside the launch transaction.
devBuy: { amount: parseEther("0.01") },
} satisfies LaunchInput<"base">;
// 3. Check what it will do. A plan sends nothing.
const split = (await client.plan(input)).volumeSplit;
console.log(`fee: ${pipsToPercent(split.feePips)}% of each trade`);
console.log(` ${pipsToPercent(split.creatorPips)}% to you`);
console.log(` ${pipsToPercent(split.autoLpPips)}% into locked liquidity`);
// 4. Launch. One transaction from your wallet.
const result = await client.launch(input);
console.log(`launched ${result.token} in ${result.txHash}`);
console.log(`first buy: ${formatEther(result.devBuyOut)} tokens`);
The first run prints:
registered launchpad 7 for 0.01 ETH
set LAUNCHPAD_ID=7 to launch on it again
fee: 1% of each trade
0.52497% to you
0.27% into locked liquidity
launched 0x… in 0x…
first buy: … tokens
Your launchpad's id will differ.
What you get
| You get | Detail |
|---|---|
| An ERC-20 token | A fixed supply, 100 billion by default, 18 decimals. No owner and no mint. |
| A Uniswap v4 pool | Paired with WETH by default. Its liquidity is locked for good. |
| The creator's fees | Your share of every trade's fee, paid in WETH. 0.52497% of each trade in the example. |
| Vested supply | The share you named, 10% here. A new launchpad locks it for 30 days and unlocks all of it by day 365. |
| Your first buy | The tokens are in your wallet when the launch lands. |
| Rewards for your holders | Part of every fee goes to the wallets that hold your coin. Nobody has to stake. |
Where the rest of the 1% goes: Bankr's cut is 0.1% of the trade, and half of it goes to your coin's holders. Your holders take another 0.105% from the creator side. 0.27% is added to the pool's locked liquidity. Fees explains each share.
Claim what you earn
The samples below continue launch-token.ts. They use client, me, walletClient and result from it.
Fees collect in the contracts until you claim them:
const token = result.token;
const fees = await client.fees.get(token, me.address);
console.log(`claimable: ${formatEther(fees.claimableQuote)} WETH`);
for (const tx of await client.fees.buildClaim(token, me.address))
await walletClient.sendTransaction({ to: tx.to, data: tx.data, gas: tx.gas });
Vested supply unlocks over time. Release what has unlocked:
const vesting = await client.vesting.get(token);
for (const s of vesting.schedules)
console.log(
`${s.beneficiary} can release ${formatEther(s.releasable)} tokens`,
);
// Nothing unlocks before the cliff, and a release with nothing unlocked reverts.
const unlocked = vesting.schedules.some(
(s) => s.beneficiary === me.address && s.releasable > 0n,
);
if (unlocked) {
const release = await client.vesting.buildRelease(token, me.address);
await walletClient.sendTransaction({ to: release.to, data: release.data });
}
Change what the coin does
Each option on the launch names one term. A few common ones:
| You want | Add to the launch |
|---|---|
| A different trading fee | schedule: { startPips, steadyPips, decaySecs } |
| No snipe protection | A schedule whose startPips equals its steadyPips, with decaySecs: 0 |
| To pair with USDC | quote: "USDC" |
| To split the creator's fees | feeRecipients: [{ recipient, shareBps }, …] |
| More of your fees to holders | holderShareBps: percentToBps("25") |
| A sniper tax or another trading rule | extension: { preset: "sniper_tax", … }. See Extensions. |
| Trading to open later | startTime: new Date("2027-01-01T15:00:00Z") |
| To update the image or description later | metadataAdmin: me.address |
A new launchpad fixes some terms at one value: the wallet cap at 2% of supply for 24 hours, and the vesting schedule at a 30-day cliff and 365 days. The launchpad is yours, so you can widen them with one launchpads.configure call. Configuration lists every option, its range and its default.
A value outside the launchpad's range is refused before anything is signed. The error's detail names the setting and the range.
Launch on someone else's launchpad
An open launchpad, one with no signer, takes launches from any wallet. You register nothing and pay no bond. In exchange, its operator's rules apply to your coin, and its payees take their share of every fee.
Read the launchpad before you launch on it. This sample uses client from the example above:
const { settings } = client.contracts();
const pad = await settings.pad(42n); // the launchpad's id
console.log(`open to anyone: ${pad.signer === null}, paused: ${pad.paused}`);
for (const payee of pad.payees)
console.log(
`${payee.address} takes ${Number(payee.steadyShareWad / 10n ** 14n) / 100}% of each fee after Bankr's cut`,
);
const fee = pad.atLaunch.knobs.steadyPips;
console.log(
`trading fee ${pipsToPercent(fee.min)}% to ${pipsToPercent(fee.max)}%`,
);
Then launch with that id as launchpadId. client.plan(input).volumeSplit shows the exact split before you sign, as in step 3 of the example.
A launchpad with a signer takes only the launches its operator's server approves. Launching there happens inside that operator's app.
Send it from a Safe or a smart account
client.launch sends from a wallet client. For any other sender, plan the launch, build the unsigned transaction and send it yourself:
const plan = await client.plan({ ...input, deadlineSeconds: 3_600 });
const unsigned = client.buildLaunchTx(plan); // { to, data, value, gas }
console.log(unsigned.to, plan.predictedToken);
launcher must be the account that sends it. After it lands, client.parseLaunchReceipt(receipt) reads the launch.