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

# Fuego RPC API Overview and Authentication

> Overview of the Fuego daemon RPC (port 18180) and wallet service RPC (port 8070): request format, error codes, security flags, and a full method index.

The Fuego node suite exposes two independent RPC servers that you interact with as a developer: the **Daemon RPC** for low-level blockchain and network operations, and the **Wallet Service RPC** (`walletd`) for all wallet and account management tasks. Both servers communicate over HTTP using JSON, and neither requires authentication when bound to localhost — you control access through bind address and flag configuration rather than API keys or tokens.

## API Servers

<CardGroup cols={2}>
  <Card title="Daemon RPC" icon="server">
    HTTP and JSON-RPC server built into the `fuegod` daemon.

    **Default base URL:** `http://127.0.0.1:18180`

    Used for: node status, block queries, transaction submission, peer info, and mining templates.
  </Card>

  <Card title="Wallet Service RPC" icon="wallet">
    JSON-RPC 2.0 server provided by `walletd` (PaymentGateService).

    **Default base URL:** `http://127.0.0.1:8070`

    Used for: address management, balance queries, sending transactions, deposits, and wallet state.
  </Card>
</CardGroup>

## Request Format

The Daemon RPC serves two request styles:

* **Direct HTTP** — plain `GET` or `POST` to named paths (e.g. `/getinfo`, `/getheight`).
* **JSON-RPC 2.0** — `POST` to `/json_rpc` with a standard JSON-RPC envelope.

The Wallet Service accepts **only JSON-RPC 2.0** requests posted to `/json_rpc`.

A JSON-RPC 2.0 request looks like this:

```json theme={null}
{
  "jsonrpc": "2.0",
  "method": "getblockcount",
  "params": {},
  "id": "1"
}
```

A successful response:

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "count": 900000,
    "status": "OK"
  }
}
```

An error response:

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": "1",
  "error": {
    "code": -32600,
    "message": "Invalid Request"
  }
}
```

## Authentication and Security

By default, both servers bind to `127.0.0.1` and require no credentials. To expose them on a network interface, use `--rpc-bind-ip` on the daemon. Pass `--restricted-rpc` to disable mutating methods (mining start/stop, daemon shutdown) when exposing the daemon publicly.

```bash theme={null}
# Expose daemon on all interfaces, restricted to read-only methods
fuegod --rpc-bind-ip=0.0.0.0 --restricted-rpc
```

## Daemon JSON-RPC Methods (`/json_rpc`)

These methods are called via `POST http://127.0.0.1:18180/json_rpc`:

| Method                   | Description                                 |
| ------------------------ | ------------------------------------------- |
| `getblockcount`          | Returns the current blockchain height       |
| `getblockhash`           | Returns the block hash at a given height    |
| `getblocktemplate`       | Returns a block template for mining         |
| `getcurrencyid`          | Returns the currency ID blob                |
| `submitblock`            | Submits a mined block blob                  |
| `getlastblockheader`     | Returns the header of the most recent block |
| `getblockheaderbyhash`   | Returns a block header by its hash          |
| `getblockheaderbyheight` | Returns a block header by its height        |

## Daemon HTTP Endpoints

These endpoints are called via `GET` or `POST` directly:

| Endpoint              | Method | Description                                   |
| --------------------- | ------ | --------------------------------------------- |
| `/getinfo`            | GET    | Node status, height, difficulty, peer counts  |
| `/getheight`          | GET    | Current blockchain height                     |
| `/getpeers`           | GET    | Connected peer list                           |
| `/getfeeaddress`      | GET    | Node operator fee address                     |
| `/gettransactions`    | POST   | Fetch transactions by hash                    |
| `/sendrawtransaction` | POST   | Broadcast a signed raw transaction            |
| `/json_rpc`           | POST   | JSON-RPC 2.0 gateway for all JSON-RPC methods |

## Wallet Service JSON-RPC Methods (`/json_rpc`)

These methods are called via `POST http://127.0.0.1:8070/json_rpc`:

| Method                 | Description                               |
| ---------------------- | ----------------------------------------- |
| `getStatus`            | Wallet sync status and counts             |
| `createAddress`        | Generate a new address in the wallet      |
| `createAddressList`    | Batch-import addresses from spend keys    |
| `getAddresses`         | List all addresses in the wallet          |
| `deleteAddress`        | Remove an address from the wallet         |
| `getBalance`           | Available and locked balances             |
| `getBlockHashes`       | Block hashes starting from an index       |
| `getTransactionHashes` | Transaction hashes grouped by block       |
| `getTransactions`      | Full transaction details grouped by block |
| `getTransaction`       | Single transaction by hash                |
| `sendTransaction`      | Construct and broadcast a transaction     |
| `createDeposit`        | Lock XFG for a time deposit               |
| `sendDeposit`          | Create a deposit to an external address   |
| `withdrawDeposit`      | Unlock a matured deposit                  |
| `getDeposit`           | Query deposit details by ID               |
| `createIntegrated`     | Combine address and payment ID            |
| `splitIntegrated`      | Decode an integrated address              |
| `getViewKey`           | Return the wallet view secret key         |
| `getSpendKeys`         | Return spend keys for an address          |
| `exportWallet`         | Export wallet to a file                   |
| `save`                 | Flush wallet state to disk                |
| `reset`                | Rescan the blockchain from a given height |

## Quick Start Example

```bash theme={null}
curl http://127.0.0.1:18180/getinfo
```

```bash theme={null}
curl -s http://127.0.0.1:18180/json_rpc \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","method":"getblockcount","params":{},"id":"1"}'
```
