# Flashblocks

## What is Flashblocks?

When you submit a transaction on GIWA, it is normally confirmed once it is included in a block. Since GIWA produces a block roughly every 1 second, this confirmation time can take up to one full block interval. (and may be longer during network congestion.)

Flashblocks improves this experience by providing preconfirmations—instant signals that arrive up to \~200ms after you send a transaction. Instead of waiting for the next block to be produced, users can receive fast feedback about whether their transaction is likely to be included.

Flashblocks does not create blocks faster. It simply gives you an earlier view of transaction status before the block is sealed.

This makes Flashblocks especially useful for:

* Wallets and web services that want immediate transaction feedback
* Payment services that want fast checkout experiences
* Games and real-time applications that require responsive UX

## Using Flashblocks

Flashblocks RPC works just like the standard Ethereum JSON-RPC interface. To use it, your RPC provider must support Flashblocks mode—these are called Flashblocks-aware RPC endpoints.

### Flashblocks-aware RPC

GIWA provides Flashblocks-aware RPC endpoints for development and testing:

<table><thead><tr><th width="273.752685546875">Network</th><th>Endpoint</th></tr></thead><tbody><tr><td>GIWA Testnet (Sepolia)</td><td>​<a href="https://sepolia-rpc-flashblocks.giwa.io/">https://sepolia-rpc-flashblocks.giwa.io</a>​</td></tr><tr><td>GIWA Mainnet</td><td>🚧 Coming soon</td></tr></tbody></table>

{% hint style="warning" %}
The endpoint above is intended for development and testing and is rate-limited. For production applications, we recommend using an external node provider or [running your own Flashblocks-aware RPC node](https://github.com/giwa-io/node#flashblocks-optional).
{% endhint %}

### Supported RPC Methods

Below are common RPC methods that support Flashblocks. Most methods use the `pending` block tag to return data from the latest flashblock state.

#### `eth_call`

Executes a smart contract call against the latest flashblock state using the `pending` tag.

**Request**

```bash
curl https://sepolia-rpc-flashblocks.giwa.io \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_call",
    "params": [{"to": "0x...", "data": "0x..."}, "pending"],
    "id": 1
  }'
```

**Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x0000000000000000000000000000000000000000000000000000000000000001"
}
```

#### `eth_estimateGas`&#x20;

Estimates gas usage based on the latest flashblock state using the `pending` tag.

**Request**

```bash
curl https://sepolia-rpc-flashblocks.giwa.io \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [{"to": "0x...", "data": "0x..."},"pending"],
    "id": 1
  }'
```

**Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x9425"
}
```

#### `eth_getBalance`&#x20;

Returns an address’s balance in the latest flashblock state using the `pending` tag.

**Request**

```bash
curl https://sepolia-rpc-flashblocks.giwa.io \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": ["0x...", "pending"],
    "id": 1
  }'
```

**Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1234"
}
```

#### `eth_getBlockByNumber`&#x20;

Retrieves the most recent flashblock when `pending` is used.

**Request**

```bash
curl https://sepolia-rpc-flashblocks.giwa.io \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getBlockByNumber",
    "params": ["pending", true],
    "id": 1
  }'
```

**Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "number": "0x1234",
    "hash": "0x..",        // Even for the same block, the hash may change if the set of preconfirmed transactions changes
    "transactions": [...], // All preconfirmed transactions included in the flashblock
    "stateRoot": "0x...",
    "gasUsed": "0x...",
    "timestamp": "0x..."
  }
}
```

#### `eth_getLogs`&#x20;

Retrieves logs from the latest flashblock state using the `pending` tag.

**Request**

```bash
curl https://sepolia-rpc-flashblocks.giwa.io \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getLogs",
    "params": [{"fromBlock": "latest", "toBlock": "pending", "address": "0x...", "topics": ["0x..."]}],
    "id": 1
  }'
```

**Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "address": "0x...",
      "topics": ["0x..."],
      "data": "0x...",
      "blockNumber": "0x1234",
      "transactionHash": "0x...",
      "transactionIndex": "0x0",
      "blockHash": "0x...",
      "logIndex": "0x0",
      "removed": false
    }
  ]
}
```

#### `eth_getTransactionCount`&#x20;

Returns the nonce of an address from the latest flashblock state using the `pending` tag.

**Request**

```bash
curl https://sepolia-rpc-flashblocks.giwa.io \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionCount",
    "params": ["0x...", "pending"],
    "id": 1
  }'
```

**Response**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x12"
}
```

#### `eth_getTransactionByHash`&#x20;

Returns transaction information based on a hash, including flashblock-specific details.

**Request**

```bash
curl https://sepolia-rpc-flashblocks.giwa.io \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionByHash",
    "params": ["0x..."],
    "id": 1
  }'
```

**Response**

```json
{
	"jsonrpc": "2.0",
	"result": {
		"blockHash": "0x...",
		"blockNumber": "0x1234",
		"chainId": "0x164ce",
		"nonce": "0x23",
		"transactionIndex": "0x3",
		"type": "0x2",
	},
	"id": 1
}
```

#### `eth_getTransactionReceipt`&#x20;

Returns a transaction receipt from the flashblock state (preconfirmed).

**Request**

```bash
curl https://sepolia-rpc-flashblocks.giwa.io \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionReceipt",
    "params": ["0x..."],
    "id": 1
  }'
```

**Response**

```json
{
  "jsonrpc": "2.0",
  "result": {
    "transactionHash": "0x...",
    "blockNumber": "0x1234",
    "status": "0x1"
  },
  "id": 1
}
```

#### `eth_simulateV1`

Simulates transactions using the latest flashblock state.

**Request**

```bash
curl https://sepolia-rpc-flashblocks.giwa.io \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_simulateV1",
    "params": [{"blockStateCalls": [{"calls": [{"to": "0x...", "data": "0x..."}], "stateOverrides":{}}], "traceTransfers":true, "validation":true}, "pending"],
    "id": 1
  }'
```

**Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "calls": [
        {
          "status": "0x1",
          "gasUsed": "0x1234",
          "returnData": "0x"
        }
      ]
    }
  ],
  "id": 1
}
```

## Learn more

Check out the [OP Stack developer docs](https://docs.optimism.io/op-stack/features/flashblocks) for further details.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.giwa.io/giwa-chain/en/network-information/flashblocks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
