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

# Mempool

> Query pending transactions waiting to be included in a block.

The mempool holds transactions that have been broadcast to the network but not yet confirmed in a block. Mempool data is real-time and changes frequently as transactions get picked up by miners.

## Get all mempool transactions

Returns all pending transactions currently in the mempool.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/mempool/transactions" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
[
  {
    "hash": "503a2c...",
    "chainFrom": 0,
    "chainTo": 0,
    "inputs": [
      {
        "hint": 714081,
        "key": "a1b2c3...",
        "unlockScript": "...",
        "txHashRef": "...",
        "address": "1DrDyTr9...",
        "attoAlphAmount": "2000000000000000000"
      }
    ],
    "outputs": [
      {
        "hint": 714081,
        "key": "d4e5f6...",
        "attoAlphAmount": "1000000000000000000",
        "address": "1XyzAbc...",
        "tokens": []
      }
    ],
    "gasAmount": 20000,
    "gasPrice": "100000000000",
    "scriptExecutionOk": true,
    "inputSignatures": [...],
    "scriptSignatures": []
  }
]
```

## Get mempool size

Returns the number of transactions currently waiting in the mempool.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/mempool/transactions/size" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
{
  "size": 12
}
```

## Check if a transaction is in the mempool

You can check transaction status using the transactions endpoint, if `type` is `MemPooled` the transaction is pending.

```bash theme={null}
curl "https://rpc.ralphstudio.xyz/{slug}/transactions/status?txId={tx-hash}&fromGroup=0&toGroup=0" \
  -H "Authorization: Bearer API_KEY"
```

```json theme={null}
{
  "type": "MemPooled"
}
```

## Remove transactions from the mempool

Removes specific transactions from the local mempool. This does not broadcast a cancellation to the network, the transaction may still be picked up by other nodes.

```bash theme={null}
curl -X DELETE "https://rpc.ralphstudio.xyz/{slug}/mempool/transactions" \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '["503a2c...", "604b3d..."]'
```

## Revalidate mempool transactions

Triggers the node to revalidate all transactions currently in the mempool against the current chain state.

```bash theme={null}
curl -X PUT "https://rpc.ralphstudio.xyz/{slug}/mempool/transactions/revalidate" \
  -H "Authorization: Bearer API_KEY"
```

## A note on mempool data

Mempool contents vary between nodes. A transaction visible in your node's mempool may not be visible in another node's mempool until it propagates through the network. For the most reliable confirmation tracking, poll the transaction status endpoint until `type` is `Confirmed`.

For production apps that need to track transaction confirmation, the recommended flow is:

1. Submit the transaction and save the `txId`
2. Poll `/transactions/status?txId={id}` every few seconds
3. Once `type` is `Confirmed` and `chainConfirmations` is at least `1`, treat the transaction as confirmed
4. For high-value transactions wait for at least `110` confirmations
