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

# Sending transactions

> Build, broadcast, and confirm transactions on Quantum Chain via JSON-RPC.

Quantum Chain accepts the same transaction shapes as Ethereum: **legacy**, **EIP-2930** (access list), and **EIP-1559** (fee market). The only difference from Ethereum is the signature primitive — see [Signing transactions](/quantum-chain/signing-transactions).

## Transaction fields

| Field                                  |              Required              | Notes                                                         |
| -------------------------------------- | :--------------------------------: | ------------------------------------------------------------- |
| `from`                                 |                 yes                | Sender address                                                |
| `to`                                   | yes (transfer / call); no (deploy) | 20-byte address or `null` for contract creation               |
| `value`                                |                 no                 | Amount in wei (default `0`)                                   |
| `data`                                 |                 no                 | Calldata for contract calls; constructor bytecode for deploys |
| `nonce`                                |                 yes                | Sender's next nonce; fetch with `eth_getTransactionCount`     |
| `chainId`                              |                 yes                | `20803` for mainnet                                           |
| `gas`                                  |                 yes                | Gas limit                                                     |
| `gasPrice`                             |             legacy only            | In wei                                                        |
| `maxFeePerGas`, `maxPriorityFeePerGas` |            EIP-1559 only           | In wei                                                        |
| `accessList`                           |              optional              | EIP-2930 access list                                          |

## Build and broadcast a legacy transaction

```javascript theme={null}
// ethers.js v6
import { JsonRpcProvider, Transaction, getBytes, hashMessage } from "ethers";

const provider = new JsonRpcProvider("https://api.quantumapi.io/v1/rpc");

const txData = {
  to: "0x1865476914c85900110Ffc6B092436366E98Db55",
  nonce: await provider.getTransactionCount(myAddress),
  gasLimit: 21_000n,
  gasPrice: await provider.getGasPrice(),
  value: 1_000_000_000_000_000_000n,    // 1 QRC
  chainId: 20803n,
  type: 0
};

// Sign with your post-quantum signer (custom integration; see Signing transactions)
const signed = await myPostQuantumSigner.signTransaction(txData);

// Broadcast
const txHash = await provider.send("eth_sendRawTransaction", [signed]);
console.log(txHash);
```

## Send via Qustody

If you use the [Qustody platform](/qustody/security-model), you do not build raw transactions yourself:

```bash theme={null}
curl -X POST "$BASE_URL/v1/transactions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "wallet_id": "...",
    "to_address": "0x1865...",
    "value": "1000000000000000000",
    "asset": "QRC"
  }'
```

Qustody handles nonce assignment, fee estimation, signing orchestration, and broadcasting. Your application listens for `transaction.broadcast` and `transaction.confirmed` webhooks.

## Fee estimation

Quantum Chain follows EIP-1559. Use:

| RPC method                 | Returns                            |
| -------------------------- | ---------------------------------- |
| `eth_gasPrice`             | Suggested legacy gas price         |
| `eth_maxPriorityFeePerGas` | Suggested tip for EIP-1559         |
| `eth_feeHistory`           | Recent base fees and priority tips |
| `eth_estimateGas`          | Gas units for a given call         |

```bash theme={null}
curl -s -X POST $RPC -H 'Content-Type: application/json' --data '{
  "jsonrpc":"2.0","method":"eth_feeHistory","id":1,
  "params":["0x10","latest",[25,50,75]]
}'
```

## Nonce management

The nonce is the count of transactions previously sent **from the same address**. Two rules:

1. Nonces must be sequential. Skipping a nonce parks all later transactions in the queued pool until the gap is filled.
2. Nonces from the latest mined block are returned by `eth_getTransactionCount(addr, "latest")`. To include pending transactions, use `"pending"`.

If you submit transactions from multiple processes, coordinate nonces in a shared store, or route everything through Qustody (which serializes nonces per wallet).

## Replacing or cancelling a stuck transaction

To replace a transaction that is stuck in the mempool:

1. Submit a new transaction with the **same nonce** and a higher `gasPrice` (or `maxFeePerGas` and `maxPriorityFeePerGas` for EIP-1559).
2. Both transactions race; the higher-fee one is mined.

To cancel, replace it with a self-transfer of zero value at a higher fee.

Through Qustody, use `POST /v1/transactions/{id}/cancel` while the transaction is still in `SUBMITTED`, `PENDING_AUTHORIZATION`, `APPROVED`, or `PENDING_SIGNATURE`. After it has been broadcast, you must do a fee-bump replacement on chain.

## Confirmation

```bash theme={null}
# Get the receipt (null until mined)
curl -s -X POST $RPC -H 'Content-Type: application/json' --data '{
  "jsonrpc":"2.0","method":"eth_getTransactionReceipt","id":1,
  "params":["0x..."]
}'
```

A transaction is **confirmed** when its block is followed by enough additional blocks that a reorg is unlikely. Mainnet recommendations:

| Use case                 |     Confirmations    |
| ------------------------ | :------------------: |
| Light dApp UX            |           1          |
| Default                  |           6          |
| High-value institutional | 12 (Qustody default) |
| Exchange deposits        |          30+         |

## Where to go next

* [Signing transactions](/quantum-chain/signing-transactions)
* [Operating a network](/quantum-chain/networks)
* [Qustody transaction lifecycle](/guides/transaction-lifecycle)
