---
title: "Execution, gas and fees"
description: "ExecutorV3 transaction validation and execution pipeline, Gas counter formula, USDTE fee calculation, FailedTx rule without Nonce increment, non-BIP gas coins, and all 48 tariff fields."
track: "protocol"
lang: "en"
protocol: "Minter v3.3.0"
consensus: "Tendermint v0.34.19 + IAVL v0.17.3"
canonical_url: "https://docs.minter.network/protocol/execution-and-fees"
raw_markdown_url: "https://docs.minter.network/protocol/execution-and-fees.md"
---

# Execution, gas and fees

> ExecutorV3 transaction validation and execution pipeline, Gas counter formula, USDTE fee calculation, FailedTx rule without Nonce increment, non-BIP gas coins, and all 48 tariff fields.

`ExecutorV3` (`coreV2/transaction/executor_v3.go`) separates mempool admission (`CheckTx`) from sequential block state application (`DeliverTx`). The computational `Gas` counter and the monetary commission are calculated by distinct formulas.

## `ExecutorV3` preconditions and `FailedTx` semantics

Before calling a handler, `ExecutorV3` validates outer envelope limits (`executor_v3.go:28-175`):

- serialized transaction length `len(rawSignedTxBytes) <= 16,144` bytes (`maxTxLength`);
- `len(Payload) <= 10,000` bytes and `len(ServiceData) <= 128` bytes;
- `ChainID == CurrentChainID`, `GasPrice >= 1` (`>= minGasPrice` in `CheckTx`), and `GasCoin` existence in state;
- `tx.Nonce == Accounts.GetNonce(sender) + 1`;
- for multisig (`0x02`), `len(signatures) <= 32`, unique recovered signer addresses (`DuplicatedAddresses` on duplicates), membership on the multisig account, and `sum(weights) >= Threshold`.

| Stage and outcome | Fee deducted | `Nonce` change | State effect |
| :--- | :--- | :--- | :--- |
| Envelope, signature, or `Nonce` rejection before `handler.Run` | `0 pip` | Unchanged | No `IAVL` or mempool change |
| Handler failure in `CheckTx` | `0 pip` | Unchanged | Rejected from mempool; sender mempool slot stays free |
| Handler failure in `DeliverTx` (`FailedTx`, `code != 0`) | `min(balance, (price.FailedTx + bytes * price.PayloadByte) * GasPrice)` | Unchanged (`executor_v3.go:212`) | Operation state does not apply; emits `tx.fail="1"` and `tx.fail_fee` |
| Successful `DeliverTx` (`code == 0`) | Full operation tariff in `CommissionCoin` | `SetNonce(tx.Nonce)` (`+1`) | Mutations commit to `IAVL`; commission enters `rewardPool` |

> **[warn] FailedTx does not increment sender Nonce**
> When a transaction passes `CheckTx` and fails during `DeliverTx` (`code != 0`, for instance `MinimumValueToBuyReached` after an earlier swap in the same block), `ExecutorV3` deducts the `FailedTx` fee and skips `SetNonce`. Clients must reuse the same `Nonce` or re-read `transaction_count` from `GET /v2/address/{address}` before retrying. Pass `?failed_txs=true` to `GET /v2/block/{height}` to include failed block transactions. For `RedeemCheck (0x09)`, `issuer` pays `FailedTx` when the check decodes and the issuer signature recovers.

## `Gas` counter and monetary fee formulas

The `Gas` counter (`executor_v3.go:177`) bounds per-block computational weight (`MaxGas`) and does not multiply the monetary fee:

```text
bytes = len(Payload) + len(ServiceData)
Gas   = 15 + handler.Gas + (1 if CommissionCoin != 0 else 0) + floor(bytes / 1000) + 20 * len(multisigSignatures)
```

Monetary cost is first computed in the schedule anchor coin `price.Coin` (`USDTE`, `CoinID = 1993` on Mainnet; on the W2.2 public Testnet `genesis.commission.coin = 0`, so tariffs are denominated directly in `MNT`, `CoinID = 0`):

```text
totalPriceInTariffCoin = (handler.CommissionData(price) + bytes * price.PayloadByte) * GasPrice
```

If `handler.Run` fails in `DeliverTx`, `price.FailedTx` replaces `handler.CommissionData(price)`:

```text
failedFeeInTariffCoin = (price.FailedTx + bytes * price.PayloadByte) * GasPrice
chargedFailedFee      = min(senderBalanceInCommissionCoin, convertToCommissionCoin(failedFeeInTariffCoin))
```

## Paying fees in non-BIP coins

The `GasCoin` (`uint32`) envelope field allows paying transaction fees with `0 BIP` balance:

1. On Mainnet, `price.Coin` is `USDTE (1993)` (`!= 0`), so the node first converts `totalPriceInTariffCoin` into `BIP` through the order-aware `USDTE / BIP` pool (`PairV2`). On the public Testnet (`chainId = 2`), `price.Coin` is the native base coin `MNT (CoinID = 0)`, so tariffs are already denominated in `MNT` without a `USDTE` conversion hop (while `USDTE (1993)` and the `MNT/USDTE` pool are seeded in genesis for DEX testing).
2. When `CommissionCoin == 0` (`BIP` on Mainnet, `MNT` on Testnet), that base coin amount is deducted directly from the sender and added to `rewardPool`.
3. When `CommissionCoin != 0`, `CalculateCommission` (`sell_all_swap_pool_v230.go:275`) compares the cost of buying the required `BIP` via the order-aware `{CommissionCoin, BIP}` pool against the coin's `CRR` reserve (when both exist, the lower cost in `CommissionCoin` is selected; ties prefer the pool). Non-reserve tokens without a direct `{token, BIP}` pool are rejected during fee estimation.
4. When a swap or liquidity transaction pays fees through the same `{CommissionCoin, BIP}` pool it trades against, the reserve change from fee deduction applies first (`AddLastSwapStepWithOrders` / `DummyCoin`).
5. `SellAllCoin (0x03)` and `SellAllSwapPool (0x19)` always deduct commission from the sold coin (`CoinToSell` or `Coins[0]`) regardless of `tx.GasCoin`. `RedeemCheck (0x09)` deducts `price.RedeemCheck` in `check.GasCoin` from `issuer`.

> **[warn] Testnet monthly reset and Nonce restart**
> On the public Testnet (`chainId = 2`, base coin `0 = MNT`, `https://gate-api.testnet.minter.network/v2`), all state resets on the 1st of every month to a new epoch `minter-testnet-YYYYMM` (`https://testnet.minter.network/status.json`). Because `ChainID` stays `2` while every user account's `Nonce` resets to `0`, previously signed transactions for a reused user `Mx...` address can be replayed across epochs once funded again; rotate test mnemonics each month.

## Interactive gas and fee estimator

## Complete 48 tariff fields of `VoteCommissionDataV3` (`USDTE`)

On Mainnet, `GET /v2/price_commissions` quotes tariffs in `USDTE` (`coin.id = "1993"`, `1 USDTE = 10^18 pip`); on the W2.2 public Testnet it quotes tariffs in `MNT` (`coin.id = "0"`, `1 MNT = 10^18 pip`). All `48` tariff fields below appear in their exact RLP struct order inside `VoteCommissionDataV3` (`0x20`, RLP indices `3..50` following `PubKey`, `Height`, `Coin`):

| # (`RLP`) | JSON key (`/v2/price_commissions`) | Go `price.*` field | `USDTE` value | Exact `pip` (`10^18`) | Applies to |
| :--- | :--- | :--- | :--- | :--- | :--- |
| 1 (`3`) | `payload_byte` | `PayloadByte` | `$0.0002` | `200000000000000` | Per byte of `Payload` + `ServiceData` |
| 2 (`4`) | `send` | `Send` | `$0.01` | `10000000000000000` | `0x01 Send` |
| 3 (`5`) | `buy_bancor` | `BuyBancor` | `$0.03` | `30000000000000000` | `0x04 BuyCoin` |
| 4 (`6`) | `sell_bancor` | `SellBancor` | `$0.03` | `30000000000000000` | `0x02 SellCoin` |
| 5 (`7`) | `sell_all_bancor` | `SellAllBancor` | `$0.03` | `30000000000000000` | `0x03 SellAllCoin` |
| 6 (`8`) | `buy_pool_base` | `BuyPoolBase` | `$0.03` | `30000000000000000` | `0x18 BuySwapPool` (1 pool) |
| 7 (`9`) | `buy_pool_delta` | `BuyPoolDelta` | `$0.005` | `5000000000000000` | `0x18` per extra pool hop |
| 8 (`10`) | `sell_pool_base` | `SellPoolBase` | `$0.03` | `30000000000000000` | `0x17 SellSwapPool` (1 pool) |
| 9 (`11`) | `sell_pool_delta` | `SellPoolDelta` | `$0.005` | `5000000000000000` | `0x17` per extra pool hop |
| 10 (`12`) | `sell_all_pool_base` | `SellAllPoolBase` | `$0.03` | `30000000000000000` | `0x19 SellAllSwapPool` (1 pool) |
| 11 (`13`) | `sell_all_pool_delta` | `SellAllPoolDelta` | `$0.005` | `5000000000000000` | `0x19` per extra pool hop |
| 12 (`14`) | `create_ticker3` | `CreateTicker3` | `$50,000` | `50000000000000000000000` | `0x05` / `0x1E` (3-char symbol) |
| 13 (`15`) | `create_ticker4` | `CreateTicker4` | `$10,000` | `10000000000000000000000` | `0x05` / `0x1E` (4-char symbol) |
| 14 (`16`) | `create_ticker5` | `CreateTicker5` | `$2,000` | `2000000000000000000000` | `0x05` / `0x1E` (5-char symbol) |
| 15 (`17`) | `create_ticker6` | `CreateTicker6` | `$400` | `400000000000000000000` | `0x05` / `0x1E` (6-char symbol) |
| 16 (`18`) | `create_ticker7_10` | `CreateTicker7to10` | `$100` | `100000000000000000000` | `0x05` / `0x1E` (7..10-char symbol) |
| 17 (`19`) | `create_coin` | `CreateCoin` | `$0` | `0` | Added to `PayForSymbol` in `0x05` and `0x1E` (`create_token.go:90`) |
| 18 (`20`) | `create_token` | `CreateToken` | `$0` | `0` | Present in `Price` struct (unused in `create_token.go:90`) |
| 19 (`21`) | `recreate_coin` | `RecreateCoin` | `$100` | `100000000000000000000` | `0x10 RecreateCoin` |
| 20 (`22`) | `recreate_token` | `RecreateToken` | `$100` | `100000000000000000000` | `0x1F RecreateToken` |
| 21 (`23`) | `declare_candidacy` | `DeclareCandidacy` | `$10` | `10000000000000000000` | `0x06 DeclareCandidacy` |
| 22 (`24`) | `delegate` | `Delegate` | `$0.10` | `100000000000000000` | `0x07 Delegate` |
| 23 (`25`) | `unbond` | `Unbond` | `$0.10` | `100000000000000000` | `0x08 Unbond` |
| 24 (`26`) | `redeem_check` | `RedeemCheck` | `$0.03` | `30000000000000000` | `0x09 RedeemCheck` (paid by `issuer`) |
| 25 (`27`) | `set_candidate_on` | `SetCandidateOn` | `$0.10` | `100000000000000000` | `0x0A SetCandidateOn` |
| 26 (`28`) | `set_candidate_off` | `SetCandidateOff` | `$0.10` | `100000000000000000` | `0x0B SetCandidateOff` |
| 27 (`29`) | `create_multisig` | `CreateMultisig` | `$0.10` | `100000000000000000` | `0x0C CreateMultisig` |
| 28 (`30`) | `multisend_base` | `MultisendBase` | `$0.01` | `10000000000000000` | `0x0D Multisend` (1st recipient) |
| 29 (`31`) | `multisend_delta` | `MultisendDelta` | `$0.005` | `5000000000000000` | `0x0D` per additional recipient (`N - 1`) |
| 30 (`32`) | `edit_candidate` | `EditCandidate` | `$0.10` | `100000000000000000` | `0x0E EditCandidate` |
| 31 (`33`) | `set_halt_block` | `SetHaltBlock` | `$0.10` | `100000000000000000` | `0x0F SetHaltBlock` |
| 32 (`34`) | `edit_ticker_owner` | `EditTickerOwner` | `$100` | `100000000000000000000` | `0x11 EditCoinOwner` |
| 33 (`35`) | `edit_multisig` | `EditMultisig` | `$0.10` | `100000000000000000` | `0x12 EditMultisig` |
| 34 (`36`) | `edit_candidate_public_key` | `EditCandidatePublicKey` | `$1,000` | `1000000000000000000000` | `0x14 EditCandidatePublicKey` |
| 35 (`37`) | `create_swap_pool` | `CreateSwapPool` | `$10` | `10000000000000000000` | `0x22 CreateSwapPool` |
| 36 (`38`) | `add_liquidity` | `AddLiquidity` | `$0.10` | `100000000000000000` | `0x15 AddLiquidity` |
| 37 (`39`) | `remove_liquidity` | `RemoveLiquidity` | `$0.10` | `100000000000000000` | `0x16 RemoveLiquidity` |
| 38 (`40`) | `edit_candidate_commission` | `EditCandidateCommission` | `$10` | `10000000000000000000` | `0x1A EditCandidateCommission` |
| 39 (`41`) | `mint_token` | `MintToken` | `$0.10` | `100000000000000000` | `0x1C MintToken` |
| 40 (`42`) | `burn_token` | `BurnToken` | `$0.10` | `100000000000000000` | `0x1D BurnToken` |
| 41 (`43`) | `vote_commission` | `VoteCommission` | `$0.10` | `100000000000000000` | `0x20 VoteCommission` |
| 42 (`44`) | `vote_update` | `VoteUpdate` | `$0.10` | `100000000000000000` | `0x21 VoteUpdate` |
| 43 (`45`) | `failed_tx` | `FailedTx` | `$0.01` | `10000000000000000` | `handler.Run` failure in `DeliverTx` |
| 44 (`46`) | `add_limit_order` | `AddLimitOrder` | `$0.10` | `100000000000000000` | `0x23 AddLimitOrder` |
| 45 (`47`) | `remove_limit_order` | `RemoveLimitOrder` | `$0.01` | `10000000000000000` | `0x24 RemoveLimitOrder` |
| 46 (`48`) | `move_stake` | `MoveStake` | `$0.10` | `100000000000000000` | `0x1B MoveStake` |
| 47 (`49`) | `lock_stake` | `LockStake` | `$0.10` | `100000000000000000` | `0x25 LockStake` |
| 48 (`50`) | `lock` | `Lock` | `$0.01` | `10000000000000000` | `0x26 Lock` |
