> For the complete documentation index, see [llms.txt](https://docs.rujira.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rujira.network/developers/rujira-product-integration-guides.md).

# Rujira Product Integration Guides

Technical documentation for integrating Rujira Network products into your application.

### Available Guides

#### [Rujira Trade and CCL](/developers/rujira-product-integration-guides/rujira-trade-and-ccl.md)

Integrate Rujira Trade orderbook DEX with native assets (BTC, ETH, SOL, XRP, DOGE, BCH, LTC and more) secured by THORChain - fully decentralized and permissionless.

* [**Funding Requirement: Secured Assets**](https://docs.rujira.network/developers/ruji-product-integration-guides/ruji-trade-and-ccl#funding-requirement-secured-assets)
  * Deposit native assets into THORChain to get Secured Assets
  * Withdraw Secured Asset back to the source L1
* [**Trading on Rujira Trade (FIN)**](/developers/rujira-product-integration-guides/rujira-trade-and-ccl.md#swap-integration)
  * Market orders (swap)
  * Limit orders
  * Tracking orders
* [**Custom Concentrated Liquidity (CCL) Positions**](/developers/rujira-product-integration-guides/rujira-trade-and-ccl.md#ccl-range-integration)
  * Create and manage ranges (fixed-range AMM strategies built directly into FIN)

#### [Money Market](/developers/rujira-product-integration-guides/rujira-lend-and-borrow.md)

Integrate lending and borrowing functionality with native assets (BTC, ETH, SOL, XRP, DOGE, BCH, LTC and more) secured by THORChain.

* [**Lending (Ghost Vault)**](/developers/rujira-product-integration-guides/rujira-lend-and-borrow.md#part-1-lending-integration-ghost-vault)
  * Deposit assets to earn yield
  * Receive transferable receipt tokens
  * Dynamic interest rates based on utilization
* [**Borrowing (Ghost Credit)**](/developers/rujira-product-integration-guides/rujira-lend-and-borrow.md#part-2-borrowing-integration-ghost-credit)
  * Create isolated Credit Accounts
  * Deposit multi-asset collateral
  * Borrow against collateral with overcollateralized loans

#### [Liquidations](/developers/rujira-product-integration-guides/rujira-liquidations.md)

* [**Bidding on Liquidations (for end users)**](/developers/rujira-product-integration-guides/rujira-liquidations/bidding-on-liquidations.md)
  * Integrate liquidation bidding into your application, allowing users to acquire collateral at discounted prices when CDP positions are liquidated.
* [**Build a Liquidation Solver (for developers)**](/developers/rujira-product-integration-guides/rujira-liquidations/liquidation-solvers.md)
  * Build liquidation bots that monitor at-risk positions, calculates optimal liquidation routes, and executes liquidations to earn the 0.5% executor fee.

#### [Staking](/developers/rujira-product-integration-guides/staking-ruji-brune-tcy.md)

Integrate staking markets powered by the Rujira staking contract, including RUJI, bRUNE and TCY. Allow users to stake and earn rewards from real economic activity. The staking contract supports both Account staking (claimable yield) and Liquid staking (auto-compounding).

#### [Liquidy Swap API](/developers/rujira-product-integration-guides/liquidy-swap-api.md)

[Liquidy](https://liquidy.finance/developer/swap-api) provide an easy way to integrate any SecuredAsset-to-SecuredAsset swap on Rujira, finding the best route between any two tokens through any of the Rujira Trade orderbooks. Liquidy API can also be used to find arbitrage opportunities across the orderbooks.

Liquidy charges 0.10% fee per swap and the optimize routing still often result for a net positive outcome for end users. Liquidy router support both a referral fee model (typically 10% of the 0.10% protocol fee shared with the integrating partner) and an affiliate fee model (additional fee the partner can add on top of the protocol fee - 100% retained by the partner).&#x20;

***

### Quick Reference

#### Main Supported Assets

<table><thead><tr><th width="150">Asset</th><th width="400">Denom</th><th>Decimals</th></tr></thead><tbody><tr><td>BTC</td><td><code>btc-btc</code></td><td>8</td></tr><tr><td>ETH</td><td><code>eth-eth</code></td><td>8</td></tr><tr><td>USDC</td><td><code>eth-usdc-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48</code></td><td>8</td></tr><tr><td>USDT</td><td><code>eth-usdt-0xdac17f958d2ee523a2206206994597c13d831ec7</code></td><td>8</td></tr><tr><td>BCH</td><td><code>bch-bch</code></td><td>8</td></tr><tr><td>DOGE</td><td><code>doge-doge</code></td><td>8</td></tr><tr><td>LTC</td><td><code>ltc-ltc</code></td><td>8</td></tr><tr><td>XRP</td><td><code>xrp-xrp</code></td><td>8</td></tr><tr><td>BNB</td><td><code>bsc-bnb</code></td><td>8</td></tr><tr><td>AVAX</td><td><code>avax-avax</code></td><td>8</td></tr><tr><td>TRX</td><td><code>tron-trx</code></td><td>8</td></tr><tr><td>ATOM</td><td><code>gaia-atom</code></td><td>8</td></tr></tbody></table>

> **Note:** For the full list of supported assets and chains, check THORChain active pools on <https://thorchain.net/pools/main>.

#### Network Endpoints

**THORChain Mainnet**

<table><thead><tr><th width="300">Type</th><th>URL</th></tr></thead><tbody><tr><td>RPC</td><td><code>https://gateway.liquify.com/chain/thorchain_rpc</code></td></tr><tr><td>gRPC</td><td><code>https://grpc-thorchain.rorcual.xyz</code></td></tr><tr><td>REST</td><td><code>https://gateway.liquify.com/chain/thorchain_api</code></td></tr></tbody></table>

**Rujira APIs**

<table><thead><tr><th width="300">Environment</th><th>URL</th></tr></thead><tbody><tr><td>Mainnet GraphQL</td><td><code>https://api.rujira.network/api/graphiql</code></td></tr></tbody></table>

***

### Development Tools

#### Libraries

Rujira contracts are standard CosmWasm. Use any Cosmos SDK compatible library:

| Language              | Library                                               |
| --------------------- | ----------------------------------------------------- |
| TypeScript/JavaScript | [CosmJS](https://github.com/cosmos/cosmjs)            |
| Rust                  | [cosmwasm-std](https://crates.io/crates/cosmwasm-std) |
| Go                    | [Cosmos SDK](https://github.com/cosmos/cosmos-sdk)    |
| Python                | [cosmpy](https://github.com/fetchai/cosmpy)           |

#### Contract Schemas

JSON schemas for all message types are available in each contract's `/schema` directory:

* [Rujira Trade (FIN) Schema](https://gitlab.com/thorchain/rujira/-/blob/main/contracts/rujira-fin/schema/rujira-fin.json?ref_type=heads)
* [Ghost Vault Schema](https://gitlab.com/thorchain/rujira/-/blob/main/contracts/rujira-ghost-vault/schema/rujira-ghost-vault.json?ref_type=heads)
* [Ghost Credit Schema](https://gitlab.com/thorchain/rujira/-/blob/main/contracts/rujira-ghost-credit/schema/rujira-ghost-credit.json?ref_type=heads)

***

### Common Patterns

#### Querying Contract State

```typescript
import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";

const client = await CosmWasmClient.connect("https://rpc.ninerealms.com");

// Query any contract
const result = await client.queryContractSmart(
  CONTRACT_ADDRESS,
  { query_msg: { /* params */ } }
);
```

#### Executing Transactions

```typescript
import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate";

const client = await SigningCosmWasmClient.connectWithSigner(
  "https://rpc.ninerealms.com",
  signer
);

// Execute with funds
const result = await client.execute(
  senderAddress,
  CONTRACT_ADDRESS,
  { execute_msg: { /* params */ } },
  "auto",  // gas
  "",      // memo
  [{ denom: "btc-btc", amount: "100000000" }]  // funds
);
```

#### Handling Decimals

All amounts use 8 decimal places:

```typescript
// Convert human-readable to chain format
function toChainAmount(amount: number): string {
  return Math.floor(amount * 1e8).toString();
}

// Convert chain format to human-readable
function fromChainAmount(amount: string): number {
  return parseInt(amount) / 1e8;
}

// Examples:
toChainAmount(1.5);        // "150000000" (1.5 BTC)
fromChainAmount("100000000"); // 1.0 BTC
```

***

### Support

* **Documentation**: [docs.rujira.network](https://docs.rujira.network)
* **Telegram**: [@Rujira\_Community ](https://t.me/Rujira_Community)
* **E-Mail**: [bd@rujira.network ](mailto://bd@rujira.network)
* **Discord**: [Join](https://discord.gg/AfmZN49grz)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rujira.network/developers/rujira-product-integration-guides.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
