> ## 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 Addresses

> Use createAddress, getAddresses, deleteAddress, getSpendKeys, and related methods to manage addresses in the Fuego wallet service.

The Fuego wallet service (`walletd`) is a multi-address wallet that can hold many addresses under a single view key. You create addresses either by generating fresh key pairs or by importing existing spend keys — useful for restoring previously-used addresses. All methods in this section communicate over JSON-RPC 2.0 via `POST http://127.0.0.1:8070/json_rpc`.

***

## createAddress

Generates a new address in the wallet. If you provide a `spendSecretKey`, the wallet imports the corresponding address (useful for key recovery). If you provide a `spendPublicKey`, the wallet adds a view-only address. If you provide neither, the wallet generates a new random key pair and returns the fresh address.

### Request

<ParamField body="method" type="string" required>
  `"createAddress"`
</ParamField>

<ParamField body="params.spendSecretKey" type="string">
  Hex-encoded spend secret key to import. Omit to generate a fresh address.
</ParamField>

<ParamField body="params.spendPublicKey" type="string">
  Hex-encoded spend public key to add as a view-only address. Mutually exclusive with `spendSecretKey`.
</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": "createAddress",
      "params": {},
      "id": "1"
    }'
  ```

  ```json Request (new address) theme={null}
  {
    "jsonrpc": "2.0",
    "method": "createAddress",
    "params": {},
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "address": "fireXfGYourNewAddressHere..."
  }
}
```

<ResponseField name="address" type="string" required>
  The newly created or imported Fuego address (base58-encoded, starts with `fire`).
</ResponseField>

***

## createAddressList

Batch-imports multiple addresses from a list of spend secret keys. Optionally resets the wallet scan to the beginning of the chain after importing.

### Request

<ParamField body="params.spendSecretKeys" type="array of strings" required>
  List of hex-encoded spend secret keys to import.
</ParamField>

<ParamField body="params.reset" type="boolean" required>
  If `true`, resets the wallet's scan height to 0 after importing, triggering a full rescan.
</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": "createAddressList",
      "params": {
        "spendSecretKeys": [
          "a1b2c3d4e5f6...",
          "f6e5d4c3b2a1..."
        ],
        "reset": false
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "createAddressList",
    "params": {
      "spendSecretKeys": [
        "a1b2c3d4e5f6...",
        "f6e5d4c3b2a1..."
      ],
      "reset": false
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "addresses": [
      "fireXfGAddress1...",
      "fireXfGAddress2..."
    ]
  }
}
```

<ResponseField name="addresses" type="array of strings" required>
  The list of addresses corresponding to the imported spend keys, in the same order as the input.
</ResponseField>

***

## getAddresses

Returns all addresses currently managed by the wallet service.

### Request

<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": "getAddresses",
      "params": {},
      "id": "1"
    }'
  ```

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

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "addresses": [
      "fireXfGPrimaryAddress...",
      "fireXfGSecondAddress..."
    ]
  }
}
```

<ResponseField name="addresses" type="array of strings" required>
  All Fuego addresses held in the wallet.
</ResponseField>

***

## deleteAddress

Removes an address from the wallet. This does not affect the keys of other addresses. Deleted addresses cannot be recovered unless you retained the spend secret key.

### Request

<ParamField body="params.address" type="string" required>
  The Fuego address to remove from the wallet.
</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": "deleteAddress",
      "params": {
        "address": "fireXfGAddressToDelete..."
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "deleteAddress",
    "params": {
      "address": "fireXfGAddressToDelete..."
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

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

An empty result object indicates success.

***

## getSpendKeys

Returns the spend key pair (secret and public) for a specific address. Use this to back up an address or extract keys for external signing.

### Request

<ParamField body="params.address" type="string" required>
  The Fuego address whose spend keys you want to retrieve.
</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": "getSpendKeys",
      "params": {
        "address": "fireXfGYourAddress..."
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "getSpendKeys",
    "params": {
      "address": "fireXfGYourAddress..."
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "spendSecretKey": "a1b2c3d4e5f6...",
    "spendPublicKey": "f1e2d3c4b5a6..."
  }
}
```

<ResponseField name="spendSecretKey" type="string" required>
  Hex-encoded spend secret key. Store this securely — anyone with this key can spend funds at this address.
</ResponseField>

<ResponseField name="spendPublicKey" type="string" required>
  Hex-encoded spend public key corresponding to the secret key.
</ResponseField>

***

## getViewKey

Returns the wallet's view secret key. The view key allows scanning the blockchain for incoming transactions without being able to spend them. Share this key only with trusted auditors.

### Request

<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": "getViewKey",
      "params": {},
      "id": "1"
    }'
  ```

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

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "viewSecretKey": "b2c3d4e5f6a7..."
  }
}
```

<ResponseField name="viewSecretKey" type="string" required>
  Hex-encoded view secret key for the wallet. This key is shared across all addresses in the wallet.
</ResponseField>

***

## createIntegrated

Combines a standard Fuego address with a payment ID into a single integrated address. Integrated addresses embed the payment ID so senders do not need to specify it separately — useful for exchanges and merchant payment flows.

### Request

<ParamField body="params.address" type="string" required>
  The base Fuego address to embed the payment ID into.
</ParamField>

<ParamField body="params.payment_id" type="string" required>
  A 64-character hex string representing the 32-byte payment ID to embed.
</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": "createIntegrated",
      "params": {
        "address": "fireXfGYourAddress...",
        "payment_id": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2"
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "createIntegrated",
    "params": {
      "address": "fireXfGYourAddress...",
      "payment_id": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2"
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "integrated_address": "fireIntegrated..."
  }
}
```

<ResponseField name="integrated_address" type="string" required>
  The combined integrated address encoding both the destination and payment ID.
</ResponseField>

***

## splitIntegrated

Decodes an integrated address back into its constituent standard address and payment ID.

### Request

<ParamField body="params.integrated_address" type="string" required>
  The integrated address to decode.
</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": "splitIntegrated",
      "params": {
        "integrated_address": "fireIntegrated..."
      },
      "id": "1"
    }'
  ```

  ```json Request theme={null}
  {
    "jsonrpc": "2.0",
    "method": "splitIntegrated",
    "params": {
      "integrated_address": "fireIntegrated..."
    },
    "id": "1"
  }
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "address": "fireXfGYourAddress...",
    "payment_id": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2"
  }
}
```

<ResponseField name="address" type="string" required>
  The standard Fuego address extracted from the integrated address.
</ResponseField>

<ResponseField name="payment_id" type="string" required>
  The 64-character hex payment ID extracted from the integrated address.
</ResponseField>
