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

# Wallet RPC: Create and Manage XFG Deposits

> Use createDeposit, withdrawDeposit, sendDeposit, and getDeposit to create and manage time-locked XFG deposits that earn interest via the wallet RPC.

Fuego supports on-chain time deposits: you lock a minimum amount of XFG for a fixed term of 16,440 blocks (approximately 3 months), and in return you receive interest when the deposit matures. Deposits are created and managed entirely through `walletd` — the deposit ID returned when you create a deposit is your handle for querying status and triggering withdrawal. All calls go to `POST http://127.0.0.1:8070/json_rpc`.

<Warning>
  The minimum deposit amount is **800 XFG = 8,000,000,000 atomic units**. The deposit term is fixed at **16,440 blocks**, approximately 3 months at the 480-second block target. Deposits created below the minimum or with a non-standard term will be rejected.
</Warning>

***

## createDeposit

Locks XFG from a source address into a time deposit. The wallet constructs and broadcasts a deposit transaction. The returned `transactionHash` is the on-chain proof of deposit creation, and the deposit index is assigned by the chain.

### Request

<ParamField body="params.amount" type="integer" required>
  Amount to deposit in atomic units. Minimum: `8000000000` (800 XFG).
</ParamField>

<ParamField body="params.term" type="integer" required>
  Deposit lock term in blocks. Must be `16440`. Other values are currently rejected by the network.
</ParamField>

<ParamField body="params.sourceAddress" type="string" required>
  The wallet address to draw the deposit funds from. Must be an address managed by this wallet instance.
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl -s http://127.0.0.1:8070/json_rpc \
    -H 'Content-Type: application/json' \
    -d '{
      "jsonrpc": "2.0",
      "method": "createDeposit",
      "params": {
        "amount": 8000000000,
        "term": 16440,
        "sourceAddress": "fireXfGYourAddress..."
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "createDeposit",
    "params": {
      "amount": 8000000000,
      "term": 16440,
      "sourceAddress": "fireXfGYourAddress..."
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "transactionHash": "c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
  }
}
```

<ResponseField name="transactionHash" type="string" required>
  Hash of the deposit creation transaction. Use this to look up the deposit ID by scanning transactions with `getTransactions`, or to track confirmation on the daemon.
</ResponseField>

***

## withdrawDeposit

Withdraws a matured deposit, returning the principal plus accrued interest to the source address. You must wait until the deposit's `unlockHeight` has been reached before calling this method.

### Request

<ParamField body="params.depositId" type="integer" required>
  The numeric deposit ID assigned by the chain when the deposit was created. Retrieve this via `getDeposit` or `getStatus`.
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl -s http://127.0.0.1:8070/json_rpc \
    -H 'Content-Type: application/json' \
    -d '{
      "jsonrpc": "2.0",
      "method": "withdrawDeposit",
      "params": {
        "depositId": 42
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "withdrawDeposit",
    "params": {
      "depositId": 42
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "transactionHash": "d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5"
  }
}
```

<ResponseField name="transactionHash" type="string" required>
  Hash of the withdrawal transaction that returns the deposit funds plus interest to your address.
</ResponseField>

***

## sendDeposit

Creates a deposit funded from a `sourceAddress` but redeemable by a different `destinationAddress`. This allows creating a deposit on behalf of another address — for example, funding a deposit for a user's address from a hot wallet.

### Request

<ParamField body="params.amount" type="integer" required>
  Amount to deposit in atomic units. Minimum: `8000000000` (800 XFG).
</ParamField>

<ParamField body="params.term" type="integer" required>
  Deposit lock term in blocks. Must be `16440`.
</ParamField>

<ParamField body="params.sourceAddress" type="string" required>
  The wallet address providing the funds. Must be managed by this wallet.
</ParamField>

<ParamField body="params.destinationAddress" type="string" required>
  The address that will be credited the deposit and its interest upon maturity. Can be any valid Fuego address.
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl -s http://127.0.0.1:8070/json_rpc \
    -H 'Content-Type: application/json' \
    -d '{
      "jsonrpc": "2.0",
      "method": "sendDeposit",
      "params": {
        "amount": 8000000000,
        "term": 16440,
        "sourceAddress": "fireXfGHotWalletAddress...",
        "destinationAddress": "fireXfGUserAddress..."
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "sendDeposit",
    "params": {
      "amount": 8000000000,
      "term": 16440,
      "sourceAddress": "fireXfGHotWalletAddress...",
      "destinationAddress": "fireXfGUserAddress..."
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "transactionHash": "e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6"
  }
}
```

<ResponseField name="transactionHash" type="string" required>
  Hash of the deposit creation transaction.
</ResponseField>

***

## getDeposit

Returns the current state of a specific deposit identified by its numeric ID. Use this to check whether a deposit is still locked, what interest has accrued, and at which block height the funds unlock.

### Request

<ParamField body="params.depositId" type="integer" required>
  The numeric deposit ID to query.
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl -s http://127.0.0.1:8070/json_rpc \
    -H 'Content-Type: application/json' \
    -d '{
      "jsonrpc": "2.0",
      "method": "getDeposit",
      "params": {
        "depositId": 42
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "getDeposit",
    "params": {
      "depositId": 42
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "amount": 8000000000,
    "term": 16440,
    "interest": 160000000,
    "height": 883560,
    "unlockHeight": 900000,
    "creatingTransactionHash": "c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
    "spendingTransactionHash": "",
    "locked": true,
    "address": "fireXfGYourAddress..."
  }
}
```

<ResponseField name="amount" type="integer" required>
  Principal amount deposited, in atomic units.
</ResponseField>

<ResponseField name="term" type="integer" required>
  Lock term in blocks (currently always `16440`).
</ResponseField>

<ResponseField name="interest" type="integer" required>
  Interest earned on this deposit in atomic units, calculated at the time of the response. This is the bonus you receive in addition to the principal when you withdraw.
</ResponseField>

<ResponseField name="height" type="integer" required>
  Block height at which this deposit was created (confirmed).
</ResponseField>

<ResponseField name="unlockHeight" type="integer" required>
  Block height at which the deposit matures and can be withdrawn. Equal to `height + term`.
</ResponseField>

<ResponseField name="creatingTransactionHash" type="string" required>
  Hash of the transaction that created this deposit.
</ResponseField>

<ResponseField name="spendingTransactionHash" type="string" required>
  Hash of the withdrawal transaction, if the deposit has been spent. Empty string if the deposit is still locked or unspent.
</ResponseField>

<ResponseField name="locked" type="boolean" required>
  `true` if the deposit is still within its lock term. `false` if the deposit has matured or already been withdrawn.
</ResponseField>

<ResponseField name="address" type="string" required>
  The Fuego address associated with this deposit — the address that will receive the funds on withdrawal.
</ResponseField>
