> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Stellar

> Sign messages and transactions, send XLM and Stellar assets, manage trustlines, and query balances using the Dynamic Unity SDK.

## Overview

`StellarModule` provides native Stellar blockchain operations including message signing, transaction envelope signing, XLM and asset transfers, trustlines, balance queries, and network details. Access it via `DynamicSDK.Instance.Networks.Stellar`.

## Get a Stellar Wallet

If Stellar is enabled in the dashboard, the user gets a Stellar wallet on signup. Find it via `UserWallets`:

```csharp theme={"system"}
var stellarWallet = DynamicSDK.Instance.Wallets.UserWallets
    .FirstOrDefault(w => w.Chain.ToUpper() == "STELLAR");
```

## Get Balance

Query the XLM balance for a wallet. Returned as a string to preserve precision. Pass `assetCode` and `assetIssuer` to query a non-native asset instead.

```csharp theme={"system"}
string balance = await DynamicSDK.Instance.Networks.Stellar.GetBalance(wallet.Id);
Debug.Log($"Balance: {balance} XLM");
```

## Get Network

Query the Stellar network the wallet is connected to:

```csharp theme={"system"}
string network = await DynamicSDK.Instance.Networks.Stellar.GetNetwork(wallet.Id);
Debug.Log($"Network: {network}"); // e.g. "PUBLIC"
```

## Sign a Message

```csharp theme={"system"}
string signature = await DynamicSDK.Instance.Networks.Stellar.SignMessage(
    wallet.Id, "Hello from Stellar");

Debug.Log($"Signature: {signature}");
```

## Sign a Transaction

Sign a base64-encoded transaction envelope XDR. Returns the signed envelope XDR:

```csharp theme={"system"}
string signedXdr = await DynamicSDK.Instance.Networks.Stellar.SignTransaction(
    wallet.Id, envelopeXdr);

Debug.Log($"Signed XDR: {signedXdr}");
```

## Send a Balance

Send XLM, or a Stellar asset, to a recipient. Returns the transaction hash.

```csharp theme={"system"}
string hash = await DynamicSDK.Instance.Networks.Stellar.SendBalance(
    wallet.Id,
    "GBUQWP3BOUZX34ULNQG23RQ6F4BV7DVOV4SJQ6FYMJNL3LQO5QFCP5O4",
    "0.01");

Debug.Log($"Hash: {hash}");
```

| Parameter       | Type      | Description                                               |
| --------------- | --------- | --------------------------------------------------------- |
| `walletId`      | `string`  | The wallet ID to send from                                |
| `toAddress`     | `string`  | Recipient Stellar address (public key)                    |
| `amount`        | `string`  | Amount to send                                            |
| `tokenAddress`  | `string?` | Optional asset in `CODE:ISSUER` form. Omit for native XLM |
| `tokenDecimals` | `int?`    | Optional asset decimals. Stellar uses 7 by default        |

## Add a Trustline

Add a trustline for a non-native asset. An account must hold a trustline for an asset before it can receive it:

```csharp theme={"system"}
string hash = await DynamicSDK.Instance.Networks.Stellar.AddTrustline(
    wallet.Id,
    "USDC",
    "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5");

Debug.Log($"Hash: {hash}");
```

| Parameter     | Type      | Description                    |
| ------------- | --------- | ------------------------------ |
| `walletId`    | `string`  | The wallet ID                  |
| `assetCode`   | `string`  | The asset code, e.g. `USDC`    |
| `assetIssuer` | `string`  | Public key of the asset issuer |
| `limit`       | `string?` | Optional trustline limit       |

## API Reference

| Method            | Returns           | Description                              |
| ----------------- | ----------------- | ---------------------------------------- |
| `GetBalance`      | `UniTask<string>` | Get wallet balance                       |
| `GetNetwork`      | `UniTask<string>` | Get the connected network, e.g. `PUBLIC` |
| `SignMessage`     | `UniTask<string>` | Sign a message                           |
| `SignTransaction` | `UniTask<string>` | Sign an envelope XDR                     |
| `SendBalance`     | `UniTask<string>` | Send XLM or an asset, returns tx hash    |
| `AddTrustline`    | `UniTask<string>` | Add an asset trustline, returns tx hash  |

## Next steps

* [Token Balances](/docs/unity/wallets/general/token-balances): Multi-chain balance queries
* [SUI Transactions](/docs/unity/wallets/sui/send-transactions): Send SUI transactions
