Getting started: your own launchpad
In this guide you register a launchpad on Base and launch your first coin on it.
A launchpad is an entry in Bankr's contracts that you operate. It sets the rules for every coin launched on it, and it pays you a share of every trade. You write no contracts.
You build one file, launchpad.ts, and run it one step per command:
- Install the SDK.
- Make a wallet and fund it.
- Create a client.
- Register your launchpad.
- Choose its configuration.
- Launch your first coin.
- Read it back.
- Claim your fees.
Plan for about 15 minutes.
What it costs
This guide spends real ETH on Base.
| Cost | Amount |
|---|---|
| Registration bond | 0.01 ETH on Base. Paid once when you register. It is not refunded. |
| First buy | 0.001 ETH. Your wallet buys your own coin inside the launch transaction. |
| Gas | Four transactions. A launch uses about 7.5 million gas. |
| What to fund | Send 0.03 ETH to the operator wallet. That covers everything in the guide. |
The script prints the exact bond before it pays it.
1. Install
You need Bun. It runs TypeScript and loads .env by itself.
mkdir my-launchpad && cd my-launchpad
bun init -y
bun add @bankr/launch-sdk viem
The SDK is ESM only. Its one peer dependency is viem 2.57.8 or later. It also installs with npm, pnpm and yarn, and runs on Node 22 or later.
2. Make a wallet
Create a fresh wallet. It becomes your launchpad's operator: the account that registers the launchpad and changes its settings.
bun -e 'import { generatePrivateKey, privateKeyToAccount } from "viem/accounts"; const key = generatePrivateKey(); console.log(key, privateKeyToAccount(key).address)'
This prints a private key and its address. Send 0.03 ETH on Base to the address.
Put the key in .env. Never commit this file.
BASE_RPC_URL=https://…
OPERATOR_KEY=0x…
BASE_RPC_URL is your Base RPC endpoint. Any Base RPC endpoint works. A public one is rate-limited, so use a provider's.
Use a fresh wallet. Never use a wallet that holds other funds.
3. Create a client
Create launchpad.ts. This first part builds the client and one helper that sends a transaction and waits for it.
// launchpad.ts: one step per command, `bun launchpad.ts <step> [token]`.
import {
createPublicClient,
createWalletClient,
formatEther,
getAddress,
http,
parseEther,
type Address,
type Hex,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
import {
bpsToPercent,
createLaunchClient,
isLaunchSdkError,
percentToBps,
percentToPips,
pipsToPercent,
type LaunchInput,
type UnsignedTx,
} from "@bankr/launch-sdk";
const need = (name: string): string => {
const value = process.env[name];
if (!value) throw new Error(`Set ${name} in .env`);
return value;
};
const transport = http(need("BASE_RPC_URL"));
const publicClient = createPublicClient({ chain: base, transport });
const operator = privateKeyToAccount(need("OPERATOR_KEY") as Hex);
const walletClient = createWalletClient({
account: operator,
chain: base,
transport,
});
const client = createLaunchClient({
chain: "base",
publicClient,
walletClient,
});
// settings reads the contracts. launchpads builds your launchpad's transactions.
const { settings, launchpads } = client.contracts();
/** Sends one unsigned transaction from the operator wallet and waits for it. */
async function send(tx: UnsignedTx) {
const hash = await walletClient.sendTransaction({
to: tx.to,
data: tx.data,
value: tx.value,
gas: tx.gas,
});
const receipt = await publicClient.waitForTransactionReceipt({ hash });
if (receipt.status !== "success")
throw new Error(`Transaction ${hash} reverted`);
return receipt;
}
/** `bun launchpad.ts check`: reads the chain and your wallet. It sends nothing. */
async function check() {
const { paused, gated } = await client.status();
const balance = await publicClient.getBalance({ address: operator.address });
console.log(`operator ${operator.address}: ${formatEther(balance)} ETH`);
console.log(`a launchpad you register can launch here: ${!paused && !gated}`);
}
The SDK never holds your keys. Only client.launch sends a transaction, from the wallet you give the client. Every other call returns an unsigned transaction, and send signs and sends it.
Add the last part of the file from Run it now, with only check in its steps list. Add each step's line to the list as you write its function.
bun launchpad.ts check
You should see your operator's address with its balance, and a launchpad you register can launch here: true. If it prints false, stop: registering would pay the bond, and your launchpad could not launch on this chain.
4. Register your launchpad
One transaction registers the launchpad and pays the bond. The wallet that sends it becomes the operator.
A payee is a wallet that takes part of your launchpad's share of every trading fee, on every coin launched on it. Here the payee is the operator itself.
/** `bun launchpad.ts register`: one transaction. Its value is the bond. */
async function register() {
const tx = await launchpads.register({
operator: operator.address,
// Your payee takes 20% of what is left of every fee after Bankr's cut.
payees: [{ address: operator.address, shareBps: percentToBps("20") }],
metadataUri: "https://your-site.example/launchpad.json", // a link to your launchpad's name and logo
});
console.log(`registration bond: ${formatEther(tx.value)} ETH`);
const id = launchpads.launchpadIdFromReceipt(await send(tx));
console.log(`registered. Add this line to .env: LAUNCHPAD_ID=${id}`);
}
const launchpadId = () => BigInt(need("LAUNCHPAD_ID"));
bun launchpad.ts register
You should see registration bond: 0.01 ETH, then your launchpad's id. Add LAUNCHPAD_ID=<id> to .env.
Run this step once. Every run registers a new launchpad and pays a new bond.
Your launchpad can take launches at once. It is open: anyone can launch on it, inside the rules you set. To approve each launch on your own server, give it a signer. Launch for your users covers that.
5. Choose its configuration
Each setting of a launchpad is a range with a default: { min, max, default }. A launch names a value inside the range, or takes the default. Set min and max to the same value to fix a setting for every coin.
A new launchpad starts with these:
| Setting | A new launchpad |
|---|---|
| Trading fee | A launch picks from 0.05% to 10%. A launch that names none gets 0.05%. |
| Snipe fee | Off by default. A launch may open at up to 80%, falling within 120 seconds. |
| Supply | 100 billion tokens. A launch may pick from 1 token to 100 billion. |
| Wallet cap | 2% of supply per wallet for the first 24 hours. |
| Creator vesting | 15% of supply, locked for 30 days, fully unlocked by day 365. |
| Auto-LP | 30% of the creator's fees are added to the pool's locked liquidity. |
| Quote token | WETH by default. Any other ERC-20 is allowed. |
You change any number of settings in one transaction. What you leave out stays as it is. Here you set the trading fee:
/** `bun launchpad.ts configure`: one transaction. */
async function configure() {
const id = launchpadId();
await send(
await launchpads.configure(id, {
knobs: {
// A launch picks a trading fee from 1% to 2%, and gets 1% when it names none.
steadyPips: {
min: percentToPips("1"),
max: percentToPips("2"),
default: percentToPips("1"),
},
},
}),
);
const pad = await settings.pad(id);
const fee = pad.atLaunch.knobs.steadyPips;
console.log(`launchpad ${id}: operator ${pad.operator}`);
console.log(
`fee ${pipsToPercent(fee.min)}% to ${pipsToPercent(fee.max)}%, default ${pipsToPercent(fee.default)}%`,
);
}
Fee rates are in pips, where 10,000 pips is 1%. percentToPips("1") converts from percent. Shares are in bps, where 100 bps is 1%, and percentToBps converts those.
bun launchpad.ts configure
You should see your operator's address, then fee 1% to 2%, default 1%.
A change reaches later launches only. A coin that is already live keeps the terms it launched with.
Configuration lists every setting with its range and its default.
6. Launch your first coin
A launch is one transaction. It creates the token and its Uniswap v4 pool, and locks the pool's liquidity for good.
client.plan checks the launch against your launchpad and shows what it will do. It sends nothing. client.launch plans, simulates, sends the launch from the operator wallet and reads the receipt.
/** `bun launchpad.ts launch`: a coin on your launchpad's defaults, with a small first buy. */
async function launch() {
const input = {
name: "My First Coin",
symbol: "FIRST",
metadataUri: "ipfs://your-metadata-cid", // replace with a link to your token's metadata JSON
launcher: operator.address,
launchpadId: launchpadId(),
devBuy: { amount: parseEther("0.001") }, // you buy 0.001 ETH of the coin in the launch transaction
} satisfies LaunchInput<"base">;
// The plan: how each trading fee will split, before anything is signed.
const split = (await client.plan(input)).volumeSplit;
console.log(`fee: ${pipsToPercent(split.feePips)}% of each trade`);
console.log(` ${pipsToPercent(split.creatorPips)}% to the creator`);
for (const payee of split.payees)
console.log(` ${pipsToPercent(payee.pips)}% to payee ${payee.address}`);
console.log(` ${pipsToPercent(split.autoLpPips)}% into locked liquidity`);
const result = await client.launch(input);
console.log(`launched ${result.token} in ${result.txHash}`);
console.log(`first buy: ${formatEther(result.devBuyOut)} tokens`);
}
metadataUri is a placeholder here. The link is stored as written and cannot be changed later. For a real coin, host the JSON first or add metadataAdmin: operator.address. Metadata lists the JSON's fields.
bun launchpad.ts launch
You should see the fee split, the new token's address, and the tokens your first buy received:
fee: 1% of each trade
0.419976% to the creator
0.18% to payee 0x…
0.216% into locked liquidity
launched 0x… in 0x…
first buy: … tokens
The rest of the 1% is Bankr's cut and the share of the coin's holders. Fees explains the split.
Keep the token's address. The next two steps take it as an argument.
This launch named only a name, a symbol and a first buy. Every other term came from your launchpad's defaults: the 1% fee, the supply, the wallet cap, the vesting schedule. Configuration lists every option a launch can name.
7. Read it back
Everything a launch resolved to is written into the coin's own contracts. Nobody can change it afterwards. client.launchInfo reads it from the chain.
/** `bun launchpad.ts read <token>`: the coin as the chain holds it. */
async function read(token: Address) {
const info = await client.launchInfo(token);
if (!info) throw new Error(`${token} was not launched on these contracts`);
console.log(`launchpad ${info.launchpadId}, launcher ${info.launcher}`);
console.log(
`buy fee ${pipsToPercent(info.fees.buy.steadyPips)}%, sell fee ${pipsToPercent(info.fees.sell.steadyPips)}%`,
);
for (const r of info.feeRecipients)
console.log(
`fee recipient ${r.recipient}: ${bpsToPercent(r.shareBps)}% of the creator's fees`,
);
const trading = await client.tradingStatus(token);
console.log(trading.started ? "trading is open" : "trading has not started");
}
bun launchpad.ts read 0xYourToken
You should see your launchpad's id and your operator as the launcher, buy fee 1%, sell fee 1%, your operator as the only fee recipient with 100%, and trading is open.
Bankr also indexes every launch on every launchpad. Once it has indexed yours, your coin is at https://api.bankr.bot/launches/base/0xYourToken. Reading launches covers the index.
8. Claim your fees
Every trade pays a fee in WETH, the coin's quote token. The contracts split it inside the swap and hold each party's share until that party claims it.
Your wallet is owed two parts of this coin's fees: the 20% you set for your launchpad's payee, and the creator's share, because you launched the coin. Your first buy in step 6 was a trade, so there is already something to claim.
/** `bun launchpad.ts claim <token>`: claims everything the operator is owed on one coin. */
async function claim(token: Address) {
const fees = await client.fees.get(token, operator.address);
console.log(`claimable: ${formatEther(fees.claimableQuote)} WETH`);
if (fees.claimableQuote === 0n) return;
for (const tx of await client.fees.buildClaim(token, operator.address))
await send(tx);
console.log("claimed");
}
bun launchpad.ts claim 0xYourToken
You should see a small amount above 0, about 0.000006 WETH after the first buy alone, then claimed. The WETH is in the operator wallet.
Run it again after more trades. client.fees.buildClaimAll(account) claims every coin on the chain at once.
Run it
This last part of launchpad.ts turns each function into a command and prints the SDK's refusals with their reason.
const [step = "", arg] = process.argv.slice(2);
const token = (): Address => {
if (!arg) throw new Error(`Use: bun launchpad.ts ${step} <token address>`);
return getAddress(arg);
};
const steps: Record<string, () => Promise<void>> = {
check,
register,
configure,
launch,
read: () => read(token()),
claim: () => claim(token()),
};
const run = steps[step];
if (!run) {
console.log(`Steps: ${Object.keys(steps).join(", ")}`);
process.exit(1);
}
try {
await run();
} catch (err) {
// Every SDK refusal has a stable code, and `detail` names the rule.
if (!isLaunchSdkError(err)) throw err;
console.error(`${err.code}: ${err.message} ${err.detail ?? ""}`);
process.exitCode = 1;
}
If a step fails
| You see | What it means | What to do |
|---|---|---|
AUTHORIZATION_REQUIRED | The launch names no launchpadId, so it went to launchpad 0, Bankr's own. | Pass your launchpadId, as step 6 does. |
LAUNCHPAD_GATED | The chain takes launches on Bankr's own launchpad only. Registering and configuring still work. | Launch on a chain where client.status() reports gated: false. This guide uses Base. |
CREATOR_CAP_EXCEEDED | The first buy would take more of the supply than your launchpad's devBuyMaxBps or the coin's wallet cap allows. | Lower devBuy.amount. |
OUTSIDE_LAUNCHPAD_RANGE | An option is outside your launchpad's range. detail names the setting and the range. | Use a value inside the range, or widen the range as in step 5 |
FEE_OUT_OF_BOUNDS | The fee is outside your launchpad's fee range. | Use a fee inside the range. |
NOT_ALLOWED_BY_LAUNCHPAD | The launch uses a feature your launchpad has switched off. detail names it. | Switch the feature on, or drop the option. |
INVALID_LAUNCHPAD_CONFIG | A setting you tried to change breaks a rule. detail says which. | Fix the value and build the change again. |
TERMS_CHANGED | Your launchpad's settings changed after the plan. client.launch plans again. | If you send plans yourself, plan again. |
| A viem error that says "insufficient funds" | The operator wallet cannot pay the bond, the first buy or the gas. | Fund the wallet and run the step again. |
Errors lists every code.
Where to go next
- Set up a launchpad: payees, a signer, quote tokens, an address suffix and every other launchpad setting.
- Launch for your users: your users launch from their own wallets inside your app.
- Launch a token yourself: one script, with the options you want.
- Configuration: every setting and every launch option, with its range and its default.
- Extensions: give a coin its own trading rule, such as a sniper tax.