# Step 2: Initialize Token Bonding Curve (TBC)

### TBC Resources

{% content-ref url="/pages/cxtp5jf60qFp3dMXqsSF" %}
[TBC Guides](/rly-protocol/get-started/tbc-on-solana/step-2-initialize-token-bonding-curve-tbc/tbc-guides.md)
{% endcontent-ref %}

{% content-ref url="/pages/ZTpbD3bdJbBg6PzJWqoW" %}
[TBC Examples](/rly-protocol/get-started/tbc-on-solana/step-2-initialize-token-bonding-curve-tbc/tbc-examples.md)
{% endcontent-ref %}

## Initialize the TBC

### Step 2.1: Initialize the TBC

Configure your TBC parameters. View the [TBC Guide](/rly-protocol/get-started/tbc-on-solana/step-2-initialize-token-bonding-curve-tbc/tbc-guides.md) and [Examples](/rly-protocol/get-started/tbc-on-solana/step-2-initialize-token-bonding-curve-tbc/tbc-examples.md) pages for help.

{% tabs %}
{% tab title="CLI" %}

```
Usage: rly-cli tbc-init [options] <token_a> <token_b> <token_b_liquidity>

Arguments:
  token_a                              token A
  token_b                              token B
  token_b_liquidity                    token B liquidity (base units)

Options:
  -e, --env <string>                   Solana cluster env name (default: "devnet")
  -k, --keypair <path>                 Solana wallet location (default: "--keypair not provided")
  --slope_numerator <string>           slope numerator
  --slope_denominator <string>         slope denominator
  --init_price_a_numerator <string>    initial price token A
  --init_price_a_denominator <string>  initial price token A
  -h, --help                           display help for command
```

{% endtab %}

{% tab title="TS" %}

```
// token bonding curve

import { Provider } from "@project-serum/anchor"
import { Keypair, Connection, clusterApiUrl } from 'solana/web3js`;
import { tokenSwapProgram } from 'rly-js';

const walletKeyPair = Keypair.generate();
const provider = new Provider(new Connection(clusterApiUrl("devnet")), new NodeWallet(walletKeyPair), {});

const tokenSwap = await tokenSwapProgram(provider);
```

Examples: <https://github.com/rally-dfs/dfs-ts/tree/main/ts/tests>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
The keypair used above is required to be the same keypair that owns the initial minted app token in Step 1 because that's where the liquidity is coming from.
{% endhint %}

{% hint style="info" %}
Token A is the sRLY token on production environments. On non production environments,  token A can be any SPL token. It is recommended that you create an SPL token that has [similar properties as sRLY](https://explorer.solana.com/address/sRLY3migNrkC1HLgqotpvi66qGkdNedqPZ9TJpAQhyh). \
Token B is your application token from Step 1.&#x20;
{% endhint %}

### Step 2.2: **Supply application tokens to the TBC swap (Automatic)**

Once the TBC is configured and initialized, two token accounts will automatically be created in the swap program:&#x20;

1. A token account for token A (sRLY on prod, any SPL token on devnet)
2. A token account for your application token (token B)&#x20;

Once created, the initial token B supply amount will be transferred from the authorized wallet to the token B account owned by the swap program.

{% hint style="info" %}
The new bonding curve should start out with only the newly minted token B in the swap. As users buy against the curve, the collateral in sRLY builds.
{% endhint %}

{% hint style="warning" %}
Note: Pool tokens and deposits/withdrawals of pool tokens are intentionally disabled so that liquidity can't be added/removed from the swap outside of the swap instruction.
{% endhint %}

## That's it!

In this section you should have:

* Initialized a TBC based on your parameters&#x20;
* Verified the token account for your app token owned by the swap program&#x20;
* Verified the token account for sRLY owned by the swap program&#x20;
* Verified the transfer and balance of the initial supply of application token to app token account&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.rly.network/rly-protocol/get-started/tbc-on-solana/step-2-initialize-token-bonding-curve-tbc.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
