> ## 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: Send Transactions and View History

> Use sendTransaction, getTransactions, and getTransactionHashes to send XFG and retrieve transaction history from the wallet service.

Sending XFG and querying your transaction history are the most frequently used wallet operations. The `sendTransaction` method handles the complete construction, signing, and broadcast of a transaction in one call. History methods return transactions grouped by the block they appear in, optionally filtered by address or payment ID. All calls go to `POST http://127.0.0.1:8070/json_rpc`.

<Warning>
  The minimum transaction fee is **0.008 XFG = 80,000 atomic units**. Transactions submitted with a lower fee will be rejected by the network. Use the default value when possible — the wallet uses this minimum by default if you omit the `fee` parameter.
</Warning>

***

## sendTransaction

Constructs, signs, and broadcasts a transaction from one or more source addresses to one or more recipients. The wallet selects inputs, calculates change, and handles ring signature generation automatically.

### Request

<ParamField body="params.sourceAddresses" type="array of strings">
  List of addresses within the wallet to draw funds from. If omitted, the wallet uses all available addresses.
</ParamField>

<ParamField body="params.transfers" type="array of objects" required>
  One or more recipients. Each object has:

  * `address` (string, required) — destination Fuego address
  * `amount` (integer, required) — amount to send in atomic units
  * `message` (string) — optional encrypted message to include with the transfer
</ParamField>

<ParamField body="params.changeAddress" type="string" required>
  Address within the wallet where change outputs are sent. Must be one of the addresses managed by the wallet.
</ParamField>

<ParamField body="params.fee" type="integer">
  Transaction fee in atomic units. Defaults to `80000` (0.008 XFG). Must not be lower than the minimum.
</ParamField>

<ParamField body="params.anonymity" type="integer">
  Ring size (number of decoy inputs per real input). Defaults to `4`. Minimum is `2` (`MINIMUM_MIXIN = 2`). Higher values improve privacy but increase transaction size and fee.
</ParamField>

<ParamField body="params.paymentId" type="string">
  Optional 64-character hex payment ID to embed in the transaction. Use this for merchant reconciliation. Mutually exclusive with encoding a payment ID in an integrated address.
</ParamField>

<ParamField body="params.extra" type="string">
  Optional raw hex extra data to include in the transaction's extra field.
</ParamField>

<ParamField body="params.unlockTime" type="integer">
  Block height at which the outputs become spendable by the recipient. Defaults to `0` (immediately spendable). Use this to create time-locked outputs.
</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": "sendTransaction",
      "params": {
        "transfers": [
          {
            "address": "fireXfGRecipientAddress...",
            "amount": 100000000
          }
        ],
        "changeAddress": "fireXfGMyAddress...",
        "fee": 80000,
        "anonymity": 4,
        "paymentId": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2"
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "sendTransaction",
    "params": {
      "transfers": [
        {
          "address": "fireXfGRecipientAddress...",
          "amount": 100000000
        }
      ],
      "changeAddress": "fireXfGMyAddress...",
      "fee": 80000,
      "anonymity": 4,
      "paymentId": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2"
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

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

<ResponseField name="transactionHash" type="string" required>
  Hex-encoded hash of the submitted transaction. Use this to track confirmation status.
</ResponseField>

<ResponseField name="transactionSecretKey" type="string" required>
  The one-time secret key for this transaction. Keep this if you need to generate transaction proofs later.
</ResponseField>

***

## getTransactions

Returns full transaction details grouped by block. Filter by address, payment ID, or block range. You must provide either `blockHash` (start from a specific block hash) or `firstBlockIndex` (start from a block index) — not both.

### Request

<ParamField body="params.addresses" type="array of strings">
  Filter to transactions involving only these addresses. Omit to include all addresses in the wallet.
</ParamField>

<ParamField body="params.blockHash" type="string">
  Hash of the block to start scanning from. Mutually exclusive with `firstBlockIndex`.
</ParamField>

<ParamField body="params.firstBlockIndex" type="integer">
  Block index to start scanning from (inclusive). Mutually exclusive with `blockHash`.
</ParamField>

<ParamField body="params.blockCount" type="integer" required>
  Number of blocks to scan forward from the starting point.
</ParamField>

<ParamField body="params.paymentId" type="string">
  If provided, only return transactions that include this payment ID.
</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": "getTransactions",
      "params": {
        "firstBlockIndex": 890000,
        "blockCount": 1000
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "getTransactions",
    "params": {
      "firstBlockIndex": 890000,
      "blockCount": 1000
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "items": [
      {
        "blockHash": "a1b2c3d4...",
        "transactions": [
          {
            "state": 0,
            "transactionHash": "c3d4e5f6...",
            "blockIndex": 890001,
            "timestamp": 1712345678,
            "confirmations": 9999,
            "isBase": false,
            "unlockTime": 0,
            "amount": 100000000,
            "fee": 80000,
            "transfers": [
              {
                "type": 0,
                "address": "fireXfGRecipientAddress...",
                "amount": 100000000,
                "message": ""
              }
            ],
            "extra": "",
            "paymentId": "a1b2c3d4...",
            "firstDepositId": 18446744073709551615,
            "depositCount": 0
          }
        ]
      }
    ]
  }
}
```

<ResponseField name="items" type="array of objects" required>
  One entry per block that contained relevant transactions.

  <Expandable title="Item fields">
    <ResponseField name="blockHash" type="string" required>
      Hash of the block this group of transactions was confirmed in.
    </ResponseField>

    <ResponseField name="transactions" type="array of objects" required>
      Transactions confirmed in this block that match the query.

      <Expandable title="Transaction fields">
        <ResponseField name="state" type="integer" required>
          Transaction state: `0` = confirmed, `1` = unconfirmed.
        </ResponseField>

        <ResponseField name="transactionHash" type="string" required>
          Hex-encoded transaction hash.
        </ResponseField>

        <ResponseField name="blockIndex" type="integer" required>
          Block height where this transaction was confirmed.
        </ResponseField>

        <ResponseField name="timestamp" type="integer" required>
          Unix timestamp of the block this transaction is in.
        </ResponseField>

        <ResponseField name="confirmations" type="integer" required>
          Number of blocks confirmed on top of this transaction's block.
        </ResponseField>

        <ResponseField name="isBase" type="boolean" required>
          `true` if this is a coinbase (miner reward) transaction.
        </ResponseField>

        <ResponseField name="unlockTime" type="integer" required>
          Block height at which outputs become spendable. `0` means immediately spendable.
        </ResponseField>

        <ResponseField name="amount" type="integer" required>
          Net amount change for this wallet in atomic units. Positive = received, negative = sent.
        </ResponseField>

        <ResponseField name="fee" type="integer" required>
          Transaction fee paid, in atomic units.
        </ResponseField>

        <ResponseField name="transfers" type="array of objects" required>
          Individual transfer entries within the transaction.
        </ResponseField>

        <ResponseField name="paymentId" type="string" required>
          Payment ID embedded in the transaction, or empty string if none.
        </ResponseField>

        <ResponseField name="depositCount" type="integer" required>
          Number of deposit operations in this transaction.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

***

## getTransactionHashes

Returns only transaction hashes (not full details) grouped by block. Useful for lightweight scanning when you only need to know which transactions occurred, not their full content.

### Request

Parameters are identical to `getTransactions`: `addresses`, `blockHash` or `firstBlockIndex`, `blockCount`, and `paymentId`.

<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": "getTransactionHashes",
      "params": {
        "firstBlockIndex": 890000,
        "blockCount": 100,
        "paymentId": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2"
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "getTransactionHashes",
    "params": {
      "firstBlockIndex": 890000,
      "blockCount": 100,
      "paymentId": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2"
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "items": [
      {
        "blockHash": "a1b2c3d4...",
        "transactionHashes": [
          "c3d4e5f6...",
          "d4e5f6a7..."
        ]
      }
    ]
  }
}
```

<ResponseField name="items" type="array of objects" required>
  One entry per block containing matching transactions.

  <Expandable title="Item fields">
    <ResponseField name="blockHash" type="string" required>
      Hash of the block.
    </ResponseField>

    <ResponseField name="transactionHashes" type="array of strings" required>
      Transaction hashes confirmed in this block that match the filter.
    </ResponseField>
  </Expandable>
</ResponseField>

***

## getBlockHashes

Returns a sequential list of block hashes starting from a given index. Useful for building a local cache of the chain or verifying continuity.

### Request

<ParamField body="params.firstBlockIndex" type="integer" required>
  The block index to start from (inclusive).
</ParamField>

<ParamField body="params.blockCount" type="integer" required>
  Number of block hashes to return.
</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": "getBlockHashes",
      "params": {
        "firstBlockIndex": 900000,
        "blockCount": 10
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "getBlockHashes",
    "params": {
      "firstBlockIndex": 900000,
      "blockCount": 10
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "blockHashes": [
      "a1b2c3d4...",
      "b2c3d4e5...",
      "c3d4e5f6..."
    ]
  }
}
```

<ResponseField name="blockHashes" type="array of strings" required>
  Block hashes in ascending height order, starting from `firstBlockIndex`.
</ResponseField>
