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

# Architecture Overview

> How a transaction moves through StableNet — from RPC submission to on-chain finality.

> StableNet preserves the go-ethereum core (EVM, StateDB, TxPool) and adds Anzeon WBFT consensus and five governance system contracts on top.

## Transaction flow

When you call `eth_sendRawTransaction`, a transaction passes through four stages before it is final:

```text theme={null}
1. RPC submission → txpool validation
2. Mining candidate selection
3. EVM execution → state change
4. Block seal → Anzeon WBFT consensus → finality
```

### 1. Submission and pool validation

The transaction pool (`txpool`) validates every incoming transaction before accepting it:

* Fee fields are well-formed (`maxFeePerGas` ≥ `maxPriorityFeePerGas`)
* Nonce matches the sender's current on-chain nonce (or is queued)
* For type `0x16`, both sender and fee payer signatures are present
* Gas tip meets the GovValidator-enforced minimum

Transactions that pass enter the **pending** pool. Those with nonce gaps or fee issues wait in the **queued** pool.

### 2. Block building

The miner worker selects pending transactions for the next block. Selection filters by:

* `baseFee` from the block header
* Governance gas tip from `GovValidator`

Transactions are ordered by effective gas price (highest first).

### 3. EVM execution and state transitions

Each transaction is applied to a `StateDB` snapshot:

* Sender balance decremented by `gasLimit × gasPrice`
* EVM executes the transaction
* Storage and balance changes are journaled
* On success: state changes are committed; unused gas refunded to the payer
* On revert: state rolls back to pre-execution snapshot; gas is still consumed

### 4. Block finality

StableNet uses Anzeon WBFT consensus. Blocks proceed through PREPARE → COMMIT → FINALIZATION. Once a block is committed by a quorum of validators, it is **final** — no reorgs occur under normal operation.

## State model

Every account in StableNet has five fields:

| Field         | Description                                            |
| ------------- | ------------------------------------------------------ |
| `nonce`       | Transaction count                                      |
| `balance`     | WKRC balance in wei (same value as `WKRC.balanceOf()`) |
| `codeHash`    | Contract bytecode hash (zero for EOAs)                 |
| `storageRoot` | Root of the account's storage trie                     |
| `extra`       | StableNet policy flags (blacklist, authorized)         |

State is stored as a Merkle Patricia Trie. The state root in each block header commits to the entire chain state at that point.

## Key developer implications

* **1-second finality**: you do not need to wait for multiple confirmations. One block = final.
* **Fee payer is invisible**: for type `0x16` transactions, `tx.origin` is always the sender. Contracts cannot detect that fee delegation was used.
* **WKRC gas = WKRC balance**: the same token balance used to pay gas is the ERC-20 balance. Holding WKRC for gas and for transfers is the same thing.
* **Nonce management**: pending transactions block later nonces. If a transaction is stuck, later transactions from the same address also wait.

## Developer benefits

* 1-second finality removes the need for confirmation polling in most use cases
* Standard Ethereum tooling (ethers.js, viem, Hardhat, Foundry) works without modification
* `balanceOf()` and gas balance are always in sync — no separate token bridging needed

## Related

* [What is StableNet](/en/v0.3/learn/what-is-stablenet) — high-level overview
* [Gas and Fees](/en/v0.3/learn/gas-and-fees) — fee calculation details
* [Transaction Types](/en/v0.3/reference/transaction-types) — type 0x02 and 0x16
