Skip to main content
In this guide, you’ll learn how to launch a Solana token using the Bags TypeScript SDK with Node.js. Token Launch v2 requires fee sharing configuration. This example allocates the normal recipient pool to the creator by default; you can share that pool with additional fee claimers. New SOL fee-share v2 configs also reserve a separate deployer share for the config payer.
To launch on a bonding curve with a custom quote, including supported stock tokens, see Launch a Token with a Custom Quote.
Deployer share: For new SOL fee-share v2 configs, the payer passed to Create Fee Share Config is registered as the deployer. Its separate share is 25% of the gross claimers pool; basisPointsArray still totals 10,000 and divides the remaining pool. Choose that payer deliberately: a later launch wallet does not replace it. The payer reads and claims the separate share through the dedicated deployer endpoints; existing creator claims remain separate. See Deployer Fees for the full workflow.

Prerequisites

Before starting, make sure you have:
  • Completed our TypeScript and Node.js Setup Guide.
  • Got your API key from the Bags Developer Portal.
  • A Solana wallet with some SOL for transactions.
  • A token image URL (recommended) or image file.
  • Installed the additional dependencies for this guide:
Optional: If you want to include a partner configuration in your token launch, you’ll need to create a partner key first. See the Create Partner Key guide for details. Once you have a partner key, you can include it when launching tokens using the partner and partnerConfig parameters.

1. Set Up Environment Variables

This guide requires your wallet’s private key. Add it to your base .env file:
You can export your private key from wallets like Bags, Phantom, or Backpack.

2. The Token Launch Script

Here is the complete script for launching a token. Save it as launch-token.ts. The script follows the Token Launch v2 flow:
  1. Create metadata
  2. Create config (fee share configuration)
  3. Get token creation transaction
  4. Sign transaction
  5. Broadcast transaction

Endpoints Used Under the Hood

This SDK flow calls these documented endpoints: This guide also uses SDK Solana helper methods for Jito bundle/tip workflows. Those helper endpoints are currently undocumented in this docs set, so they are intentionally not linked here.

3. Understanding Fee Sharing

Token Launch v2 requires fee sharing configuration with explicit BPS (basis points) allocation. Important rules:

Key Rules

  1. Normal recipient allocations are explicit: Give the creator 10,000 BPS to allocate the entire remaining recipient pool to it. A creator can be omitted from this array; the config payer still earns its separate deployer share. See Deployer Fees for the separate deployer claim endpoints and token-attributed balances.
  2. When sharing fees: Set each normal recipient’s BPS explicitly. These percentages apply after platform, partner, and deployer deductions, not to gross trading fees.
  3. Total BPS must equal 10000: Normal recipient BPS must total 10,000. The separate deployer allocation is not included in this sum.
  4. Maximum fee earners: You can have up to 100 fee earners (including the creator) per token launch.
  5. Supported platforms: Fee claimers can be identified using supported social platforms: twitter, kick, and github.
  6. Lookup Tables (LUTs): When you have more than 15 fee claimers, you need to create lookup tables before creating the fee share config. The script automatically handles this by:
    • Calling getConfigCreationLookupTableTransactions() to get LUT creation transactions
    • Executing the LUT creation transaction
    • Waiting for one slot to pass (required by Solana)
    • Executing all LUT extend transactions
    • Passing the LUT addresses to createBagsFeeShareConfig via additionalLookupTables

Partner Configuration

You can include a partner configuration in your fee share setup by providing:
  • partner: The partner wallet address (PublicKey)
  • partnerConfig: The partner config PDA (PublicKey) - can be derived using the helper function shown in the examples
Partners receive a share of fees from token launches that include their partner configuration. This is useful for platforms or partnerships that want to collect fees from multiple token launches.
To create a partner key, see the Create Partner Key guide.

Alternative: Using the Bags CLI

This section requires the Bags CLI. See Install and Set Up the Bags CLI to get started.
The CLI wraps the entire multi-step launch flow (metadata upload, fee share config, lookup tables, Jito bundles, and launch transaction) into a single command: Launch with the normal recipient pool allocated to the creator:
Launch with fee sharing:
The CLI assigns the creator the unused normal recipient BPS (50% in this example). For a new config, the payer also receives its separate deployer share; 50% BPS does not mean 50% of total earnings. Launch with a partner:
If you omit the flags, the CLI guides you through an interactive wizard that lets you add fee claimers one at a time (by social username or wallet address) and set their BPS allocation.

4. Run Your Script

To launch your token, edit the launchToken function call at the bottom of launch-token.ts with your token’s details, especially the imageUrl. Then, run the script from your terminal:

5. Troubleshooting

The script includes comprehensive error handling. Common issues include:
  • API Key Issues: Ensure your API key is valid.
  • Private Key Format: Your private key must be base58 encoded.
  • Insufficient SOL: Your wallet needs SOL for transaction fees.
  • Image URL: The URL to your token image must be accessible and valid.
  • Invalid Fee Claimer: Ensure the fee claimer provider and username are valid and the user has a registered wallet.
For more details, see the API Reference.