# Minter Network v3.3.0 — Complete Reference Corpus (EN) > Minter v3.3.0 (Tendermint v0.34.19 + IAVL v0.17.3, Chain ID 1). Articles: 35. Accounting unit: 1 coin = 10^18 pip. ## Users (earn) ### Getting started URL: https://docs.minter.network/earn Summary: Browser guides for using Minter without code: Minter Console wallet setup, coin delegation, 3-year LockStake, liquidity pools, limit orders, and the Minter Hub bridge with limits and risks. These guides are for people who use Minter in a browser and do not write code. You perform every action in [Minter Console](https://console.minter.network/) and check balances, transaction status, and reward history in [Minter Explorer](https://explorer.minter.network/). Start with [Wallet and seed phrase](https://docs.minter.network/earn/wallet): the remaining guides assume you have created an `Mx...` address and backed up your 12-word recovery phrase offline. Every transaction in Minter reaches finality in one block (nominally `5` seconds) with no extra confirmations required. Network fee tariffs are denominated in US dollars (`$0.01` for a standard transfer without a message), and you can pay fees in any coin that has a liquid pool paired with `BIP`, even when your `BIP` balance is zero. ## First steps in the browser 1. Create a dedicated `Mx...` address in [Minter Console](https://console.minter.network/) and record all 12 words of your seed phrase on paper ([wallet and multisig setup](https://docs.minter.network/earn/wallet)). 2. Fund the wallet through a direct transfer, an `Mc...` check, or a cross-chain deposit of `USDT`, `USDC`, `ETH`, and `BNB` in **Deposit & Withdraw** ([transfers, swaps and checks](https://docs.minter.network/earn/minter-console)). 3. If your wallet holds `0 BIP`, switch on **Advanced Mode** and pick your funded liquid coin (`USDTE`, `USDTBSC`, or `HUB`) in **Coin to Pay Fee**. 4. Before swapping coins or entering a liquidity pool, verify the immutable numeric coin ID in [Minter Explorer](https://explorer.minter.network/) (`BIP = 0`, `HUB = 1902`, `USDTE = 1993`, `USDCE = 1994`, `ETH = 2065`, `BNB = 2107`, `USDTBSC = 3494`). ## Five core network tools | Tool | How returns or savings work | Lock period | Limits and risks | Guide | | :--- | :--- | :--- | :--- | :--- | | Coin delegation | Share of block emissions and transaction fees (after `10%` to the DAO, `10%` to protocol developers, and your validator's commission); added to your `BIP` stake every `720` blocks (about 1 hour) | Withdrawal (`Unbond`) takes `518,400` blocks (about 30 days); switching validators (`MoveStake`) takes `134,400` blocks (about 7.8 days) | `5%` stake burn on validator double-signing; `17,280`-block (about 24-hour) reward pause if validator misses `> 12` of `24` blocks; displacement to `Waitlist` outside top `1,000` slots; `518,400`-block unbond if validator drops out of top `100` candidates | [Delegation, rewards and unbonding](https://docs.minter.network/earn/delegation) | | 3-year `LockStake` | `×3` weight applied only to the protected base block emission (`safeReward`); transaction fees and extra emission accrue without the `×3` multiplier | `18,921,600` blocks (about `1,095` days, or 3 years at `5` s per block) across all stakes on the address | Cannot be canceled early; sending `LockStake` again restarts a full `18,921,600`-block lock from the current block; validator slashing and downtime risks still apply (`MoveStake` remains allowed) | [LockStake for 3 years](https://docs.minter.network/earn/lock-stake) | | Liquidity pools | Deposit two coins `50% / 50%` by value and receive a proportional share of the `0.2%` swap fee inside your pool `LP` token | None: remove liquidity in any block (`$0.10` fee) | Impermanent loss when the pair's relative price shifts (`-5.7%` vs holding on a `2×` move); issuer depeg risk on bridged stablecoins; copycat tickers if numeric coin ID is not checked | [Liquidity pools and limit orders](https://docs.minter.network/earn/liquidity-pools-and-dex) | | Limit orders | Pending buy or sell order at a chosen price inside a pool's order book (`$0.10` to place, `$0.01` to cancel) | Cancel anytime; unfilled orders expire automatically after `483,840` blocks (about 28 days) | Limit price cannot cross the current pool price or sit more than `5×` away from it; minimum size `0.00000001` coin (`10^10 pip`); swaps routed through order-book pools also pay `~0.1%` to the burn address | [Limit orders](https://docs.minter.network/earn/liquidity-pools-and-dex#limit-orders) | | Minter Hub bridge | Move tokens between Minter, Ethereum, and BNB Smart Chain; holding `1` to `32 HUB` cuts the bridge fee by `10%` to `60%` (from `1.0%` down to `0.4%`) | None: `HUB` on your address and in Minter pools counts automatically | Withdraw only to your own non-custodial `0x...` wallet (`MetaMask`, `Rabby`, `Trust Wallet`), not to an exchange or smart contract; cross-chain bridge infrastructure risk (`16` oracles) plus external gas fees | [Minter Hub bridge](https://docs.minter.network/earn/cross-chain-and-hub) | Before moving larger balances, check the custody checklist in [Safety and FAQ](https://docs.minter.network/earn/faq-and-safety#wallet-safety), or open [Create a coin without code](https://docs.minter.network/earn/loyalty-and-custom-coins) if you want to issue loyalty points for a business or community. ### Wallet and seed phrase URL: https://docs.minter.network/earn/wallet Summary: Creating a personal Mx... address in Minter Console, storing a 12-word seed phrase offline, keeping MetaMask keys separate from browser sessions, and setting up a 2-of-3 multisig wallet. To hold coins and sign transactions in Minter, create a personal `Mx...` address in [Minter Console](https://console.minter.network/) and write down your 12-word seed phrase offline before sending any funds to the wallet. ## Creating an `Mx...` address 1. Open [Minter Console](https://console.minter.network/) in your browser and check the domain in the address bar. 2. Under the new wallet section, click **Generate Address**. 3. Write down all 12 English words of the seed phrase in exact order on paper or store them in an encrypted offline password vault before funding the new `Mx...` address. 4. Sign in to Minter Console with the saved 12 words and copy your `Mx...` address at the top of the **Wallet** tab. No server or support desk stores a copy of your seed phrase or can reset it: if you lose the 12 words, access to the `Mx...` address cannot be restored, and anyone who sees the phrase has full control over its balances. See the full security checklist in [Safety and FAQ](https://docs.minter.network/earn/faq-and-safety#wallet-safety). > **[warn] Create a separate seed phrase for browser use** > A 12-word seed phrase from `MetaMask`, `Rabby`, or `Trust Wallet` is technically compatible with Minter Console because Minter, Ethereum, and BNB Smart Chain derive keys using the same address format (the characters after `Mx` match the characters after `0x`). However, typing your primary wallet seed phrase into a web browser exposes your Ethereum and BNB Smart Chain assets to that browser session. If your main wallet holds funds on external networks, generate a separate 12-word phrase dedicated to Minter. ## Shared wallet with multiple signatures A multisig wallet is a shared `Mx...` address controlled by multiple personal addresses (up to `32` participants). Each participant receives a voting weight (`1` to `1,023`), and the wallet defines an approval `Threshold`: the minimum combined weight of signatures required to authorize any outgoing transaction. The threshold cannot exceed the total weight of all participants. For significant personal, family, or team balances, use a `2`-of-`3` configuration (three keys stored on separate devices, each with weight `1`, and threshold `2`). Compromising a single computer or phone is not enough to move funds, and if one of the three keys is lost, the remaining two keys still reach threshold `2` and can transfer the balance to a new wallet. A `2`-of-`2` setup is riskier because losing either device locks the multisig balance with no way to recover it. You can also assign unequal weights: for example, giving one address weight `2` and a second address weight `1` with threshold `2` lets the first participant spend alone while requiring co-signing for the second participant. 1. Open **Multisig Address** in [Minter Console](https://console.minter.network/). 2. Enter each participant's `Mx...` address, assign each weight, and set the required **Threshold** (for example, three addresses with weight `1` each and threshold `2`). 3. Click **Create** and confirm the transaction (`$0.10` network fee). 4. Search for the new multisig `Mx...` address in [Minter Explorer](https://explorer.minter.network/) to verify the participant addresses, weights, and threshold on chain. ### Transfers, swaps and checks URL: https://docs.minter.network/earn/minter-console Summary: Funding an Mx... wallet, sending single and Multisend transfers, calculating the full cost of pool swaps, and issuing or redeeming Mc... checks in Minter Console. After signing in to your [wallet](https://docs.minter.network/earn/wallet) in [Minter Console](https://console.minter.network/), you can fund your balance, send single or batch transfers, swap coins, and issue `Mc...` checks that recipients can redeem on a wallet with zero `BIP`. ## Funding your wallet You can fund an `Mx...` address by receiving a direct Minter transfer, redeeming an `Mc...` check in **Checks**, or bridging `USDT`, `USDC`, `ETH`, and `BNB` from Ethereum or BNB Smart Chain through **Deposit & Withdraw** (see [Minter Hub bridge](https://docs.minter.network/earn/cross-chain-and-hub#deposit) for step-by-step instructions). You do not need `BIP` before making your first transaction: once a liquid asset such as `USDTE` (`ID 1993`), `USDTBSC` (`ID 3494`), or `HUB` (`ID 1902`) lands on an empty `Mx...` address, you can select that coin to pay the fee for transfers or swaps. ## Sending transfers and batch payouts A standard transfer without a message costs `$0.01`. Attaching a text message adds `$0.0002` per UTF-8 byte (up to `10,000` bytes). 1. Open the **Wallet** tab in [Minter Console](https://console.minter.network/). 2. Paste the recipient's `Mx...` address, select the coin from your balance, and enter the amount (**Use Max** automatically subtracts the network fee). 3. Switch on **Advanced Mode** if you want to attach a note in **Message** or change **Coin to Pay Fee** from `BIP` to another liquid coin such as `USDTE` or `HUB`. 4. Click **Send**, confirm the transaction, and verify its `Mt...` transaction hash on your address page in [Minter Explorer](https://explorer.minter.network/). To pay up to `100` recipients in a single transaction, open the **Multisend** form inside **Wallet**, enter the list of `Mx...` addresses and amounts, and submit them together for `$0.01` on the first recipient plus `$0.005` for each additional recipient. ## Swapping coins and full swap cost The **Swap** section offers three forms: **Sell Coins** to spend an exact input amount, **Buy Coins** to receive an exact output amount, and **Sell All Coins** to convert the entire remaining balance of an asset without leaving dust. *Slippage Tolerance* defines the maximum unfavorable price movement you accept while the transaction is being included in a block: if the price moves beyond your limit, the trade cancels, your principal stays untouched, and only the `$0.01` failed-transaction fee is charged. The full cost of a swap in Minter consists of three parts: 1. A `0.2%` liquidity pool fee kept inside each pool's reserves for liquidity providers. 2. Roughly a `0.1%` (`ceil(input / 1000)`) order-book route surcharge transferred to the protocol burn address (`Mx00cedde786b34d733d1dc96559253081572df2c6`) when trading through active `PairV2` pools. 3. The `$0.03` base transaction fee for a single-pool swap (plus `$0.005` for each extra pool hop on multi-hop routes). Before confirming a swap, verify the numeric **Coin ID** (`BIP = 0`, `HUB = 1902`, `USDTE = 1993`, `USDCE = 1994`, `USDTBSC = 3494`) so you do not trade a lookalike custom token. ## Issuing and redeeming `Mc...` checks A Minter check (`Mc...`) is a signed payment authorization that lets anyone who has the check string and its password (*Passphrase*) claim the stated coin amount onto their `Mx...` wallet. Redeeming is free for the recipient and works on an address with `0 BIP` because the `$0.03` redemption fee is paid from the creator's address. Each check can be redeemed once and may optionally expire at a chosen block height (*Due Block*). > **[warn] A check does not reserve coins on your balance** > Issuing a check does not lock or deduct coins from your wallet at creation time. Both the check amount and the `$0.03` fee are deducted from the creator's address only when the recipient submits the check for redemption. If the creator's balance lacks sufficient funds at that moment, redemption fails (and up to `$0.01` is charged to the creator for the failed attempt). Keep the full amount of all unredeemed checks plus fee headroom on the issuing address until they are claimed or their *Due Block* passes. ### How to issue a check 1. Open **Checks → Issue Check** in [Minter Console](https://console.minter.network/). 2. Select the coin, enter the amount, and set a strong **Password**. 3. If you issue multiple checks for the same amount in a row, assign each check a distinct serial number (`1`, `2`, `3`), and set an expiration block (*Due Block*) if needed. 4. Click **Issue**, copy the `Mc...` string, and send the check code and password to the recipient over two separate channels. ### How to redeem a check 1. Sign in to your wallet in [Minter Console](https://console.minter.network/) and open **Checks → Redeem Check**. 2. Paste the `Mc...` check string and enter its **Password**. 3. Click **Redeem** and confirm the credited balance in **Wallet** or on your address page in [Minter Explorer](https://explorer.minter.network/). ### Delegation, rewards and unbonding URL: https://docs.minter.network/earn/delegation Summary: Step-by-step coin delegation in Minter Console, reward and fee distribution, validator slashing and downtime rules, the 1,000-slot Waitlist, CRR delegation price, and Unbond vs MoveStake. Delegating binds your `BIP` or reserve-backed coins to a chosen validator so your `Mx...` address receives a share of block emissions and transaction fees. You need a wallet in [Minter Console](https://console.minter.network/), the coins to stake, and a validator's `Mp...` public key from [Minter Explorer](https://explorer.minter.network/). ## How to delegate coins in Minter Console 1. Open **Validators** in [Minter Explorer](https://explorer.minter.network/), select an active validator, check its minimum active slot (`min stake`), and copy its `Mp...` public key. 2. Sign in to [Minter Console](https://console.minter.network/) and open **Delegation** in the left menu. 3. In the **Delegate** form, paste the `Mp...` public key, choose `BIP` (or a reserve coin with `CRR`), and enter an amount above the validator's minimum slot. 4. Click **Delegate** and confirm the transaction (`$0.10` network fee). Your stake enters reward calculation and receives its first payout at the next `720`-block boundary. If you plan to lock staked funds for `18,921,600` blocks in exchange for `×3` weight on protected base block emissions, review the conditions in [LockStake for 3 years](https://docs.minter.network/earn/lock-stake) before locking. ## Checking reward size, split and history To inspect your payouts, paste your `Mx...` address into the search bar of [Minter Explorer](https://explorer.minter.network/): 1. The **Stakes** block lists every validator you delegated to, the staked coin quantities, their `BIP` and US dollar equivalents, and whether a 3-year `LockStake` is active. 2. The **Rewards** tab displays a daily bar chart and day-by-day `BIP` totals credited to your address. To estimate the realized annual rate on your position, take your `7`-day reward sum from **Rewards**, divide by `7`, divide by your `BIP` stake, and multiply by `365`. Rewards accumulate inside the protocol every `12` blocks (about `1` minute at the nominal `5`-second block time) and every `720` blocks (about `1` hour) are automatically added to your `BIP` stake with the same validator. Payouts do not arrive on your free wallet balance, so you do not need to claim or redelegate them manually, and each hourly payout compounds into the next cycle. If you delegated a custom reserve coin, the protocol opens and compounds a separate `BIP` stake slot for your rewards under that validator. Accumulated block emissions and network transaction fees are split in a fixed sequence: `10%` goes to the DAO fund and `10%` goes to protocol developers; from the remaining share allocated to each validator by stake weight, your validator deducts its commission (`0%` to `100%`), and the balance is distributed proportionally across its delegators. ## What a validator can and cannot do Delegated coins stay bound to your own `Mx...` address inside the protocol and are not sent to the operator's wallet: a validator cannot withdraw, spend, or appropriate your coins. Only the holder of your 12-word seed phrase can submit `Unbond` or `MoveStake`. However, validator faults and ranking changes directly affect your income and liquidity: 1. Missing more than `12` blocks within a sliding window of `24` blocks places the validator offline in jail for `17,280` blocks (about `24` hours at `5` seconds per block). Stake burn is `0%`, so your principal is not slashed, but no rewards accrue while the node is offline, and after `17,280` blocks the operator must manually switch the validator back online. 2. Signing two conflicting blocks at the same height (double-signing) burns `5%` of the validator's stakes (including delegators' active stakes and pending unbonds), switches the node offline, and moves the remaining `95%` into unbonding (`FrozenFunds`) for `518,400` blocks (about `30` days at `5` seconds per block). 3. The network allows up to `64` active consensus validators and keeps at most the top `100` candidates by total `BIP` stake. If a candidate drops outside the top `100`, it is removed and all stakes delegated to it enter `FrozenFunds` for `518,400` blocks (about `30` days) before returning to free balances. 4. A validator can adjust its commission (`0%` to `100%`) by at most `±10` percentage points (for instance, from `10%` to `20%`) once every `1,555,200` blocks (about `90` days at `5` seconds per block). Once at least `4` validators are active, the protocol also rejects new delegations to any validator whose total stake would reach roughly `20%` of network voting power. > **[warn] Double-signing and dropping out of the top 100 affect delegator stakes** > If a validator double-signs two blocks at the same height, the protocol burns `5%` of delegated stake and freezes the remaining `95%` in `FrozenFunds` for `518,400` blocks (about `30` days). If a validator falls outside the top `100` candidates by stake size, `0%` is burned, but all delegated stakes likewise enter a `518,400`-block unbond with zero rewards during that period. ## Choosing a validator in Minter Explorer Compare four indicators on the **Validators** page in [Minter Explorer](https://explorer.minter.network/) before delegating: | Explorer metric | What to check | Impact on your position | | :--- | :--- | :--- | | Commission (`0%` to `100%`) | Current fee rate (commonly `5%` to `15%`) | Sets your net share of rewards; changes are capped at `±10` percentage points per `1,555,200` blocks (about `90` days) | | Missed blocks and status | Online status and near-zero misses per `24`-block window | More than `12` misses out of `24` halt rewards for at least `17,280` blocks (about `24` hours) | | Rank and voting share | Solid margin inside top `64` and share below `20%` | Avoids top-`100` eviction into `FrozenFunds` and delegation rejection at the `20%` concentration cap | | Minimum slot (`min stake`) | Your stake exceeds the validator's `1,000`th slot | Keeps your stake active instead of dropping into `Waitlist` | ## Waitlist and the 1,000-slot rule A slot is a single active stake position of one coin from one address with one validator. Each validator holds at most `1,000` active slots ranked by `BIP` equivalent. Identical coins delegated from the same address to the same validator merge into one slot, whereas different coins occupy separate slots: if you delegate `2 BIP` and `10 TEAM` to a validator and later add another `10 TEAM` to that validator, you occupy `2` slots (`2 BIP` and `20 TEAM`). When fewer than `1,000` slots are filled, any stake amount stays active. Once all `1,000` slots are occupied and larger stakes join (or a custom coin's `BIP` reserve valuation drops below the `1,000`th slot), the smallest position moves to `Waitlist`. Coins in `Waitlist` remain under your ownership, but they earn `0` rewards while waiting. You can restore or withdraw them in **Delegation** in [Minter Console](https://console.minter.network/): 1. Send a **Delegate** transaction in the same coin to the same validator so that your `Waitlist` balance plus the added amount exceeds the validator's current `min stake`: the protocol automatically pulls the position out of `Waitlist`, merges both amounts, and places the combined stake back into the active top `1,000`. 2. Transfer the position via **MoveStake** (`134,400` blocks, about `7.8` days, `$0.10` fee) to a validator with open slots or a lower minimum slot. 3. Withdraw to your free balance via **Unbond** (`518,400` blocks, about `30` days, `$0.10` fee) if `LockStake` is not active on your address; partial `Unbond` deducts from `Waitlist` first before reducing an active slot. ## Delegation price of reserve coins Only native `BIP` and custom reserve coins with a Constant Reserve Ratio (`CRR` from `10%` to `100%`) can be delegated; non-reserve tokens and `LP` pool tokens cannot be staked. For `BIP`, `1 BIP` always equals `1 BIP` of staking weight. For a reserve coin with `CRR < 100%`, the `BIP` locked in its protocol reserve is smaller than the market value of its circulating supply, so the network computes staking weight from the actual `BIP` reserve backing all delegated units of that coin. As a result, a reserve coin's delegation price is usually lower than its swap pool price and shifts whenever holders buy, sell, or delegate that coin. ## Unbonding coins and switching validators Manage active stakes in the **Delegation** tab of [Minter Console](https://console.minter.network/); coins in transit during either waiting window do not accrue rewards: | Operation | Period in blocks and at `5` s per block | Fee | Execution rules | | :--- | :--- | :---: | :--- | | Withdraw to wallet (`Unbond`) | `518,400` blocks (about `30` days) | `$0.10` | Credits coins back to your free `Mx...` balance after `518,400` blocks; disabled while a 3-year `LockStake` is active | | Switch validator (`MoveStake`) | `134,400` blocks (about `7.8` days) | `$0.10` | Moves stake directly from the old `Mp...` key to a new active `Mp...` validator; permitted even while `LockStake` is active | Check the target completion block of any pending withdrawal or transfer in the **Stakes** / **Unbonds** section on your address page in [Minter Explorer](https://explorer.minter.network/). ### LockStake for 3 years URL: https://docs.minter.network/earn/lock-stake Summary: Rules of the 3-year LockStake (18,921,600 blocks) in Minter: irreversibility, ×3 weight limited to safeReward base emission, MoveStake support, and activation in Minter Console. `LockStake` disables withdrawals on all stakes delegated from your `Mx...` address for `18,921,600` blocks (about `1,095` days, or 3 years at the nominal `5`-second block time) and grants your stake `×3` weight on the protected base block emission (`safeReward`). To enable it, you need a wallet in [Minter Console](https://console.minter.network/) and `$0.10` for the network fee. > **[warn] LockStake cannot be canceled early** > The lock lasts `18,921,600` blocks (about `1,095` days at `5` seconds per block), and there is no way to cancel it or submit `Unbond` before the unlock block height is reached. Sending `LockStake` a second time starts a new `18,921,600`-block countdown from the current block. The `×3` multiplier applies only to the protected base block emission (`safeReward`), while transaction fee distribution and extra emission are calculated without the `×3` multiplier, so total yield increases by less than three times. ## Five rules of LockStake 1. The lock applies to every stake on your `Mx...` address at once (you do not need to unbond existing stakes before enabling it). To lock only part of your coins and keep the rest eligible for regular `518,400`-block unbonding, create a second `Mx...` [wallet](https://docs.minter.network/earn/wallet) in Minter Console: lock long-term holdings on the first address and delegate flexible funds without `LockStake` from the second. 2. Regular stake top-ups via `Delegate` do not extend the unlock height: coins added from the same address a year later also receive `×3` weight on `safeReward` and unlock at your original target block. The timer resets for another `18,921,600` blocks only if you submit the `LockStake` action again. 3. Your free wallet balance remains unlocked: liquid coins on your `Mx...` balance, transfers, swaps, liquidity pools, limit orders, and checks continue to work without restriction, and rewards compound into your `BIP` stake slot every `720` blocks as usual. 4. Switching validators via `MoveStake` (`134,400` blocks, about `7.8` days at `5` seconds per block, `$0.10` fee) stays available throughout the 3-year lock while preserving `LockStake`. Standard validator slashing and top-`100` eviction rules still apply ([see validator risks](https://docs.minter.network/earn/delegation#choose-validator)). 5. The `×3` multiplier increases your stake's weight only in `safeReward`; it does not triple your share of transaction fees or a validator's consensus voting power, and you can track realized daily payouts in the **Rewards** tab in Explorer after the first hourly cycles. ## Enabling LockStake and checking the unlock block 1. Sign in to [Minter Console](https://console.minter.network/) with the `Mx...` address whose stakes you intend to lock for `18,921,600` blocks. 2. Open **Delegation → Lock stake**. 3. Review the `18,921,600`-block lock notice, click **Lock**, and confirm the transaction (`$0.10` network fee). 4. Paste your `Mx...` address into [Minter Explorer](https://explorer.minter.network/) and check the **Stakes** block: it displays the `×3` badge, the exact unlock block height, and the estimated calendar unlock date. ### Liquidity pools and limit orders URL: https://docs.minter.network/earn/liquidity-pools-and-dex Summary: How Minter liquidity pools earn 0.2% swap fees, impermanent loss math on a $1,000 example, stablecoin pool peg risks, on-chain limit order rules, and verifying numeric Coin IDs. Minter combines automated liquidity pools and an on-chain limit order book inside the protocol: in [Minter Console](https://console.minter.network/), you can supply coin pairs to earn `0.2%` swap fees with no lock period and place limit orders at a chosen price, while tracking pool turnover in [Minter Explorer](https://explorer.minter.network/). ## How liquidity pools and the 0.2% fee work A liquidity pool holds reserves of two coins (such as `BIP / USDTE` or `HUB / USDTE`) deposited by providers in equal `50% / 50%` value (for example, `$500` worth of `BIP` and `500 USDTE`). Whenever a trader swaps through that pair, a `0.2%` liquidity fee stays inside the pool's reserves and is shared across providers in proportion to their pool share. In return for depositing a pair, your wallet receives a system pool token named `LP-...` (such as `LP-48`). You do not claim fees manually: each swap leaves extra reserves inside the pool, increasing the underlying coin amounts redeemable per `LP` token. When you exit the pool, redeeming your `LP` token returns your current share of both coins including accumulated `0.2%` fees. Check 24-hour trading volume, total value locked (TVL), and realized fee `APR` in the **Pools** section of [Minter Explorer](https://explorer.minter.network/). ## Adding, removing liquidity and creating a pool Manage pool positions in the **Pools** section of [Minter Console](https://console.minter.network/): ### Adding liquidity to an existing pool (`$0.10`) 1. In the **Add Liquidity** form, select the first and second coins of the pair. 2. Enter the amount of the first coin: Console automatically computes the matching `50% / 50%` amount of the second coin at the pool's current price. 3. Confirm you hold enough of both coins, click **Add**, and approve the transaction (`$0.10` fee) to receive `LP-...` tokens on your balance. ### Removing liquidity at any block (`$0.10`) 1. In the **Remove Liquidity** form, select the coin pair or its `LP-...` token. 2. Enter the withdrawal percentage from `1%` to `100%` (`100%` closes your entire position). 3. Review the estimated amounts of both coins returning to your wallet, click **Remove**, and confirm (`$0.10` fee): both coins and your accrued fee share arrive on your free balance in the next block. ### Creating a new liquidity pool (`$10.00`) To open trading for a coin pair that does not yet have a pool, use **Pools → Create Pool** (`$10.00` creation fee; subsequent **Add Liquidity** and **Remove Liquidity** actions cost `$0.10` each). Select both coins and verify the initial quantities carefully because your starting deposit ratio sets the initial market price of the pair (the geometric mean of the two initial amounts must exceed `1,000` atomic units, which stay locked inside the pool when the protocol issues the new `LP-...` system token). ## Impermanent loss on a $1,000 example When the market price of one coin moves relative to the other, arbitrage trades rebalance a `50% / 50%` pool toward the less appreciated asset, leaving your pool share (before swap fees) worth less than simply holding the starting coins in a wallet. That gap is called impermanent loss. Suppose `1 BIP` trades at `$0.001` and you deposit `$1,000` into `BIP / USDTE`: `500,000 BIP` (`$500`) plus `500 USDTE` (`$500`). Next, the market price of `BIP` doubles (`×2`) to `$0.002`. Traders buy `BIP` out of the pool with `USDTE` until the pool price reaches `$0.002`. Because the pool maintains a `50% / 50%` dollar split, your share before fees now holds roughly `353,553 BIP` (`$707.11`) and `707.11 USDTE`, totaling `$1,414.21`. Had you kept `500,000 BIP` (`$1,000`) and `500 USDTE` (`$500`) in your wallet instead, they would be worth `$1,500.00`. The `$85.79` difference (`$1,414.21` vs `$1,500.00`), or `-5.7%` relative to holding, is impermanent loss. If `BIP` returns to `$0.001`, the difference shrinks back to `0.0%`. Whether `0.2%` swap fees outweigh `$85.79` depends on trading volume: for a `$1,414.21` position to earn `$85.79` in `0.2%` fees, cumulative swap volume passing through the pool during your stay must reach roughly `30` times the pool's TVL (`85.79 / (0.002 × 1414.21) ≈ 30`). | Relative price ratio change | Pool value vs holding in wallet | Volume required to offset | | :--- | :---: | :--- | | `×1.00` (unchanged ratio) | `0.0%` | Any trading volume yields net `0.2%` fees | | `×1.25` (`+25%` or `-20%`) | `-0.6%` | Offset after roughly `3×` pool TVL in cumulative volume | | `×1.50` (`+50%` or `-33%`) | `-2.0%` | Offset after roughly `10×` pool TVL in cumulative volume | | `×2.00` (`2×` up or `-50%` down) | `-5.7%` | Offset after roughly `30×` pool TVL in cumulative volume | | `×5.00` (`5×` up or `-80%` down) | `-25.5%` | Holding in a wallet or placing a limit order retains more upside on large directional moves | ## Stablecoin pools and peg risk In dollar stablecoin pairs such as `USDTE` (`ID 1993`) / `USDCE` (`ID 1994`) or `USDTE` (`ID 1993`) / `USDTBSC` (`ID 3494`), both tokens target `$1.00`. As long as their relative price stays near `1:1`, impermanent loss remains close to `0.0%` while cross-chain traders swapping between dollar tokens pay `0.2%` into pool reserves. Stablecoin pools still carry issuer and bridge risk: if an external stablecoin issuer loses its `$1.00` peg or a cross-chain bridge suffers an incident, arbitrageurs sell the impaired token into the `50% / 50%` pool and withdraw the healthy stablecoin, concentrating your LP position in the depegged asset. ## Limit orders and verifying coin IDs Every liquidity pool in Minter includes an on-chain limit order book (`PairV2`) governed by four protocol rules: 1. Each side of a limit order must be at least `0.00000001` coin (`10^10 pip`); if a partial fill leaves fewer than `10^10 pip` on either side, the order closes automatically and returns the unsold remainder to your wallet. 2. The limit price cannot cross the pool's current price or sit more than `5×` away from it. 3. Unfilled limit orders expire automatically after `483,840` blocks (about `28` days at the nominal `5`-second block time) and return remaining coins to the owner's balance. 4. Market swaps routed through an active `PairV2` order-book pool pay `~0.1%` (`ceil(input / 1000)`) to the burn address `Mx00cedde786b34d733d1dc96559253081572df2c6` in addition to the `0.2%` pool fee, while matched limit orders contribute `0.1%` into pool reserves. To place or cancel an order in [Minter Console](https://console.minter.network/), open **Limit Orders**, choose the coin to sell and the coin to buy, enter the amount and target price (**Use current price** pre-fills the current pool rate), and submit (`$0.10` fee). To cancel an open order early, click **Cancel** next to it under **Active Orders** (`$0.01` fee). > **[warn] Verify the numeric coin ID before swapping or adding liquidity** > Creating a custom token with a `7`-to-`10`-character ticker costs `$100` (a `5`-character ticker such as `USDT2` costs `$2,000`), so third parties can register lookalike names. Before buying a token, placing a limit order, or supplying liquidity, check the immutable numeric **Coin ID** on its page in [Minter Explorer](https://explorer.minter.network/): `BIP = 0`, `HUB = 1902`, `USDTE = 1993`, `USDCE = 1994`, `ETH = 2065`, `BNB = 2107`, `USDTBSC = 3494`. ### Minter Hub bridge URL: https://docs.minter.network/earn/cross-chain-and-hub Summary: Token discovery, withdrawal quotes and cross-chain evidence for a real BIP payout to BSC. The Minter Hub cross-chain bridge connects Minter with Ethereum and BNB Smart Chain through **Deposit & Withdraw** in [Minter Console](https://console.minter.network/). You need an `Mx...` wallet, your own non-custodial `0x...` wallet (`MetaMask`, `Rabby`, or `Trust Wallet`), and a small `ETH` or `BNB` balance to pay external network gas when depositing. ## Depositing from Ethereum and BNB Smart Chain 1. Sign in to [Minter Console](https://console.minter.network/), open **Deposit & Withdraw**, and connect `MetaMask`, `Rabby`, or `Trust Wallet` in the **Deposit** form. 2. Select the source network (**BNB Smart Chain** for lower external gas fees or **Ethereum**), check the recipient `Mx...` address, choose the token, and enter the deposit amount. 3. When bridging ERC-20 or BEP-20 tokens such as `USDT` or `USDC`, confirm two sequential transactions in your external wallet (both require `ETH` or `BNB` for external network gas): first click **Unlock** (`Approve`) to authorize the bridge contract for that token amount, wait for on-chain confirmation, and then click **Send** to deposit the tokens into the bridge. For native assets, verify the supported deposit method in the receiving contract and wallet. 4. Wait for external block confirmations and co-signing by Minter Hub's `16` oracles: deposits normally complete in `2` to `5` minutes from BNB Smart Chain and `5` to `15` minutes from Ethereum depending on block load. Once the status changes to **Success**, verify the credited coin in Console or [Minter Explorer](https://explorer.minter.network/) (`USDTE` with `ID 1993` from Ethereum, or `USDTBSC` with `ID 3494` from BNB Smart Chain). ## Withdrawing to Ethereum or BNB Smart Chain 1. Open **Deposit & Withdraw → Withdraw** in [Minter Console](https://console.minter.network/hub). 2. Choose **Ethereum** or **BNB Smart Chain**, the token supported on that network, and your own `0x…` payout address. 3. Enter the gross amount. Review the network, token contract, recipient, fees and net payout, then confirm the Minter transaction in your wallet. 4. Save the source `Mt…` hash. Follow the tracker, verify the settlement on Minter, then check the token, recipient and raw amount in the external transaction receipt. Use the chain selected in step 2. Check the token and destination in the registry, then request a withdrawal quote for your gross amount. Use a self-custody address that accepts the bridged token. Review the network fee, bridge commission and expected receipt before signing. An exchange may have its own rules for crediting contract payouts. The adapter quotes a 1% bridge commission. Its legacy holder-discount endpoint returns zero. The BSC fee displayed in older Console builds may differ from the actual deduction. For a transfer already submitted, verify the Minter Send, the settlement Multisend and the ERC-20 Transfer on the destination chain. The [worked BIP withdrawal](https://docs.minter.network/api/minter-hub-v2#reading-a-transfer-across-both-chains) shows how a 2175.924385324264389766 BIP Send paid out **1.000000000000000001 BIPx**. ## Roles of BIP, `BIPx` and HUB 1. `BIP` (`ID 0` in Minter) is the native coin of the Minter blockchain used for validator delegation, `CRR` coin reserves, DEX pools, and internal fee settlement. 2. `BIPx` represents BIP at 1:1 on the external chain. The BSC payout in the example above is a token transfer. Ethereum BIPx contract: `0xcafE34BAE6F1b23A6B575303EdCc0578d2188131`. BSC BIPx contract: `0xf2Ba89A6f9670459ed5AeEfbd8Db52Be912228b8`. 3. `HUB` (coin ID 1902) is the bridge oracle token. ### Create a coin without code URL: https://docs.minter.network/earn/loyalty-and-custom-coins Summary: Issuing a CreateToken asset or CRR reserve coin (CreateCoin) in Minter Console, 3-to-10-character ticker fees, Recreate and Burnable rules, distribution, and paying network fees in your coin. In the **Coiner** section of [Minter Console](https://console.minter.network/), you can issue a loyalty token or a reserve-backed coin without writing smart contracts. You need an `Mx...` address and enough `BIP` or `USDTE` to pay the one-time ticker fee (starting at `$100`, plus at least `10,000 BIP` in initial reserve if launching a reserve coin). ## Token without reserve and coin with `CRR` Minter supports two custom asset types: a non-reserve token (`CreateToken`) and a reserve coin (`CreateCoin`). A reserve coin defines a Constant Reserve Ratio (`CRR` from `10%` to `100%`) at launch: the share of `BIP` backing locked inside the protocol so anyone can buy or sell the coin directly against its reserve formula (a higher `CRR` produces gentler price changes when supply expands or contracts). | Property | Non-reserve token (`CreateToken`) | Reserve coin (`CreateCoin`) | | :--- | :--- | :--- | | Initial `BIP` reserve | `0 BIP` (pay only the ticker fee) | At least `10,000 BIP` locked into the reserve | | Supply changes | Manual mint (`Mintable`, `$0.10`) and burn (`Burnable`, `$0.10`) | Automatic minting on reserve buys and burning on reserve sells | | Who can burn units | When `Burnable` is enabled, any holder can burn tokens from their own balance (only the owner address can mint via `Mintable`) | Any holder selling coins back into the protocol reserve | | Where it trades | DEX liquidity pools (**Pools → Create Pool**, `$10.00`) | Both against its built-in `BIP` reserve and in DEX liquidity pools | | Validator delegation | Not supported (used in wallets, checks, and pools) | Supported (stake weight reflects actual `BIP` reserve and `CRR` `10%` to `100%`) | ## Ticker length fees and recreation rules Every coin or token registers an available ticker symbol of `3` to `10` uppercase Latin letters and digits (`A-Z`, `0-9`, with at least one letter). The one-time protocol fee depends on symbol length and is priced in US dollars (`USDTE` equivalent): | Ticker length | Example symbol | One-time creation fee | | :---: | :---: | :---: | | `7` to `10` characters | `COFFEE2026`, `BONUSCLUB` | `$100` | | `6` characters | `BAKERY`, `STUDIO` | `$400` | | `5` characters | `ALPHA`, `CRAFT` | `$2,000` | | `4` characters | `CAFE`, `CLUB` | `$10,000` | | `3` characters | `VIP`, `PRO` | `$50,000` | > **[warn] Recreating an asset assigns a new coin ID and does not migrate balances** > In **Coiner**, the ticker owner can recreate a coin or token (`RecreateCoin` / `RecreateToken`) for a flat `$100` fee. Recreation renames the previous asset to an archived symbol such as `BONUSCLUB-1` and creates a new asset with a new numeric **Coin ID** under `BONUSCLUB`. Existing holder balances are not migrated to the new asset: prior holders keep `BONUSCLUB-1` in their wallets unless you distribute or swap the new edition separately. ## Issuing an asset in Minter Console 1. Open **Coiner** in [Minter Console](https://console.minter.network/) and choose **Create Token** (`CreateToken`) or **Create Coin** (`CreateCoin`). 2. Enter the **Name**: maximum length is `64` UTF-8 bytes (ASCII Latin characters take `1` byte each, while Cyrillic characters take `2` bytes each). 3. Enter the **Symbol** (`3` to `10` uppercase characters/digits), **Initial Amount**, and **Max Supply** (set **Max Supply** equal to **Initial Amount** if you want a fixed cap). 4. For a token, select the **Mintable** and **Burnable** checkboxes as needed (noting that `Burnable` lets any holder burn tokens from their own balance); for a reserve coin, enter **Initial Reserve** (`10,000 BIP` minimum) and **CRR** (`10%` to `100%`). 5. Under **Advanced Mode**, pick `BIP` or `USDTE` in **Coin to Pay Fee**, click **Create**, confirm the transaction, and record the assigned numeric **Coin ID** on the coin's page in [Minter Explorer](https://explorer.minter.network/). ## Distributing tokens and paying fees in your coin You can distribute and accept a newly created token directly from your browser in three ways: 1. Issue `Mc...` checks in **Checks → Issue Check**: recipients with `0 BIP` redeem them free of charge, provided you keep enough tokens and `$0.03` per unredeemed check on the issuing address until redemption ([check rules](https://docs.minter.network/earn/minter-console#checks)). 2. Send batch payouts via **Multisend** in **Wallet** to up to `100` addresses per transaction (`$0.01` for the first recipient plus `$0.005` for each additional recipient). 3. Accept payments at a counter or checkout `Mx...` address (`$0.01` transfer without a note) with the order number entered in **Message**. To let holders pay network transaction fees directly in your coin when their `BIP` balance is zero, open **Pools → Create Pool** (`$10.00` fee) and pair your coin with `BIP`. Once the pool holds sufficient `BIP` liquidity, holders can select your coin in **Coin to Pay Fee**, and the network sells the required amount into the pool to cover the fee. Every fee payment is a small sale of your coin into that pool, so size the `BIP` side to match your expected transfer volume. To automate point issuance, check generation, and incoming payment verification in a backend service or Telegram bot, share the technical guide [Token, pool and loyalty program](https://docs.minter.network/developers/cookbook-token-launch-and-loyalty#loyalty) with your developer. ### Safety and FAQ URL: https://docs.minter.network/earn/faq-and-safety Summary: Wallet security rules for Minter users, concise answers to common questions on fees and staking, custodial risks of third-party HUB oracle pools, and Minter Hub token listing. Review these five wallet security rules before managing significant balances in [Minter Console](https://console.minter.network/). Short answers on network fees, delegation, third-party `HUB` staking pools, and bridge token listings follow. ## Wallet safety rules > **[warn] Store your seed phrase offline and keep active MetaMask keys out of web tabs** > Minter developers, validator operators, and support channels do not ask for your 12-word seed phrase or check passwords. Do not send your seed phrase in chats, do not keep screenshots of it in cloud photo libraries, and do not enter a primary `MetaMask`, `Rabby`, or `Trust Wallet` phrase holding Ethereum or BNB Smart Chain funds into a browser wallet: generate a separate 12-word phrase for Minter ([wallet setup guide](/earn/wallet#create-wallet)). 1. Verify the exact domain and HTTPS certificate of [Minter Console](https://console.minter.network/) and [Minter Explorer](https://explorer.minter.network/) in your browser address bar, and open both sites from your own bookmarks rather than links in private messages or search ads. 2. Check the immutable numeric **Coin ID** in Minter Explorer before swapping, placing a limit order, or adding liquidity so you avoid copycat tickers: `BIP = 0`, `HUB = 1902`, `USDTE = 1993`, `USDCE = 1994`, `ETH = 2065`, `BNB = 2107`, `USDTBSC = 3494`. 3. When withdrawing through Minter Hub to Ethereum or BNB Smart Chain, enter only your own non-custodial `0x...` wallet address (`MetaMask`, `Rabby`, `Trust Wallet`), not a centralized exchange deposit address or a smart contract ([bridge withdrawal rules](https://docs.minter.network/earn/cross-chain-and-hub#withdraw)). 4. Compare the first and last `6` characters of the recipient address before confirming large transfers, and when sending an `Mc...` check, transmit the check string and its password over two separate channels. 5. Hold larger personal, family, or team savings on a `2`-of-`3` [multisig wallet](https://docs.minter.network/earn/wallet#multisig) across independent devices: a single compromised device cannot authorize transfers, and losing one of the three keys still leaves two keys able to move the balance. ## Frequently asked questions ### Paying fees on a wallet with zero BIP You do not need to buy `BIP` first: if your wallet holds any coin paired with a liquid `BIP` pool (such as `USDTE`, `USDTBSC`, or `HUB`), turn on **Advanced Mode** and pick that coin in **Coin to Pay Fee** ([transfers and swaps guide](https://docs.minter.network/earn/minter-console#send)). ### Where staking rewards arrive Staking rewards do not land as separate transfers on your free balance: every `720` blocks (about `1` hour at the nominal `5`-second block time), the protocol adds them directly to your `BIP` stake with the same validator, and daily totals appear under the **Rewards** tab in Explorer ([delegation guide](https://docs.minter.network/earn/delegation#rewards)). ### Validator custody and slashing risks A validator cannot spend or take custody of your coins, but its operation affects your position: missing more than `12` of `24` blocks pauses rewards for at least `17,280` blocks (about `24` hours, `0%` burn), double-signing burns `5%` of stake, and dropping out of the top `100` candidates (or double-signing) moves stakes into `FrozenFunds` for `518,400` blocks (about `30` days) ([choosing a validator](https://docs.minter.network/earn/delegation#choose-validator)). ### Stake moved to Waitlist Each validator holds at most `1,000` active slots; you can return a displaced position to the active top `1,000` by delegating more of the same coin above `min stake`, move it via `MoveStake` (`134,400` blocks), or withdraw via `Unbond` (`518,400` blocks) ([Waitlist rules](https://docs.minter.network/earn/delegation#waitlist)). ### Adding coins during an active LockStake Regular `Delegate` top-ups and `MoveStake` validator switches do not extend your unlock block height, whereas submitting `LockStake` again restarts a full `18,921,600`-block countdown from that block, and `LockStake` cannot be canceled early ([LockStake rules](https://docs.minter.network/earn/lock-stake)). ### Withdrawal time from pools vs delegation Removing liquidity from a pool (**Pools → Remove Liquidity**, `$0.10` fee) settles in one block (nominally `5` seconds), whereas unbonding from delegation (`Unbond`, `$0.10` fee) takes `518,400` blocks (about `30` days) and switching validators (`MoveStake`, `$0.10` fee) takes `134,400` blocks (about `7.8` days). ### Using a MetaMask seed phrase in Minter Console The same 12 words technically open the matching `Mx...` address with identical characters after the prefix, but typing an active external wallet phrase into a browser exposes your Ethereum and BNB Smart Chain balances; generate a separate 12-word phrase for Minter ([key separation details](https://docs.minter.network/earn/wallet#create-wallet)). ### Recovering a lost 12-word seed phrase No server or support team stores seed phrases or can reset access to a single-key `Mx...` wallet; only an offline backup (or the remaining two keys of a `2`-of-`3` multisig wallet) preserves access. ### Staking HUB with bridge oracles The Minter Hub protocol has no non-custodial delegation slots for ordinary wallets: only the `16` bridge oracle operators stake `HUB` directly from their own oracle addresses. Third-party "oracle pools" that ask you to send `HUB` to someone else's `Mx...` wallet in return for a custom receipt token carry full custodial counterparty risk because the recipient controls your `HUB`. To keep personal custody of `HUB`, hold it on your own address or supply it to native Minter liquidity pools (`HUB / USDTE`, `HUB / BIP`), where it earns `0.2%` swap fees. ### Listing new tokens on Minter Hub On Ethereum and BNB Smart Chain, custom token contracts may include transfer fees or rebasing balance logic that would break `1:1` bridge accounting. New cross-chain tokens are therefore connected through an on-chain vote of Minter Hub's `16` oracles after verifying technical compatibility between the external ERC-20 or BEP-20 contract and its paired token in Minter. An oracle vote confirms only technical transfer compatibility and does not audit or endorse the financial soundness of the issuer; view supported bridge tokens in **Deposit & Withdraw** in [Minter Console](https://console.minter.network/) and verify their numeric Coin IDs in [Minter Explorer](https://explorer.minter.network/). ## Developers (developers) ### Quickstart URL: https://docs.minter.network/developers/quickstart Summary: Install @minter-network/tx-core, derive a BIP-44 Mx wallet, fund it from the public Testnet faucet (chainId 2, MNT), sign Send (0x01), and wait for block commit via MinterGateClient. `@minter-network/tx-core` builds, RLP-encodes, signs, and broadcasts Minter `v3.3.0` transactions through `MinterGateClient` using native `BigInt` (`1 coin = 10^18 pip`). Public endpoint URLs for Mainnet (`chainId: 1`) and Testnet (`chainId: 2`) are listed in [API overview and network endpoints](https://docs.minter.network/api#networks). ## Installation and wallet generation Install the package in Node.js 20.19.0+, Bun, Deno, or a browser bundler project: ```bash npm init -y npm install @minter-network/tx-core npm install -D tsx ``` Save this example as `prepare.mts` and run `npx tsx prepare.mts`. It creates two Testnet addresses and stores the mnemonic, recipient, and epoch in a local `.env.testnet` file with mode `0600`. Keep that file private. ```typescript import { writeFileSync } from "node:fs"; import { deriveWalletFromMnemonic, generateWalletMnemonic } from "@minter-network/tx-core"; const statusResponse = await fetch("https://testnet.minter.network/status.json", { redirect: "error", cache: "no-store", }); if (!statusResponse.ok) throw new Error("Testnet manifest is unavailable"); const status = await statusResponse.json(); if ( status.state !== "ok" || status.public_api_ready !== true || status.minter_chain_id_byte !== 2 || !/^minter-testnet-[0-9]{6}$/.test(status.chain_id) ) { throw new Error("Public Testnet is not ready"); } const mnemonic = generateWalletMnemonic(128); const wallet = deriveWalletFromMnemonic(mnemonic, 0); const recipient = deriveWalletFromMnemonic(mnemonic, 1); try { writeFileSync(".env.testnet", [ `MINTER_MNEMONIC="${mnemonic}"`, `MINTER_RECIPIENT=${recipient.address}`, `MINTER_TESTNET_EPOCH=${status.chain_id}`, "", ].join("\n"), { encoding: "utf8", mode: 0o600, flag: "wx" }); console.log("Testnet funding address:", wallet.address); console.log("Recipient:", recipient.address); } finally { wallet.privateKey.fill(0); recipient.privateKey.fill(0); } ``` ## Public Testnet faucet funding Pass your `Mx...` address to the public Testnet faucet (`https://faucet.testnet.minter.network`, `chainId: 2`) to dispense `1,000 MNT` (`coinId: 0`). Public Testnet endpoints (`https://gate-api.testnet.minter.network/v2`, `https://explorer.testnet.minter.network/`, and the epoch manifest `https://testnet.minter.network/status.json`) are isolated from Mainnet (`chainId: 1`). > **[warn] Monthly full reset and cross-epoch replay** > On the 1st of each month the public Testnet resets completely to a new monthly epoch `minter-testnet-YYYYMM`, wiping all balances, custom coins, pools, and transaction history while restarting account `nonce` counters from `0`. Service keys (treasury, faucet hot wallet, generator) rotate on every epoch, whereas `chainId` stays `2` (`0x02`) across epochs: if a user reuses the same `Mx...` address in a later epoch and funds it again, a transaction signed in an earlier epoch can be replayed. Generate a fresh disposable test mnemonic per epoch, keep Mainnet keys separate, and check `https://testnet.minter.network/status.json` for the active `chain_id` and `first_block_hash`. ## Signing and broadcasting `Send (0x01)` After the faucet payout is confirmed, save the next example as `send.mts` and run `npx tsx --env-file=.env.testnet send.mts`. It checks the epoch, sends `25.50 MNT` to the second address, and prints an Explorer link after the transaction commits. If confirmation stalls, look up the printed hash before trying again. #### TypeScript (@minter-network/tx-core) ```typescript import { CHAIN_ID, MinterGateClient, buildSendTx, deriveWalletFromMnemonic, isValidMxAddress, parsePip, signTx, } from "@minter-network/tx-core"; const { MINTER_MNEMONIC: mnemonic, MINTER_RECIPIENT: recipient, MINTER_TESTNET_EPOCH: epoch } = process.env; if (!mnemonic?.trim() || !recipient || !isValidMxAddress(recipient) || !epoch || !/^minter-testnet-[0-9]{6}$/.test(epoch)) { throw new Error("Load .env.testnet from the wallet setup step"); } const noRedirect: typeof fetch = (input, init) => fetch(input, { ...init, redirect: "error" }); const gate = new MinterGateClient({ baseUrl: "https://gate-api.testnet.minter.network/v2", fetchImpl: noRedirect, }); async function checkEpoch() { const response = await noRedirect("https://testnet.minter.network/status.json", { cache: "no-store" }); if (!response.ok) throw new Error("Testnet manifest is unavailable"); const status = await response.json(); if (status.state !== "ok" || status.public_api_ready !== true || status.minter_chain_id_byte !== CHAIN_ID.TESTNET || status.chain_id !== epoch) { throw new Error("Testnet epoch is unavailable or changed. Prepare a new test wallet after a reset."); } const node = await gate.getStatus(); if (node.network !== epoch || node.catching_up !== false) { throw new Error("The public Testnet node does not match the wallet epoch"); } } await checkEpoch(); const wallet = deriveWalletFromMnemonic(mnemonic, 0); try { const nonce = await gate.getNextNonce(wallet.address); const unsignedTx = buildSendTx( { coinId: 0, to: recipient, valuePip: parsePip("25.50") }, { nonce, chainId: CHAIN_ID.TESTNET, gasPrice: 1, gasCoin: 0 }, ); const { signedRawTxHex, txHash } = signTx(unsignedTx, wallet.privateKey); await checkEpoch(); console.log("Transaction hash:", txHash); const mempool = await gate.sendTransaction(signedRawTxHex); if (String(mempool.code) !== "0") { throw new Error(`CheckTx rejected (${mempool.code}): ${mempool.log}`); } const receipt = await gate.waitForTransaction(txHash); console.log("Committed:", receipt.hash, "height:", receipt.height, "code:", receipt.code); console.log("Explorer:", `https://explorer.testnet.minter.network/transactions/${receipt.hash}`); } finally { wallet.privateKey.fill(0); } ``` #### cURL ```bash GATE_URL="https://gate-api.testnet.minter.network/v2" # 1. Inspect active Testnet epoch and account balances in pip curl -sS "https://testnet.minter.network/status.json" curl -sS "${GATE_URL}/address/${TESTNET_ADDRESS:?Set your Testnet address}" # 2. Estimate the fee for a chainId=2 Send vector (12.5 MNT; coinId 0, gasCoin 0) curl -sS "${GATE_URL}/estimate_tx_commission/0xf8840102018001a0df80946fac4d18c912343bf86fa7049364dd4e424ab9c088ad78ebc5ac62000094696e766f6963653a746573746e65742d64656d6f8001b845f8431ba00b00e01747dddf76b52bd275d2762fccb161f35e6a7073cf06a4dd0d812cc4d7a0293cd5da784f7fd75cac1bf0c7ac2302932dac8930c2cd1161f632904a85d3d1" # 3. Read the receipt using the hash printed by send.mts curl -fsS "${GATE_URL}/transaction/${TESTNET_TX_HASH:?Set the hash from send.mts}" ``` > **[info] Finality:** `POST /v2/send_transaction` validates mempool admission (`CheckTx`) only; finality occurs after block commit (`DeliverTx`) with `code === "0"`. ## Paying fees in non-BIP coins When an account holds `0 BIP`, set `gasCoin` to the numeric ID of a liquid coin such as `1993` (`USDTE`) or `1902` (`HUB`). The node converts the fee through the coin's `BIP` swap pool or CRR reserve inside the same transaction and adds `1` gas unit (the transaction is rejected if pool or reserve liquidity is insufficient). Full gas accounting rules are specified in [Execution, gas and fees](https://docs.minter.network/protocol/execution-and-fees#gas-coin). When transferring the full balance of the coin selected as `gasCoin`, query `gate.estimateTxCommission(signedRawTxHex)` beforehand and leave a margin for pool price changes between estimation and block commit. ### @minter-network/tx-core reference URL: https://docs.minter.network/developers/tx-core-sdk Summary: Module reference for @minter-network/tx-core: 10^18 pip integer arithmetic, canonical RLP, BIP-39/44 wallets, SecretLeakGuard, 37 transaction builders, checks, and MinterGateClient. `@minter-network/tx-core` implements `secp256k1` cryptography, canonical RLP serialization, `10^18 pip` integer arithmetic, and a Node Gate API v2 HTTP client on native `BigInt`, `Uint8Array`, `DataView`, `TextEncoder`, and `fetch`. Install the published package with `npm install @minter-network/tx-core`. [Package on npm](https://www.npmjs.com/package/@minter-network/tx-core) ## Runtime support The package requires Node.js 20.19.0 or later. The runtime check signs and decodes the same `Send` test vector in each of these environments. | Runtime | Verified versions | | :--- | :--- | | Node.js | 20.19.0, 22.23.5, 24.22.3 | | Bun | 1.4.4 | | Deno | 2.9.6 | | Chromium | 159.0.8154.6 | ## Package modules | Module | Underlying dependencies | Scope and key exports | | :--- | :--- | :--- | | `pip` | Native `BigInt` | `PIP_SCALE` (`10n ** 18n`), `parsePip`, `formatPip`, `divRoundBigInt`, `ROUNDING`, `estimateAmmOutPip`, and `estimatePairV2SwapOutPip` | | `bytes` | Native `Uint8Array` | Hex/UTF-8 converters, strict `Mx...`, `Mp...`, `Mt...`, `Mc...` formatters, and `[10]byte` ticker encoders (`encodeTicker10`) | | `rlp` | Built-in codec | Canonical `rlpEncode` / `rlpDecode`. `rlpDecode` rejects trailing bytes. `decodeRlpUint` rejects leading `0x00` in unsigned integers. | | `wallet` | `@scure/bip39`, `@scure/bip32`, `@noble/hashes` | Mnemonic generation, `m/44'/60'/0'/0/{index}` derivation (`deriveWalletFromMnemonic`), `deriveMultisigAddress`, and `SecretLeakGuard` | | `tx` and `tx-types` | `@noble/curves/secp256k1`, `@noble/hashes` | `TX_TYPE` registry, 48 `DEFAULT_V330_COMMISSION_TARIFFS` fields, builders for all 37 active opcodes, `signTx`, `signTxForMultisig`, `assembleMultisigTx`, `decodeRawTx` | | `check` | `@noble/curves/secp256k1`, `@noble/hashes` | Off-chain `Mc...` check issuance and proof generation (`issueCheck`, `decodeCheck`, `createCheckProof`, `verifyCheckProof`) | | `gate-client` and `verify-transfer` | Native `fetch` | `MinterGateClient` (`getStatus`, `getAddress`, `getNextNonce`, `getCoinInfo`, `getCoinInfoById`, `estimateTxCommission`, `sendTransaction`, `getTransaction`, `waitForTransaction`) and `verifyIncomingTransfer` | Public TypeScript declarations (`dist/index.d.ts`) ship inside `@minter-network/tx-core`. ## `10^18 pip` precision and rounding (`pip`) Balances, pool reserves, order volumes, and fee tariffs in Minter `v3.3.0` are unsigned integers denominated in atomic `pip` (`1 coin = 1_000_000_000_000_000_000 pip = 10^18 pip`). JavaScript `Number` (`float64`, `53` bits of significand, `Number.MAX_SAFE_INTEGER < 0.0091` coins in `pip`) truncates low-order digits and causes `Insufficient funds` or `non-canonical integer` rejections. Client interfaces distinguish three numeric states: 1. Unpriced or missing data (`null` or `undefined`) renders as a placeholder (`-` or `N/A`), not zero. 2. Mathematical zero (`0n`) renders as `0.00` or `$0.00`. 3. Non-zero dust (`1n` below the display unit) renders as `< 0.0001` or `< $0.01` while keeping the exact 18-decimal `pip` string in a tooltip attribute. | Calculation or field | `ROUNDING` mode | Protocol rationale | | :--- | :---: | :--- | | Spendable balance and full-balance transfer | `FLOOR` | Prevents overstating balance by `1 pip` (`Insufficient funds`) | | Swap `minimumValueToBuy` (`0x02`, `0x17`) | `FLOOR` | Keeps minimum output at or below integer pool output after slippage | | Swap `maximumValueToSell` (`0x04`, `0x18`) | `CEIL` | Covers integer pool input required for an exact-output swap | | Linear `USD-pip -> gasCoin` fee estimate | `CEIL` | Prevents `1 pip` fee shortfalls during tariff conversion | | Orderbook level aggregation | `CEIL` (Asks) / `FLOOR` (Bids) | Prevents aggregated bid and ask levels from visually crossing | | Informational fiat display estimates | `HALF_UP` | Symmetric rounding for display-only summaries | `parsePip` accepts a decimal string using `"."` (underscore digit separators `"_"` are accepted; commas `","` throw `SyntaxError`). Fractional parts exceeding `18` digits throw `RangeError` unless `rounding` is explicitly specified. ```typescript import { ROUNDING, divRoundBigInt, estimateAmmOutPip, estimatePairV2SwapOutPip, formatPip, parsePip, } from "@minter-network/tx-core"; const sendPip = parsePip("1250.50"); // 1250500000000000000000n const label = formatPip(sendPip, { decimals: 2, trimTrailingZeros: false, groupThousands: true, rounding: ROUNDING.FLOOR, }); // "1,250.50" const pureAmmOutPip = estimateAmmOutPip( 360_800_059_585_227_604_406n, 3_986_063_084_606_142_908_469_809n, parsePip("100"), ); const pairV2OutPip = estimatePairV2SwapOutPip( 360_800_059_585_227_604_406n, 3_986_063_084_606_142_908_469_809n, parsePip("100"), ); const minBuyPip = divRoundBigInt(pairV2OutPip * 995n, 1000n, ROUNDING.FLOOR); ``` ## Transaction builders and envelope (`tx`) The `tx` module exports generic `buildTx(type, data, options)`, flat and two-argument typed builders (`buildSendTx`, `buildSellSwapPoolTx`, `buildCreateTokenTx`, `buildCreateMultisigTx`, `buildRedeemCheckTx`, and builders for the remaining active types, 37 in total), plus low-level `encodeTxData` / `decodeTxData` codecs (including data-only RLP helpers for inactive `0x13 PRICE_VOTE`, empty list `0xc0` for `0x25 LOCK_STAKE`, and `uint32` `dueBlock` for `0x26 LOCK`). Outer envelope fields in `TxEnvelopeOptions`: 1. `nonce` (`bigint | number`): sequential account counter `transaction_count + 1n` (`uint64`). 2. `chainId` (`1 | 2`): `1` for Mainnet, `2` for Testnet. 3. `gasPrice` (`number`): gas price multiplier (`uint32`, defaults to `1`; `RedeemCheck` requires `1`). 4. `gasCoin` (`number`): numeric fee coin ID (`uint32`, `0` = `BIP` encodes as RLP `0x80`). 5. `payload` (`string | Uint8Array`): optional UTF-8 or binary memo up to `10_000` bytes (`+$0.0002` per byte). 6. `serviceData` (`string | Uint8Array`): optional arbitrary metadata up to `128` bytes (charged per byte on the same schedule as `payload`). 7. `signatureType` (`1 | 2`): `1` for single signature (`Single`), `2` for weighted multisig (`Multisig`). Byte-level 10-field RLP rules and cross-language porting examples are covered in [Test vectors and porting](https://docs.minter.network/developers/test-vectors-and-porting); full opcode schemas are listed in [Transaction registry (`0x01..0x26`)](https://docs.minter.network/protocol/transactions-registry). #### TypeScript (@minter-network/tx-core) ```typescript import { SecretLeakGuard, TX_TYPE, buildSellSwapPoolTx, decodeRawTx, parsePip, signTx, } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const privateKeyBytes: Uint8Array; const userMemo = "swap:arb-cycle-42"; SecretLeakGuard.assertSafePublicText(userMemo); // 2-pool swap route: USDTE (1993) -> BIP (0) -> HUB (1902). // Base 2-pool fee $0.035 + 17 payload bytes ($0.0034) = $0.0384 in USDTE equivalent. const unsigned = buildSellSwapPoolTx( { coins: [1993, 0, 1902], valueToSellPip: parsePip("250"), minimumValueToBuyPip: parsePip("13.45"), }, { nonce: 42n, chainId: 1, gasPrice: 1, gasCoin: 1993, payload: userMemo, serviceData: new Uint8Array(0), }, ); const signed = signTx(unsigned, privateKeyBytes); const decoded = decodeRawTx(signed.signedRawTxBytes); console.log(decoded.type === TX_TYPE.SELL_SWAP_POOL, decoded.sender, signed.txHash); ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash GATE_URL="${MINTER_GATE_URL:-https://gate.minter.network/v2}" # Quote 2-pool route USDTE (1993) -> BIP (0) -> HUB (1902) curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/estimate_coin_sell?coin_id_to_sell=1993&coin_id_to_buy=1902&value_to_sell=250000000000000000000&swap_from=pool&route=0" ``` ## Keys, buffer wiping and `SecretLeakGuard` (`wallet`) `deriveWalletFromMnemonic(mnemonic, accountIndex, passphrase)` derives keys along `m/44'/60'/0'/0/{accountIndex}` and wipes intermediate BIP-39 seed buffers. Zeroize `wallet.privateKey.fill(0)` in a `finally` block after signing (JavaScript strings such as `privateKeyHex` are immutable in memory, so pass `Uint8Array` keys in security-sensitive workers). `SecretLeakGuard` (`SecretLeakGuard.inspect` and `SecretLeakGuard.assertSafePublicText`) scans public `payload` and memo inputs before broadcast and rejects the input when it detects: 1. A sequence of `>= 12` consecutive valid English BIP-39 mnemonic words (avoiding false positives on ordinary 2-to-3-word phrases). 2. A bare or `0x`-prefixed 64-character hexadecimal private key, excluding public `Mp...` and `Mt...` identifiers. 3. An unredeemed `Mc...` check string. ## `MinterGateClient` and transfer verification (`gate-client`) `MinterGateClient` wraps Node Gate API v2 reads and transaction broadcast with `AbortController` timeouts and typed `MinterGateError` exceptions: 1. `getStatus()`, `getAddress(address, delegated?)`, and `getNextNonce(address)` read node status, account state, and the next account `nonce`. `getCoinInfo(symbol, height?)` and `getCoinInfoById(id, height?)` look up coin metadata. 2. `estimateTxCommission(signedTx)` calls `GET /v2/estimate_tx_commission/{0x...}` (near the `10_000`-byte `payload` cap, the hex URL reaches ~20 KB and can exceed reverse-proxy URL limits with `HTTP 414`). 3. `sendTransaction(signedTx)` submits `POST /v2/send_transaction` and returns mempool `CheckTx` admission. 4. `getTransaction(hash)` reads `GET /v2/transaction/{hash}`. `waitForTransaction(hash, { timeoutMs, pollMs })` polls until block inclusion, including after HTTP `404` and `400` not-found responses, and checks the execution code by default. 5. `verifyIncomingTransfer` validates a committed `Send (0x01)` with execution code `"0"` or `0`, positive block height, case-insensitive recipient match, numeric `coinId`, minimum `pip` value, expected `payload` memo, and replay deduplication against a `Set` of consumed `Mt...` hashes. ```typescript import { MinterGateClient, parsePip, verifyIncomingTransfer, } from "@minter-network/tx-core"; import type { MtHash } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const txHash: MtHash; const gate = new MinterGateClient( process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2", ); const processedTxHashes = new Set(); const committedTx = await gate.waitForTransaction(txHash, { timeoutMs: 15_000, pollMs: 1_000, }); const verification = verifyIncomingTransfer(committedTx, { merchantAddress: "Mx3a7b9104e82d19c64f01b5a8e9c72104d3e811f0", expectedCoinId: 1993, minAmountPip: parsePip("25.50"), expectedPayload: "order:INV-2026-8841", processedTxHashes, }); ``` ### Payments and deposits URL: https://docs.minter.network/developers/payments-and-deposits Summary: Merchant checkout and exchange deposit verification on Minter v3.3.0: string tx.code checks, numeric coin.id validation, Send, Multisend, RedeemCheck, and Centrifugo streaming. Incoming merchant payments and exchange deposits in Minter `v3.3.0` settle once the transaction is included in a committed Tendermint `v0.34.19` block (`Number(tx.height) > 0` and `tx.code === "0"`). Committed blocks do not reorganize, so a single confirmed block is sufficient to credit funds. ## Deposit routing and immutable `coin.id` Integrations route incoming transfers using one of two patterns: 1. Per-user HD deposit addresses (`m/44'/60'/0'/0/{userId}`), swept into cold storage while paying the sweep fee in the deposited token itself (`gasCoin: 1993` for `USDTE`). 2. A shared merchant `Mx...` address paired with a one-time `invoiceId` in `payload` (`<= 10_000` UTF-8 bytes, `+$0.0002` per byte; base64-encoded in Gate API v2 JSON responses). Transfers with missing or unrecognized memos go to a manual reconciliation queue. A ticker owner can reissue an asset via `RecreateCoin (0x10)` or `RecreateToken (0x1F)`, moving the symbol string to a new asset while renaming the old one with a `-1` suffix. The old asset keeps its numeric `coin.id` (`uint32`) and the new one receives a fresh ID, so deposit whitelists match `Number(coin.id)` rather than `coin.symbol`. | Asset | Numeric `coin.id` | Protocol role | | :--- | :---: | :--- | | `BIP` | `0` | Native staking and reserve coin (default `gasCoin: 0`) | | `HUB` | `1902` | Minter Hub oracle token | | `USDTE` | `1993` | Bridged USDT (Ethereum), reference unit for `PriceCommission` tariffs | | `USDTBSC` | `3494` | Bridged USDT (BNB Smart Chain) | ## Transaction verification rules Gate API v2 uses Protobuf3-JSON encoding where `uint64` fields (`code`, `height`, `type`, `coin.id`) are serialized as strings (`"0"`, `"40848100"`, `"1"`, `"1993"`). Calling `Number.isInteger(tx.code)` evaluates to `false` on every string response, and defaulting a missing `tx.code` to `0` via nullish coalescing treats an omitted field as success. A compliant verifier enforces six checks before crediting balances: 1. Execution status and block inclusion: `tx.code === "0"` and `Number(tx.height) > 0` (`send_transaction` confirms only mempool `CheckTx` admission). 2. Recipient match: for `Send (0x01)`, `String(tx.data.to).toLowerCase() === merchantMx.toLowerCase()`. 3. Numeric coin ID and amount: `Number(tx.data.coin.id) === expectedCoinId` and `BigInt(tx.data.value) >= expectedPip`. 4. Invoice binding: base64-decoded `tx.payload` equals an active one-time `invoiceId`. 5. Replay deduplication: enforce uniqueness on `tx.hash` (`Mt...`) for single-invoice checkout, or composite `(tx_hash, output_ordinal)` for exchange block scanners. 6. Complete credit coverage in `GET /v2/block/{height}?failed_txs=true`: process `Send` (`type === "1"`), every entry of `tx.data.list` in `Multisend (0x0D, type === "13")` (where the same recipient can appear multiple times under distinct `ordinal` indices), and check redemptions `RedeemCheck (0x09, type === "9")` via `tx.data.check` or block events (`tx.from` receives `tx.data.check.value`; `tx.data.check.sender` pays principal and the `$0.03` fee). For failed outgoing hot-wallet transactions (`tx.code !== "0"`), deduct the `failed_tx` fee and note that `ExecutorV3` does not increment `nonce`. ## Merchant checkout, block scanner and Centrifugo streaming The streaming example requires `centrifuge` 5.x (`npm install centrifuge@5`). For web checkout, generate a unique `invoiceId`, subscribe to the Centrifugo address channel `explorer:address:` (events arrive wrapped as `{"kind":"transaction","transaction": txCard}`) to trigger UI updates, and verify the transaction against Gate API v2 before fulfilling the order. When a WebSocket reconnect reports `recovered === false`, poll `/v2/block/{height}?failed_txs=true` sequentially from `lastProcessedHeight + 1` to catch up missed blocks. #### TypeScript (@minter-network/tx-core) ```typescript import { Centrifuge } from "centrifuge"; import { MinterGateClient, parsePip, type MxAddress } from "@minter-network/tx-core"; const GATE_URL = process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2"; const WS_URL = process.env.MINTER_WS_URL ?? "wss://explorer.minter.network/connection/websocket"; const gate = new MinterGateClient(GATE_URL); const WHITELISTED_COINS = new Set([0, 1902, 1993, 3494]); function decodeBase64Utf8(b64: string | undefined): string { if (b64 === undefined || b64 === "") return ""; const bin = atob(b64); const bytes = Uint8Array.from(bin, (c) => c.charCodeAt(0)); return new TextDecoder("utf-8", { fatal: false }).decode(bytes); } // 1. Authoritative server-side invoice verification by Mt... hash export async function verifyInvoicePayment(params: { txHash: string; merchantMx: MxAddress; expectedCoinId: number; expectedAmountDecimal: string; expectedInvoiceId: string; consumedTxHashes: Set; consumedInvoiceIds: Set; }) { const hashKey = `mt${params.txHash.trim().replace(/^(mt|0x)/i, "").toLowerCase()}`; if ( params.consumedTxHashes.has(hashKey) || params.consumedInvoiceIds.has(params.expectedInvoiceId) ) { return { paid: false as const, reason: "replay_detected" }; } const tx = await gate.getTransaction(params.txHash); const height = Number(tx.height); if ( tx.code === undefined || tx.code === null || String(tx.code) !== "0" || !Number.isFinite(height) || height <= 0 ) { return { paid: false as const, reason: "tx_failed_or_uncommitted" }; } const memo = decodeBase64Utf8(tx.payload); if (memo !== params.expectedInvoiceId) { return { paid: false as const, reason: "invoice_mismatch" }; } const requiredPip = parsePip(params.expectedAmountDecimal); const targetMx = params.merchantMx.toLowerCase(); const txType = Number(tx.type); const data = tx.data as Record; let receivedPip = 0n; if (txType === 1) { const to = String(data.to ?? "").toLowerCase(); const coinId = Number(data.coin?.id); if (to === targetMx && coinId === params.expectedCoinId) { receivedPip = BigInt(String(data.value ?? "0")); } } else if (txType === 13 && Array.isArray(data.list)) { for (const item of data.list) { if ( String(item.to ?? "").toLowerCase() === targetMx && Number(item.coin?.id) === params.expectedCoinId ) { receivedPip += BigInt(String(item.value ?? "0")); } } } else { return { paid: false as const, reason: "unsupported_tx_type" }; } if (receivedPip < requiredPip) { return { paid: false as const, reason: "underpaid", shortfallPip: requiredPip - receivedPip, }; } params.consumedTxHashes.add(hashKey); params.consumedInvoiceIds.add(params.expectedInvoiceId); return { paid: true as const, height: BigInt(tx.height), receivedPip }; } // 2. Sequential exchange block scanner (Send + Multisend + RedeemCheck) export async function scanCommittedBlock( height: bigint, watchedAddressesLower: Set, onCredit: (entry: { idempotencyKey: string; to: string; coinId: number; amountPip: bigint; memo: string; }) => void, ) { const nodeV2Url = process.env.MINTER_NODE_V2_URL; if (!nodeV2Url) throw new Error("Set MINTER_NODE_V2_URL to the base /v2 URL of your own node"); const res = await fetch(`${nodeV2Url}/block/${height}?failed_txs=true`); if (res.ok === false) { throw new Error(`Block ${height} HTTP ${res.status}`); } const block = (await res.json()) as { transactions?: Array> }; for (const tx of block.transactions ?? []) { const ok = tx.code !== undefined && tx.code !== null && String(tx.code) === "0"; if (ok === false) { // For watched hot wallets, account for failed_tx fee (nonce does not increment) continue; } const txType = Number(tx.type); const memo = decodeBase64Utf8(tx.payload); if (txType === 1) { const to = String(tx.data?.to ?? "").toLowerCase(); const coinId = Number(tx.data?.coin?.id); if (watchedAddressesLower.has(to) && WHITELISTED_COINS.has(coinId)) { onCredit({ idempotencyKey: `${tx.hash}:0`, to, coinId, amountPip: BigInt(String(tx.data.value)), memo, }); } } else if (txType === 13 && Array.isArray(tx.data?.list)) { tx.data.list.forEach((item: Record, ordinal: number) => { const to = String(item.to ?? "").toLowerCase(); const coinId = Number(item.coin?.id); if (watchedAddressesLower.has(to) && WHITELISTED_COINS.has(coinId)) { onCredit({ idempotencyKey: `${tx.hash}:${ordinal}`, to, coinId, amountPip: BigInt(String(item.value)), memo, }); } }); } else if (txType === 9 && tx.data?.check) { const redeemer = String(tx.from ?? "").toLowerCase(); const coinId = Number(tx.data.check.coin?.id); if (watchedAddressesLower.has(redeemer) && WHITELISTED_COINS.has(coinId)) { onCredit({ idempotencyKey: `${tx.hash}:0`, to: redeemer, coinId, amountPip: BigInt(String(tx.data.check.value)), memo, }); } } } } // 3. Centrifugo WebSocket subscriber with reconnect block catch-up export function subscribeMerchantPayments( merchantMx: MxAddress, onTxCandidate: (txHash: string) => Promise, catchUpMissedBlocks: () => Promise, ) { const client = new Centrifuge(WS_URL, { minReconnectDelay: 500, maxReconnectDelay: 5_000, }); const channel = `explorer:address:${merchantMx.toLowerCase()}`; const sub = client.newSubscription(channel, { recoverable: true }); sub.on("publication", (ctx) => { const payload = ctx.data as { kind?: string; transaction?: { hash?: string; code?: string | number }; }; if (payload?.kind === "transaction" && typeof payload.transaction?.hash === "string") { void onTxCandidate(payload.transaction.hash); } }); sub.on("subscribed", (ctx) => { if (ctx.wasRecovering && ctx.recovered === false) { void catchUpMissedBlocks(); } }); sub.subscribe(); client.connect(); return () => client.disconnect(); } ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash GATE_URL="${MINTER_GATE_URL:-https://gate.minter.network/v2}" # 1. Inspect committed payment transaction (code, height, coin.id are strings) curl -sS "${GATE_URL}/transaction/Mte53eeda7a4268983a7ea5481cf150ae9d6ef76c1e497f7489d99805a812b7011" # 2. Fetch committed block with failed transactions for hot-wallet reconciliation curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/block/40848100?failed_txs=true" ``` > **[info] Partial payments and batched payouts** > Compare amounts in integer `pip` (`receivedPip >= requiredPip`). When a buyer sends less than `requiredPip`, record the exact shortfall `requiredPip - receivedPip` as `partially_paid`. For outgoing withdrawals, batch up to `100` recipients in a single `Multisend (0x0D)` transaction at `$0.01 + $0.005 * (N - 1)`. ### Checks Mc… (0x09) URL: https://docs.minter.network/developers/gasless-checks Summary: Two-key secp256k1 specification for Mc… checks and RedeemCheck (0x09): Lock encoding as big.Int, 16-byte nonce cap, gasPrice/gasCoin invariants, and off-chain balance rules. An `Mc...` check is an off-chain voucher protected by two `secp256k1` signatures (`issuerKey` and `passKey`) and redeemed on-chain via `RedeemCheck (0x09)`. The `$0.03` fee in `check.gasCoin` is deducted from the check issuer, allowing a recipient address with `0 pip` balance to claim funds without prior gas funding. > **[warn] Check issuance does not reserve issuer funds** > Issuing a check happens offline and does not lock coins on the issuer's account. Both the check principal `value` and the `$0.03` fee are deducted from the issuer only when `RedeemCheck (0x09)` is committed in a block. If the issuer's balance is below the required principal or fee in `check.gasCoin` at redemption time, the node rejects the transaction. Before `dueBlock`, an unredeemed check can only be invalidated by moving the funds out of the issuer's address. ## Two-key scheme and `Lock` encoding Building an `Mc...` check takes five local steps: 1. Derive the 32-byte scalar `passKey = SHA256(UTF8(passphrase))`. 2. Choose a `nonce` of `1` to `16` bytes. If `len(nonce) > 16`, the node rejects redemption with `TooLongNonce`. 3. Hash the 6-field check body (`dueBlock` is encoded as `uint64`): ```text bodyHash = Keccak256(RLP([nonce, chainId, dueBlock, coinId, value, gasCoin])) ``` 4. Sign `bodyHash` with `passKey` (`RFC 6979`, `lowS`) to produce the 65-byte Go-layout recoverable signature `lockBytes65 = r_be32 || s_be32 || recoveryByte` (`recoveryByte` in `{0, 1}`). In the reference Go node (`check.go`), `Lock` has type `*big.Int`, so RLP encodes `trimLeadingZeros(lockBytes65)` with any leading `0x00` bytes removed. Encoding all 65 bytes verbatim when `r[0] == 0x00` (roughly 1 in 256 checks) alters `checkHash` and breaks issuer address recovery. 5. Hash the 7-element list and sign `checkHash` with `issuerKey` (`v = recovery + 27`, stripping leading `0x00` bytes from `r` and `s`): ```text lockTrimmed = trimLeadingZeros(lockBytes65) checkHash = Keccak256(RLP([nonce, chainId, dueBlock, coinId, value, gasCoin, lockTrimmed])) rawCheck = "Mc" + hexLower(RLP([nonce, chainId, dueBlock, coinId, value, gasCoin, lockTrimmed, v, r, s])) ``` To redeem (`RedeemCheck 0x09`), the recipient (`recipientAddress20B`) computes `addrHash = Keccak256(RLP([recipientAddress20B]))` and signs `addrHash` with `passKey` to form the 65-byte `proofBytes65 = r_be32 || s_be32 || recoveryByte`. The node recovers `ecrecover(bodyHash, lock)` and `ecrecover(addrHash, proof)`: matching public keys prove knowledge of `passphrase` bound to `tx.sender`. A mempool observer cannot redirect the check to another address because changing `tx.sender` changes `addrHash`, though anyone who obtains `passphrase` off-chain can submit their own `RedeemCheck` first. Consensus envelope rules for `RedeemCheck (0x09)`: 1. `tx.gasPrice === 1`: any multiplier greater than `1` fails with `TooHighGasPrice` (preventing a redeemer from draining the issuer's balance through inflated gas). 2. `tx.gasCoin === check.gasCoin`: any mismatch between the outer transaction `gasCoin` and `check.gasCoin` fails with `WrongGasCoin`. ## Issuing and redeeming in `@minter-network/tx-core` `buildRedeemCheckTx` decodes `rawCheck`, validates `nonce` byte length, and sets `gasPrice: 1` and `gasCoin: check.gasCoin`. #### TypeScript (@minter-network/tx-core) ```typescript import { MinterGateClient, buildRedeemCheckTx, createCheckProof, decodeCheck, issueCheck, parsePip, signTx, } from "@minter-network/tx-core"; import type { MinterWallet } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const issuerWallet: MinterWallet; declare const recipientWallet: MinterWallet; const gate = new MinterGateClient( process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2", ); const status = await gate.getStatus(); const dueBlock = BigInt(status.latest_block_height) + 200_000n; // 1. Issue an off-chain check for 50 USDTE (UTF-8 nonce <= 16 bytes) const { rawCheck } = issueCheck( { nonce: "onboarding-001", chainId: 1, dueBlock, coinId: 1993, valuePip: parsePip("50"), gasCoin: 1993, passphrase: "correct-horse-battery-staple", }, issuerWallet.privateKey, ); // 2. Decode metadata locally and build recipient-bound proof (0 BIP on recipient) const decoded = decodeCheck(rawCheck); const { proofBytes } = createCheckProof( recipientWallet.address, "correct-horse-battery-staple", ); const recipientNonce = await gate.getNextNonce(recipientWallet.address); const redeemUnsigned = buildRedeemCheckTx({ nonce: recipientNonce, chainId: 1, rawCheck, proof: proofBytes, }); const signed = signTx(redeemUnsigned, recipientWallet.privateKey); const mempool = await gate.sendTransaction(signed.signedRawTxHex); if (mempool.code !== "0") { throw new Error(`CheckTx rejected (${mempool.code}): ${mempool.log}`); } const committed = await gate.waitForTransaction(signed.txHash); console.log("Redeemed at height:", committed.height, "amount pip:", decoded.valuePip); ``` #### cURL ```bash GATE_URL="${MINTER_GATE_URL:-https://gate.minter.network/v2}" # Broadcast signed RedeemCheck (0x09) with gasPrice=1 and gasCoin=check.gasCoin (1993 RLP-encoded as 0x8207c9) curl -sS -X POST "${GATE_URL}/send_transaction" \ -H "Content-Type: application/json" \ -d '{"tx": "0xf901440101018207c909b8f1f8efb8aaf8a88b63686b2d757466382d3032018402aea5408207c989056bc75e2d631000008207c9b841b0760871eb0b1f1dfdafd98a32fbca5f5177ee3490c574dcd993e8e158a69b495ab10610294441e9fb0fe1f96bd1e985a80d8cb3c4a34a197dc217b354cc479a001ba022783bc7a87e3ee24b2542083e73a4a52b878a69aab6f5a8d3dd1c636702c7cca079ed464b2107c9bd4fbef7c07a8faab39588a64c9382288d36c7e58ddd787bceb84167318e7c5b62f19f1825e78edb7665470808064ffd2da9dc72d15b6ec8c357ef4a0ef873740ad068835436965e25aed64711e41f611d0f5d4d90bec393fe48b400808001b845f8431ca03581b1619f6c988b28c72dff59c95cd4763776e4fe452fd7ade75d7939eb233ba06efa5509f92c64a311b6a98b7a8c4d6cdcc0355fc1aead0178826717a91ee7d6"}' curl -sS "${GATE_URL}/transaction/Mt9e3c45a94283bdb7fb66f34c49340f40b7aa1434ae9d296f7cf87208aab5b3ec" ``` ## Passing checks in web links When building a web claim link, place `Mc...` and the passphrase in the URL `#fragment` rather than `?query` parameters (`https://app.example/claim#redeem=Mc...&p=...`). Query strings travel in HTTP requests, server access logs, and `Referer` headers. Although the `#fragment` is not sent over the network, it remains readable to scripts running on the page (analytics tags, browser extensions) and persists in browser history, so read `window.location.hash` into memory on mount and clear the address bar via `history.replaceState(null, "", window.location.pathname)`. ### Multisig (0x0C) URL: https://docs.minter.network/developers/multisig Summary: Weighted multisig accounts in Minter v3.3.0: CreateMultisig (0x0C), EditMultisig (0x12), SignatureMulti (0x02) assembly, and an isolated Cooler policy signer. `CreateMultisig (0x0C)` creates a protocol `Mx...` account configured with `1` to `32` unique participant `addresses[]`, per-signer `weights[]` (each `<= 1023`), and a `threshold` (`threshold <= sum(weights)`). `ExecutorV3` executes any of the 37 active transaction types from that address under `signatureType = 0x02` once the weights of unique valid signers reach `threshold`. ## Creation (`0x0C`), rotation (`0x12`) and `SignatureMulti` | Opcode | Operation | Fee (`USDTE`) | Inner RLP `data` schema | Protocol constraints | | :---: | :--- | :---: | :--- | :--- | | `0x0C` | `CREATE_MULTISIG` | `$0.10` | `[threshold: u32, weights: u32[], addresses: bytes20[]]` | `1..32` unique `Mx...` addresses; weight `<= 1023`; `threshold <= sum(weights)` | | `0x12` | `EDIT_MULTISIG` | `$0.10` | `[threshold: u32, weights: u32[], addresses: bytes20[]]` | Sent from the multisig address itself (`signatureType = 0x02`) | The created multisig address is derived deterministically from the creator's address and creation transaction `nonce`: `deriveMultisigAddress(creatorMx, nonce)` (`Keccak256(RLP([creator20B, nonce]))[12..32]`). Rules for assembling `SignatureMulti` (`signatureType = 0x02`): 1. Set `nonce` to `transaction_count + 1n` of the multisig account itself (a newly created multisig starts at `transaction_count = 0`, so its first outgoing transaction uses `nonce: 1n`). 2. Each co-signer signs `signingHash = Keccak256(RLP([nonce, chainId, gasPrice, gasCoin, type, dataBytes, payload, serviceData, 0x02]))`. 3. Encode outer field `#9` (`signatureData`) as `RLP([multisigAddress20B, [[v1, r1, s1], [v2, r2, s2], ...]])`. 4. The Minter protocol does not require lexicographical signature sorting: the node recovers each signer via `ecrecover`, rejects duplicate signers, matches each recovered address against `addresses[]`, and verifies `sum(weights) >= threshold`. Ordering `signatures[]` to match `addresses[]` is an application convention so independent co-signers produce byte-identical `signedRawTxHex` and the same `Mt...` hash. 5. Off-chain `.msig` JSON draft files are an external application convention rather than a built-in `@minter-network/tx-core` format (`decodeRawTx` decodes complete 10-field signed transactions; to inspect an unsigned draft, pass structured `UnsignedTx` fields and decode inner `data` via `decodeTxData`). #### TypeScript (@minter-network/tx-core) ```typescript import { MinterGateClient, assembleMultisigTx, buildCreateMultisigTx, buildSendTx, deriveMultisigAddress, parsePip, signTx, signTxForMultisig, } from "@minter-network/tx-core"; import type { MinterWallet } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const owner1: MinterWallet; declare const owner2: MinterWallet; declare const owner3: MinterWallet; const gate = new MinterGateClient( process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2", ); // 1. Create a 2-of-3 multisig (weights [400, 400, 600], threshold 800) const creatorNonce = await gate.getNextNonce(owner1.address); const createUnsigned = buildCreateMultisigTx( { threshold: 800, weights: [400, 400, 600], addresses: [owner1.address, owner2.address, owner3.address], }, { nonce: creatorNonce, chainId: 1, gasCoin: 1993 }, ); const createSigned = signTx(createUnsigned, owner1.privateKey); await gate.sendTransaction(createSigned.signedRawTxHex); await gate.waitForTransaction(createSigned.txHash); const multisigMx = deriveMultisigAddress(owner1.address, creatorNonce); // 2. First payout from the multisig account (transaction_count = 0 -> nonce = 1n) const unsignedPayout = buildSendTx( { coinId: 1993, to: "Mx3a7b9104e82d19c64f01b5a8e9c72104d3e811f0", valuePip: parsePip("1000"), }, { nonce: 1n, chainId: 1, gasPrice: 1, gasCoin: 1993, payload: "treasury:payout-Q4", signatureType: 2, }, ); const sig1 = signTxForMultisig(unsignedPayout, owner1.privateKey); const sig2 = signTxForMultisig(unsignedPayout, owner2.privateKey); const { signedRawTxHex, txHash } = assembleMultisigTx( unsignedPayout, multisigMx, [sig1, sig2], ); await gate.sendTransaction(signedRawTxHex); await gate.waitForTransaction(txHash); ``` #### cURL ```bash GATE_URL="${MINTER_GATE_URL:-https://gate.minter.network/v2}" # Query multisig weights, threshold, addresses[], and transaction_count curl -sS "${GATE_URL}/address/Mx8c3e6ba8824854141383c7d8054e671b8773efc1" ``` ## `Hot / Cooler / Cold` custody and policy signer If the only signing key resides on an internet-facing server, a compromised process can drain the treasury. Assigning weights `[400, 400, 600]` with `threshold = 800` splits authority across three keys: 1. `Hot` (weight `400`) runs inside the application worker or AI agent, builds `UnsignedTx`, and produces `sigHot`, which alone cannot reach `800`. 2. `Cooler` (weight `400`) runs on an isolated host with no inbound ports, pulls signing requests from a queue, verifies `sigHot` via `ecrecover`, validates `chainId`, `signatureType`, `gasCoin`, opcode, recipient allowlist, and per-`coinId` caps, and appends `sigCooler` (`400 + 400 = 800`). 3. `Cold` (weight `600`) stays offline and pairs with `Cooler` (`1000 >= 800`) to rotate a compromised `Hot` key via `EditMultisig (0x12)`, or pairs with `Hot` (`1000 >= 800`) during `Cooler` hardware maintenance. | Signer combination | Weight sum | Node decision (`threshold = 800`) | Operational role | | :--- | :---: | :--- | :--- | | `Hot` only | `400` | Rejected (`< 800`) | Compromised web worker or agent cannot move funds | | `Hot` + `Cooler` | `800` | Executed (`>= 800`) | Automated payouts within policy limits | | `Cold` + `Cooler` | `1000` | Executed (`>= 800`) | Rotate `Hot` key via `EditMultisig (0x12)` | | `Cold` + `Hot` | `1000` | Executed (`>= 800`) | Recovery signing if `Cooler` host is offline | ```typescript import { SIGNATURE_TYPE, TX_TYPE, assembleMultisigTx, computeSigningHash, decodeTxData, parsePip, recoverAddressFromVrs, signTxForMultisig, type EcdsaSignatureVrs, type MxAddress, type SendTxData, type UnsignedTx, } from "@minter-network/tx-core"; const ALLOWED_GAS_COINS = new Set([0, 1993]); const ALLOWED_RECIPIENTS = new Set([ "mx3a7b9104e82d19c64f01b5a8e9c72104d3e811f0", ]); // Separate per-coinId caps in pip const MAX_PER_TX_BY_COIN = new Map([ [1993, parsePip("250")], // max 250 USDTE per transaction [0, parsePip("50000")], // max 50,000 BIP per transaction ]); export function coolerCoSignIfCompliant(params: { unsignedTx: UnsignedTx; multisigMx: MxAddress; expectedHotMx: MxAddress; sigHot: EcdsaSignatureVrs; coolerPrivateKey: Uint8Array; }) { const { unsignedTx, multisigMx, expectedHotMx, sigHot, coolerPrivateKey } = params; if (unsignedTx.chainId !== 1) { throw new Error(`Unexpected chainId: ${unsignedTx.chainId}`); } if (unsignedTx.signatureType !== SIGNATURE_TYPE.MULTISIG) { throw new Error(`Expected signatureType 2, got ${unsignedTx.signatureType}`); } if (ALLOWED_GAS_COINS.has(unsignedTx.gasCoin) === false) { throw new Error(`Disallowed gasCoin: ${unsignedTx.gasCoin}`); } if (unsignedTx.gasPrice !== 1) { throw new Error(`Disallowed gasPrice: ${unsignedTx.gasPrice}`); } if (unsignedTx.payload.length + unsignedTx.serviceData.length > 256) { throw new Error("Payload/serviceData exceeds Cooler policy (256 bytes)"); } const signingHash = computeSigningHash(unsignedTx); const recoveredHot = recoverAddressFromVrs(signingHash, sigHot); if (recoveredHot.toLowerCase() !== expectedHotMx.toLowerCase()) { throw new Error(`sigHot signer mismatch: ${recoveredHot}`); } // Reject EditMultisig (0x12), Unbond (0x08), and all opcodes except Send (0x01) if (unsignedTx.type !== TX_TYPE.SEND) { throw new Error(`Opcode not permitted by policy: 0x${unsignedTx.type.toString(16)}`); } const send = decodeTxData(TX_TYPE.SEND, unsignedTx.data) as SendTxData; if (ALLOWED_RECIPIENTS.has(send.to.toLowerCase()) === false) { throw new Error(`Recipient not in allowlist: ${send.to}`); } const maxPip = MAX_PER_TX_BY_COIN.get(send.coinId); if (maxPip === undefined) { throw new Error(`Asset coinId ${send.coinId} is not permitted`); } if (send.valuePip > maxPip) { throw new Error(`Amount ${send.valuePip} pip exceeds cap ${maxPip} pip for coinId ${send.coinId}`); } const sigCooler = signTxForMultisig(unsignedTx, coolerPrivateKey); return assembleMultisigTx(unsignedTx, multisigMx, [sigHot, sigCooler]); } ``` ### Test vectors and porting URL: https://docs.minter.network/developers/test-vectors-and-porting Summary: Structure of test-vectors.json, canonical Minter v3.3.0 RLP rules, and self-contained signing implementations in Python and Rust. [`test-vectors.json`](https://docs.minter.network/test-vectors.json) contains Minter `v3.3.0` serialization and signing regression fixtures: 37 signed active transaction vectors (`activeVectors`), 1 RLP data vector for inactive opcode `0x13 PRICE_VOTE` (`inactiveRlpVectors`), a weighted multisig vector (`multisigVectors`), two-key check vectors (`checkVectors`), and non-canonical RLP test cases (`negativeRlpVectors`). `@minter-network/tx-core` generates these fixtures (when cross-checked with `minter-go-node`, entries carry `goNodeVerified`; otherwise treat the suite as regression fixtures rather than an independent external oracle). ## Structure of `/test-vectors.json` and verification stages Each `activeVectors` entry provides typed `input` fields, `envelope` metadata, and hex outputs for four sequential encoding stages: ```json { "id": "tx-0x01-send", "txTypeCode": 1, "txTypeHex": "0x01", "txTypeName": "SEND", "envelope": { "nonce": "1", "chainId": 1, "gasPrice": 1, "gasCoin": 0, "payloadUtf8": "invoice:2026-11", "signatureType": 1 }, "input": { "coinId": 0, "to": "Mx6fac4d18c912343bf86fa7049364dd4e424ab9c0", "valuePip": "12500000000000000000" }, "privateKeyHex": "1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727", "signerAddress": "Mx9858effd232b4033e47d90003d41ec34ecaeda94", "dataBytesHex": "0xdf80946fac4d18c912343bf86fa7049364dd4e424ab9c088ad78ebc5ac620000", "signingHash": "0x4fdf01449f56ca56b2310e91e17d5cf07d930578ccf620d2354b0bf8edb47617", "signedRawTxHex": "0xf87f0101018001a0df80946fac4d18c912343bf86fa7049364dd4e424ab9c088ad78ebc5ac6200008f696e766f6963653a323032362d31318001b845f8431ba04acb879e7e90f8475c553a23e4c2f11c7ba71ff8a36cc4ae15dc1a74f2fdc511a04da0b3d26cde48103cde55dd74e9d867e539cbbb8516f74cb3dd085b4dc951de", "txHash": "Mte53eeda7a4268983a7ea5481cf150ae9d6ef76c1e497f7489d99805a812b7011" } ``` Test each top-level array according to its scope: 1. `activeVectors` (`37` entries): assert `dataBytesHex`, `signingHash`, `signedRawTxHex`, and `txHash` in sequence. 2. `inactiveRlpVectors` (`0x13 PRICE_VOTE`): assert `dataBytesHex` encoding and decoding only (`0x13` has no registered handler in `v3.3.0` and no `signedRawTxHex`). 3. `multisigVectors` and `checkVectors`: assert `SignatureMulti (0x02)` assembly and leading-zero stripping on the check `Lock` field. 4. `negativeRlpVectors`: assert rejection at the target decoder layer (for example, raw byte `0x00` is a valid single-byte RLP string and fails specifically when decoded as an unsigned integer). ## Canonical 10-field RLP envelope and byte rules Every signed Minter `v3.3.0` transaction encodes as an outer RLP list of 10 items (up to `16_144` bytes total): ```text SignedTxRLP = RLP([ 0: nonce, // uint64 (big-endian with no leading zero bytes; 1 -> 0x01) 1: chainId, // uint8 (1 = Mainnet, 2 = Testnet) 2: gasPrice, // uint32 (minimum 1 -> 0x01) 3: gasCoin, // uint32 (0 = BIP -> empty slice -> 0x80) 4: type, // uint8 (TX_TYPE opcode 0x01..0x26) 5: data, // bytes (RLP-encoded inner struct wrapped as byte string) 6: payload, // bytes (up to 10,000 bytes; empty -> 0x80) 7: serviceData, // bytes (up to 128 bytes; empty -> 0x80) 8: signatureType, // uint8 (0x01 = Single, 0x02 = Multisig) 9: signatureData // bytes (RLP-encoded [v, r, s] or [multisig20B, sigs[]] as byte string) ]) ``` Five byte-level rules govern custom implementations: 1. Unsigned integer `0` serializes as an empty byte slice (RLP byte `0x80`). Encoding `0` as `0x00` in integer fields (`gasCoin`, `value`, `minimumValueToBuy`) fails with `non-canonical integer`. 2. Fields `data` (`#5`) and `signatureData` (`#9`) use double RLP wrapping: encode the inner list into bytes first, then pass that buffer into the outer 10-field list as a byte string rather than a nested list. 3. Coin and token tickers in `0x05`, `0x10`, `0x11`, `0x1E`, and `0x1F` occupy `10` ASCII bytes right-padded with `0x00` (`[10]byte`). 4. Signature scalars `v, r, s` encode as unsigned integers with no leading zero bytes (`v = recovery + 27`, `s` normalized to lower-half `secp256k1` order). In `Mc...` checks, the 65-byte `Lock` signature also encodes as `*big.Int` with leading `0x00` bytes stripped. 5. Signing and network indexing use distinct hash functions: `signingHash = Keccak256(RLP(fields 0..8))` (original Keccak `0x01` padding, not NIST `SHA3-256` `0x06` padding), whereas `txHash = "Mt" + hexLower(SHA256(SignedTxRLP))` hashes all 10 fields. | Language | `secp256k1` (RFC 6979 + recovery) | `Keccak-256` (`0x01` pad) | `SHA-256` (`Mt...`) | Integer `pip` type | | :--- | :--- | :--- | :--- | :--- | | TypeScript | `@noble/curves/secp256k1.js` | `@noble/hashes/sha3.js` | `@noble/hashes/sha2.js` | `bigint` | | Python 3.11+ | `coincurve` (`PrivateKey.sign_recoverable`) | `pycryptodome` (`Crypto.Hash.keccak`) | `hashlib.sha256` | `int` | | Rust | `k256` (`SigningKey::sign_prehash_recoverable`) | `sha3::Keccak256` | `sha2::Sha256` | `u128` / `alloy_primitives::U256` | | Go 1.22+ | `decred/dcrd/dcrec/secp256k1/v4` | `golang.org/x/crypto/sha3` (`NewLegacyKeccak256`) | `crypto/sha256` | `*math/big.Int` | | Swift | `secp256k1.swift` (`GigaBitcoin`) | `CryptoSwift` (`.keccak256`) | `CryptoKit.SHA256` | `BigUInt` | | Kotlin / JVM | `org.bouncycastle` (manual `low-S` and `recId`) | `Keccak.Digest256` | `MessageDigest("SHA-256")` | `java.math.BigInteger` | ## Self-contained Python 3.11+ implementation Install the dependencies in your Python environment: ```bash pip install pycryptodome coincurve ``` The module below implements canonical RLP encoding, `[10]byte` tickers, `Send (0x01)` signing, and verifies exact byte parity against `tx-0x01-send`: ```python import hashlib from Crypto.Hash import keccak from coincurve import PrivateKey def _encode_length(length: int, offset: int) -> bytes: if length < 56: return bytes([offset + length]) len_bytes = length.to_bytes((length.bit_length() + 7) // 8, "big") return bytes([offset + 55 + len(len_bytes)]) + len_bytes def rlp_encode(item: bytes | list) -> bytes: if isinstance(item, bytes): if len(item) == 1 and item[0] < 0x80: return item return _encode_length(len(item), 0x80) + item if isinstance(item, list): payload = b"".join(rlp_encode(elem) for elem in item) return _encode_length(len(payload), 0xC0) + payload raise TypeError(f"Unsupported RLP type: {type(item)}") def encode_uint(value: int) -> bytes: if value < 0: raise ValueError("Unsigned integer cannot be negative") if value == 0: return b"" return value.to_bytes((value.bit_length() + 7) // 8, "big") def encode_ticker10(symbol: str) -> bytes: raw = symbol.encode("ascii") if len(raw) < 3 or len(raw) > 10: raise ValueError("Ticker length must be in 3..10 ASCII bytes") return raw.ljust(10, b"\x00") def keccak256(data: bytes) -> bytes: h = keccak.new(digest_bits=256) h.update(data) return h.digest() def sign_send_tx( priv_hex: str, nonce: int, chain_id: int, gas_price: int, gas_coin: int, coin_id: int, to_mx: str, value_pip: int, payload: bytes = b"", service_data: bytes = b"", ) -> dict[str, str]: to_bytes = bytes.fromhex(to_mx[2:]) if len(to_bytes) != 20: raise ValueError("Recipient Mx address must be 20 bytes") data_bytes = rlp_encode([ encode_uint(coin_id), to_bytes, encode_uint(value_pip), ]) unsigned_rlp = rlp_encode([ encode_uint(nonce), encode_uint(chain_id), encode_uint(gas_price), encode_uint(gas_coin), encode_uint(0x01), data_bytes, payload, service_data, encode_uint(0x01), ]) signing_hash = keccak256(unsigned_rlp) # coincurve wraps libsecp256k1 with RFC 6979 and low-S normalization: [r(32) || s(32) || recid(1)] sig65 = PrivateKey(bytes.fromhex(priv_hex)).sign_recoverable(signing_hash, hasher=None) r_trimmed = sig65[:32].lstrip(b"\x00") s_trimmed = sig65[32:64].lstrip(b"\x00") v_uint = sig65[64] + 27 signature_data = rlp_encode([encode_uint(v_uint), r_trimmed, s_trimmed]) signed_rlp = rlp_encode([ encode_uint(nonce), encode_uint(chain_id), encode_uint(gas_price), encode_uint(gas_coin), encode_uint(0x01), data_bytes, payload, service_data, encode_uint(0x01), signature_data, ]) tx_hash = "Mt" + hashlib.sha256(signed_rlp).hexdigest() return { "dataBytesHex": "0x" + data_bytes.hex(), "signingHash": "0x" + signing_hash.hex(), "signedRawTxHex": "0x" + signed_rlp.hex(), "txHash": tx_hash, } if __name__ == "__main__": res = sign_send_tx( priv_hex="1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727", nonce=1, chain_id=1, gas_price=1, gas_coin=0, coin_id=0, to_mx="Mx6fac4d18c912343bf86fa7049364dd4e424ab9c0", value_pip=12_500_000_000_000_000_000, payload=b"invoice:2026-11", ) assert res["dataBytesHex"] == "0xdf80946fac4d18c912343bf86fa7049364dd4e424ab9c088ad78ebc5ac620000" assert res["signingHash"] == "0x4fdf01449f56ca56b2310e91e17d5cf07d930578ccf620d2354b0bf8edb47617" assert res["txHash"] == "Mte53eeda7a4268983a7ea5481cf150ae9d6ef76c1e497f7489d99805a812b7011" ``` ## Self-contained Rust implementation `Cargo.toml` dependencies: `alloy-rlp = "0.3"`, `k256 = { version = "0.13", features = ["ecdsa"] }`, `sha3 = "0.10"`, `sha2 = "0.10"`, `hex = "0.4"`. ```rust use alloy_rlp::{BufMut, Encodable, Header}; use k256::ecdsa::SigningKey; use sha2::{Digest as _, Sha256}; use sha3::Keccak256; pub struct SignedMinterTx { pub data_bytes_hex: String, pub signing_hash_hex: String, pub signed_raw_tx_hex: String, pub tx_hash: String, } pub fn encode_ticker10(symbol: &str) -> [u8; 10] { let raw = symbol.as_bytes(); let mut out = [0u8; 10]; let copy_len = raw.len().min(10); out[..copy_len].copy_from_slice(&raw[..copy_len]); out } fn trim_leading_zeros(bytes: &[u8]) -> &[u8] { let first_nonzero = bytes.iter().position(|&b| b != 0).unwrap_or(bytes.len()); &bytes[first_nonzero..] } fn encode_rlp_bytes_item(slice: &[u8], out: &mut Vec) { slice.encode(out); } pub fn sign_send_tx( priv_key_bytes: &[u8; 32], nonce: u64, chain_id: u8, gas_price: u32, gas_coin: u32, coin_id: u32, recipient_20: &[u8; 20], value_pip: u128, payload: &[u8], service_data: &[u8], ) -> Result { // 1. Inner SendData struct: RLP([coin_id, to, value_pip]) let mut inner_payload = Vec::new(); coin_id.encode(&mut inner_payload); encode_rlp_bytes_item(recipient_20, &mut inner_payload); value_pip.encode(&mut inner_payload); let mut data_bytes = Vec::new(); Header { list: true, payload_length: inner_payload.len(), } .encode(&mut data_bytes); data_bytes.put_slice(&inner_payload); // 2. 9-field signing list for Keccak-256 signingHash let sig_type: u8 = 0x01; let mut unsigned_items = Vec::new(); nonce.encode(&mut unsigned_items); chain_id.encode(&mut unsigned_items); gas_price.encode(&mut unsigned_items); gas_coin.encode(&mut unsigned_items); 0x01u8.encode(&mut unsigned_items); encode_rlp_bytes_item(&data_bytes, &mut unsigned_items); encode_rlp_bytes_item(payload, &mut unsigned_items); encode_rlp_bytes_item(service_data, &mut unsigned_items); sig_type.encode(&mut unsigned_items); let mut unsigned_rlp = Vec::new(); Header { list: true, payload_length: unsigned_items.len(), } .encode(&mut unsigned_rlp); unsigned_rlp.put_slice(&unsigned_items); let signing_hash = Keccak256::digest(&unsigned_rlp); // 3. RFC 6979 recoverable signature (k256 normalizes low-S by default) let signing_key = SigningKey::from_bytes(priv_key_bytes.into())?; let (sig, recid) = signing_key.sign_prehash_recoverable(&signing_hash)?; let sig_bytes = sig.to_bytes(); let r_trimmed = trim_leading_zeros(&sig_bytes[..32]); let s_trimmed = trim_leading_zeros(&sig_bytes[32..64]); let v_byte: u8 = recid.to_byte() + 27; let mut sig_tuple = Vec::new(); v_byte.encode(&mut sig_tuple); encode_rlp_bytes_item(r_trimmed, &mut sig_tuple); encode_rlp_bytes_item(s_trimmed, &mut sig_tuple); let mut signature_data = Vec::new(); Header { list: true, payload_length: sig_tuple.len(), } .encode(&mut signature_data); signature_data.put_slice(&sig_tuple); // 4. Outer 10-field signed RLP and Mt + SHA-256 network hash let mut signed_items = unsigned_items; encode_rlp_bytes_item(&signature_data, &mut signed_items); let mut signed_rlp = Vec::new(); Header { list: true, payload_length: signed_items.len(), } .encode(&mut signed_rlp); signed_rlp.put_slice(&signed_items); let sha_digest = Sha256::digest(&signed_rlp); Ok(SignedMinterTx { data_bytes_hex: String::from("0x") + &hex::encode(&data_bytes), signing_hash_hex: String::from("0x") + &hex::encode(signing_hash), signed_raw_tx_hex: String::from("0x") + &hex::encode(&signed_rlp), tx_hash: String::from("Mt") + &hex::encode(sha_digest), }) } ``` ### MCP and llms.txt URL: https://docs.minter.network/developers/mcp-and-llms Summary: Minter v3.3.0 execution model, four machine-readable documentation artifacts, and the @minter-network/docs-mcp stdio server (5 tools across 5 tracks). Minter `v3.3.0` does not execute user-deployed smart-contract bytecode: financial operations run inside the node as 37 active transaction handlers out of 38 declared opcodes `0x01..0x26` (`0x13 PRICE_VOTE` is not registered in `ExecutorV3`). A client builds and signs an RLP transaction for the target opcode, and the node validates field schemas and state invariants in `CheckTx` and `DeliverTx`. A client bug can submit wrong parameters, such as `minimumValueToBuy = 0`, but cannot deploy arbitrary contract code to the chain. | Aspect | User-bytecode VM chains | Minter `v3.3.0` | | :--- | :--- | :--- | | Execution logic | User-deployed contract bytecode | 37 built-in handlers `0x01..0x26` (`0x13` disabled) | | Fee pricing and gas coin | Native-coin gas auction or external paymaster contracts | 48-parameter `USDTE` (`1993`) tariff schedule paid in `BIP` or any liquid pool coin | | Settlement finality | Multi-block confirmation subject to chain reorganizations | Single-block Tendermint `v0.34.19` commit (`code === "0"`) without reorgs | ## Four machine-readable artifacts | Artifact | Path | Format and purpose | | :--- | :--- | :--- | | Section index | [`/llms.txt`](https://docs.minter.network/llms.txt) | Compact `llmstxt.org` directory of documentation pages and OpenAPI specs | | Full corpus (EN / RU) | [`/llms-full.txt`](https://docs.minter.network/llms-full.txt), [`/ru/llms-full.txt`](https://docs.minter.network/ru/llms-full.txt) | Single-file Markdown bundle containing RLP schemas, API docs, and TypeScript/cURL examples | | RAG chunk stream | [`/llms-rag.jsonl`](https://docs.minter.network/llms-rag.jsonl) | Section-split JSON Lines carrying `id`, `lang`, `url`, `heading_path`, `tokens`, and `sha256` metadata | | Serialization fixtures | [`/test-vectors.json`](https://docs.minter.network/test-vectors.json) | Regression vectors for 37 active opcodes, `0x13`, multisig, `Mc...` checks, and negative RLP inputs | ## `@minter-network/docs-mcp` stdio server `@minter-network/docs-mcp` runs locally over JSON-RPC 2.0 `stdio`, serves bundled documentation pages, the three OpenAPI 3.1 specifications, and `test-vectors.json` from package assets, and makes no outbound network requests. | MCP tool | Arguments and returned data | | :--- | :--- | | `search_minter_docs` | Full-text Orama search across all 5 tracks (`earn`, `developers`, `validators`, `protocol`, `api`) filtered by `en` or `ru` locale, with canonical portal links | | `get_tx_rlp_schema` | Ordered RLP `data` field schema, integer widths, opcode `0x01..0x26`, and base fee key | | `get_fee_schedule` | Snapshot of all 48 `v3.3.0` `PriceCommission` parameters in `USDTE` (`coinId: 1993`) plus linear `CEIL` conversion notes (query `GET /v2/price_commissions` for live on-chain governance state) | | `get_test_vector` | Lookup in `test-vectors.json` by opcode `0x01..0x26`, `multisig`, `check`, `negative`, or `summary` | | `get_openapi_endpoint` | Applicable servers, request parameters, and response JSON schemas from the three OpenAPI 3.1 specs (`gate`, `explorer`, `hub`) | Register in Claude Code CLI: ```bash claude mcp add minter-docs -- npx -y @minter-network/docs-mcp ``` Configure in `.cursor/mcp.json` or `mcp_config.json`: ```json { "mcpServers": { "minter-docs": { "command": "npx", "args": ["-y", "@minter-network/docs-mcp"] } } } ``` ## Project rules for `CLAUDE.md` ```markdown # Minter v3.3.0 rules - Network: use chainId 1 with base coin BIP on Mainnet and chainId 2 with base coin MNT on Public Testnet. Verify the current Testnet epoch at https://testnet.minter.network/status.json before signing. - Amounts: 1 coin = 10^18 pip. Use BigInt and parsePip/formatPip from @minter-network/tx-core; do not use IEEE-754 Number for balances, reserves, or fees. - Gate API v2 JSON: uint64 fields (code, height, type, coin.id) arrive as strings. Check tx.code === "0" and Number(tx.height) > 0 after gate.waitForTransaction(txHash). - RLP: integer 0 encodes as 0x80; coin tickers are [10]byte right-padded with 0x00; signingHash = Keccak256(9 fields); txHash = "Mt" + SHA256(10 fields); check Lock encodes as unsigned big.Int with leading 0x00 stripped. - Assets and DEX: match coins by numeric coin.id (0 = BIP on Mainnet, 1902 = HUB, 1993 = USDTE). Quote AMM pools with estimateAmmOutPip (998/1000, FLOOR - 1) and orderbook pairs with estimatePairV2SwapOutPip (deducting ceil(input / 1000)). ``` ### AI agent wallet URL: https://docs.minter.network/developers/cookbook-ai-agent-payments Summary: Autonomous HTTP 402 Payment Required settlement in USDTE (1993) with zero BIP balance, server-side payment verification, and external budget isolation. An autonomous AI agent wallet holds `USDTE` (`coinId: 1993`) with `0 BIP` and settles `HTTP 402 Payment Required` challenges via `Send (0x01)` using `gasCoin: 1993`. The node converts the fee (`$0.01` plus `$0.0002` per `payload` byte) through the `USDTE/BIP` pool, the agent waits for block commit via `gate.waitForTransaction(txHash)`, and the API server validates recipient, coin ID, amount, and one-time `invoiceId`. ## Agent client and `HTTP 402` server verifier The implementation below serializes concurrent agent calls onto a single `nonce` queue, checks `maxPerCallPip` and `sessionCapPip` including estimated network fees, screens `payload` with `SecretLeakGuard`, and performs full server-side verification on the `Mt...` receipt. #### TypeScript (@minter-network/tx-core) ```typescript import { MinterGateClient, SecretLeakGuard, buildSendTx, deriveWalletFromMnemonic, formatPip, parsePip, signTx, type MxAddress, } from "@minter-network/tx-core"; const USDTE_COIN_ID = 1993; const GATE_URL = process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2"; export interface Http402Challenge { serviceMx: MxAddress; coinId: number; pricePip: string; invoiceId: string; } // 1. Agent payer with serialized nonce queue and session budget caps export class MinterAgentWallet { private readonly gate: MinterGateClient; private readonly address: MxAddress; private readonly privateKey: Uint8Array; private readonly maxPerCallPip: bigint; private readonly sessionCapPip: bigint; private spentSessionPip = 0n; private queue: Promise = Promise.resolve(); constructor(opts: { gateUrl?: string; mnemonic: string; hdIndex?: number; maxPerCallUsdte: string; sessionCapUsdte: string; }) { this.gate = new MinterGateClient(opts.gateUrl ?? GATE_URL); const wallet = deriveWalletFromMnemonic(opts.mnemonic, opts.hdIndex ?? 0); this.address = wallet.address; this.privateKey = wallet.privateKey; this.maxPerCallPip = parsePip(opts.maxPerCallUsdte); this.sessionCapPip = parsePip(opts.sessionCapUsdte); } payHttp402(challenge: Http402Challenge) { const run = this.queue.then(() => this.executePayment(challenge)); this.queue = run.catch(() => undefined); return run; } private async executePayment(challenge: Http402Challenge) { if (challenge.coinId !== USDTE_COIN_ID) { throw new Error(`Unsupported challenge coinId: ${challenge.coinId}`); } const valuePip = BigInt(challenge.pricePip); if (valuePip <= 0n || valuePip > this.maxPerCallPip) { throw new Error(`Challenge amount ${valuePip} pip exceeds maxPerCallPip`); } const memo = challenge.invoiceId; SecretLeakGuard.assertSafePublicText(memo); const nonce = await this.gate.getNextNonce(this.address); const unsigned = buildSendTx( { coinId: USDTE_COIN_ID, to: challenge.serviceMx, valuePip, }, { nonce, chainId: 1, gasPrice: 1, gasCoin: USDTE_COIN_ID, payload: memo, }, ); const signed = signTx(unsigned, this.privateKey); const est = await this.gate.estimateTxCommission(signed.signedRawTxHex); const feePip = BigInt(est.commission); if (this.spentSessionPip + valuePip + feePip > this.sessionCapPip) { throw new Error("Session USDTE budget exhausted"); } const mempool = await this.gate.sendTransaction(signed.signedRawTxHex); if (mempool.code !== "0") { throw new Error(`CheckTx rejected (${mempool.code}): ${mempool.log}`); } const committed = await this.gate.waitForTransaction(signed.txHash); if (committed.code !== "0") { throw new Error(`DeliverTx failed (${committed.code}): ${committed.log ?? ""}`); } this.spentSessionPip += valuePip + feePip; return { txHash: committed.hash, height: committed.height, paidUsdte: formatPip(valuePip, { maxDecimals: 4 }), feeUsdte: formatPip(feePip, { maxDecimals: 4 }), }; } } // 2. Server-side X-Minter-Tx-Hash verifier on the paid API endpoint function decodeBase64Utf8(b64: string | undefined): string { if (b64 === undefined || b64 === "") return ""; const bin = atob(b64); const bytes = Uint8Array.from(bin, (c) => c.charCodeAt(0)); return new TextDecoder("utf-8", { fatal: false }).decode(bytes); } export async function verifyHttp402Header(params: { gate: MinterGateClient; txHash: string; serviceMx: MxAddress; expectedPricePip: bigint; expectedInvoiceId: string; consumedTxHashes: Set; consumedInvoiceIds: Set; }) { const hashKey = `mt${params.txHash.trim().replace(/^(mt|0x)/i, "").toLowerCase()}`; if ( params.consumedTxHashes.has(hashKey) || params.consumedInvoiceIds.has(params.expectedInvoiceId) ) { return { ok: false as const, error: "tx_or_invoice_already_used" }; } const tx = await params.gate.getTransaction(params.txHash); if ( tx.code === undefined || tx.code === null || String(tx.code) !== "0" || !(Number(tx.height) > 0) ) { return { ok: false as const, error: "tx_not_committed_or_failed" }; } if (Number(tx.type) !== 1) { return { ok: false as const, error: "expected_send_tx" }; } const data = tx.data as { to?: string; coin?: { id?: string }; value?: string; }; if (String(data.to ?? "").toLowerCase() !== params.serviceMx.toLowerCase()) { return { ok: false as const, error: "recipient_mismatch" }; } if (String(data.coin?.id ?? "") !== "1993") { return { ok: false as const, error: "wrong_coin_id" }; } if (BigInt(String(data.value ?? "0")) < params.expectedPricePip) { return { ok: false as const, error: "insufficient_amount" }; } if (decodeBase64Utf8(tx.payload) !== params.expectedInvoiceId) { return { ok: false as const, error: "invoice_id_mismatch" }; } params.consumedTxHashes.add(hashKey); params.consumedInvoiceIds.add(params.expectedInvoiceId); return { ok: true as const, height: tx.height }; } ``` #### cURL ```bash GATE_URL="${MINTER_GATE_URL:-https://gate.minter.network/v2}" # 1. Read agent USDTE balance (coin.id == "1993") and transaction_count curl -sS "${GATE_URL}/address/Mx9858effd232b4033e47d90003d41ec34ecaeda94" # 2. Verify submitted X-Minter-Tx-Hash on the API backend curl -sS "${GATE_URL}/transaction/Mte53eeda7a4268983a7ea5481cf150ae9d6ef76c1e497f7489d99805a812b7011" ``` ## Out-of-process budget isolation In-memory caps inside the agent runtime catch arithmetic bugs but cannot protect a private key inside a compromised container. Two cryptographic isolation patterns bound maximum spend outside the agent process: 1. Fixed-denomination `Mc...` checks ([Checks Mc… (0x09)](https://docs.minter.network/developers/gasless-checks)) issued from a dedicated sub-account funded only with the active task allowance and a bounded `dueBlock` (verify UTF-8 `nonce` length via `new TextEncoder().encode(id).length <= 16`). 2. Weighted `2-of-3` multisig with an isolated `Cooler` policy co-signer ([Multisig (0x0C)](https://docs.minter.network/developers/multisig#hot-cool-cold-custody)), where the agent holds only the `Hot` key (`weight 400 < 800`) and `Cooler` enforces recipient allowlists and daily `USDTE` (`1993`) caps. ### Token, pool and loyalty program URL: https://docs.minter.network/developers/cookbook-token-launch-and-loyalty Summary: Sequential CreateToken (0x1E) issuance, block confirmation, CreateSwapPool (0x22) setup for custom gas fees, Multisend (0x0D) batch rewards, and RedeemCheck (0x09). Launching a custom token whose holders can pay network fees in the token itself combines four Minter `v3.3.0` transactions in sequence: `CreateToken (0x1E)`, `CreateSwapPool (0x22)` paired against `BIP`, `Multisend (0x0D)` for batch payouts, and `RedeemCheck (0x09)` for zero-gas claim vouchers. ## Choosing between `CreateToken (0x1E)` and `CreateCoin (0x05)` | Property | Token (`CreateToken 0x1E`) | Reserve coin (`CreateCoin 0x05`) | | :--- | :--- | :--- | | Required `BIP` reserve at issuance | `0 BIP` (no protocol reserve) | `initialReserve >= 10,000 BIP`, `CRR` in `10..100` | | Supply mechanics | `MintToken (0x1C)` and `BurnToken (0x1D)` up to `maxSupply` | Algorithmic Bancor mint/burn against reserve (`0x02..0x04`) | | Trading and fee eligibility | `CreateSwapPool (0x22)` pools and limit orderbook (`0x23`) | Protocol CRR reserve plus `CreateSwapPool (0x22)` pools | One-time ticker length fees (`3..10` `A-Z0-9` characters, from `$100` for `7..10` chars up to `$50,000` for `3` chars in `USDTE` equivalent) are listed in [Execution, gas and fees](https://docs.minter.network/protocol/execution-and-fees#tariffs); reserve curve formulas are covered in [Coins, tokens and CRR reserve](https://docs.minter.network/protocol/coins-tokens-and-crr). > **[warn] Initial pool spot price and BIP liquidity** > `CreateToken (0x1E)` itself locks `0 BIP`, but enabling custom fee payment (`gasCoin: loyaltyCoinId`) requires seeding a liquid `loyaltyCoinId / BIP` pool via `CreateSwapPool (0x22)` (`$10.00` fee, requiring `floor(sqrt(volume0 * volume1)) > 1000`). The opening spot price equals `volume1Pip / volume0Pip`: verify both `pip` amounts before signing so arbitrage bots cannot buy mispriced reserves in the next block. ## End-to-end issuance, pool creation and reward distribution Query `/v2/coin_info/{symbol}` only after `await gate.waitForTransaction(createHash)` resolves: while `CreateToken` sits in the mempool, the symbol does not yet exist in state and `transaction_count` has not incremented. Once the creation block commits, increment `nonce1 + 1n` for `CreateSwapPool`. #### TypeScript (@minter-network/tx-core) ```typescript import { MinterGateClient, buildCreateSwapPoolTx, buildCreateTokenTx, buildMultisendTx, buildRedeemCheckTx, createCheckProof, issueCheck, parsePip, signTx, } from "@minter-network/tx-core"; import type { MinterWallet } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const brandWallet: MinterWallet; declare const customerWallet: MinterWallet; const GATE_URL = process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2"; const gate = new MinterGateClient(GATE_URL); const USDTE_ID = 1993; // 1. Issue 7-char token COFFEE7 ($100 fee in USDTE) and wait for block commit const nonce1 = await gate.getNextNonce(brandWallet.address); const createTx = signTx( buildCreateTokenTx( { name: "Roastery Loyalty Points", symbol: "COFFEE7", initialAmountPip: parsePip("1000000"), maxSupplyPip: parsePip("100000000"), mintable: true, burnable: true, }, { nonce: nonce1, chainId: 1, gasPrice: 1, gasCoin: USDTE_ID }, ), brandWallet.privateKey, ); await gate.sendTransaction(createTx.signedRawTxHex); await gate.waitForTransaction(createTx.txHash); // 2. Read assigned numeric coin.id after CreateToken is committed const coinInfo = await gate.getCoinInfo("COFFEE7"); const loyaltyCoinId = Number(coinInfo.id); if (Number.isInteger(loyaltyCoinId) === false || loyaltyCoinId <= 0) { throw new Error(`Invalid coin id: ${coinInfo.id}`); } // 3. Create BIP (0) / COFFEE7 pool (nonce1 + 1n) so holders can pay fees in COFFEE7 const nonce2 = nonce1 + 1n; const poolTx = signTx( buildCreateSwapPoolTx( { coin0: 0, coin1: loyaltyCoinId, volume0Pip: parsePip("50000"), volume1Pip: parsePip("250000"), }, { nonce: nonce2, chainId: 1, gasPrice: 1, gasCoin: USDTE_ID }, ), brandWallet.privateKey, ); await gate.sendTransaction(poolTx.signedRawTxHex); await gate.waitForTransaction(poolTx.txHash); // 4. Distribute batch rewards via Multisend (0x0D, nonce2 + 1n) const nonce3 = nonce2 + 1n; const batchTx = signTx( buildMultisendTx( { list: [ { coinId: loyaltyCoinId, to: "Mx3a7b9104e82d19c64f01b5a8e9c72104d3e811f0", valuePip: parsePip("150"), }, { coinId: loyaltyCoinId, to: "Mx77a1c409e21b8834d0125a9f0043e811c9ca51b0", valuePip: parsePip("300"), }, ], }, { nonce: nonce3, chainId: 1, gasPrice: 1, gasCoin: USDTE_ID, payload: "campaign:cashback-01", }, ), brandWallet.privateKey, ); await gate.sendTransaction(batchTx.signedRawTxHex); await gate.waitForTransaction(batchTx.txHash); // 5. Issue off-chain Mc... check and redeem via flat buildRedeemCheckTx (0 BIP on customer) const status = await gate.getStatus(); const { rawCheck } = issueCheck( { nonce: "perk-qr-0001", chainId: 1, dueBlock: BigInt(status.latest_block_height) + 100_000n, coinId: loyaltyCoinId, valuePip: parsePip("100"), gasCoin: USDTE_ID, passphrase: "latte-claim-secret", }, brandWallet.privateKey, ); const { proofBytes } = createCheckProof( customerWallet.address, "latte-claim-secret", ); const customerNonce = await gate.getNextNonce(customerWallet.address); const redeemUnsigned = buildRedeemCheckTx({ nonce: customerNonce, chainId: 1, rawCheck, proof: proofBytes, }); const redeemSigned = signTx(redeemUnsigned, customerWallet.privateKey); await gate.sendTransaction(redeemSigned.signedRawTxHex); await gate.waitForTransaction(redeemSigned.txHash); ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash GATE_URL="${MINTER_GATE_URL:-https://gate.minter.network/v2}" # 1. Inspect numeric coin.id after CreateToken commits curl -sS "${GATE_URL}/coin_info/COFFEE7" # 2. Check BIP (0) / COFFEE7 pool reserves and LP supply curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/swap_pool/0/4501" # 3. Read holder balance by numeric coin.id for token-gated endpoints curl -sS "${GATE_URL}/address/Mx3a7b9104e82d19c64f01b5a8e9c72104d3e811f0" ``` ## Locking `LP` tokens (`Lock 0x26`) and verifying point redemptions To time-lock minted `LP-{poolId}` liquidity tokens on the issuer's `Mx...` address, submit `Lock (0x26)` (`$0.01` fee, schema `[dueBlock: uint32, coinId: uint32, value: uint256]`, where `dueBlock` is an absolute unlock block height `<= 4_294_967_295` and the exact `LP-{poolId}` balance is read from `/v2/address/{Mx}`). When accepting point redemptions at checkout or enforcing token-gating, reuse the verifier from [Payments and deposits](https://docs.minter.network/developers/payments-and-deposits#checkout): check `tx.code === "0"`, recipient `to`, stored numeric `loyaltyCoinId`, and `Mt...` hash uniqueness. ### DEX trading bot URL: https://docs.minter.network/developers/cookbook-dex-trading-bot Summary: Quoting SwapV2 and PairV2 pools with estimateAmmOutPip and estimatePairV2SwapOutPip, slippage-adjusted minimumValueToBuy, limit order constraints, and block confirmation. Trading pairs in Minter `v3.3.0` combine a constant-product `SwapV2` pool (`998/1000`, `0.20%` LP fee) with an on-chain `PairV2` limit orderbook (`AddLimitOrder 0x23`, `RemoveLimitOrder 0x24`). Market swaps across `1..4` pools (`2..5` coin IDs in `coins[]`) execute via `SellSwapPool (0x17)`, `BuySwapPool (0x18)`, and `SellAllSwapPool (0x19)` at a `$0.03` base fee plus `$0.005` per additional hop. ## Quoting formulas and protocol constraints `@minter-network/tx-core` provides two integer quoting helpers matching the Go state machine when no resting limit orders cross: 1. `estimateAmmOutPip(reserveInPip, reserveOutPip, amountInPip)` implements `swapV2.go:920-934`: `reserveOut - floor((reserveIn * reserveOut * 10^6) / (((amountIn + reserveIn) * 1000 - amountIn * 2) * 1000)) - 1` (clamped at `0n`). Omitting the `- 1` adjustment can overestimate node output by `1 pip` and trigger `MinimumValueToBuyReached`. 2. `estimatePairV2SwapOutPip(reserveInPip, reserveOutPip, amountInPip)` applies the `PairV2` rule (`orderV2.go:82-89`): before calling `estimateAmmOutPip`, it deducts `burnedIn = ceil(amountIn / 1000)` (`(amountIn + 999n) / 1000n`), which transfers to `Mx00cedde786b34d733d1dc96559253081572df2c6` without reducing total coin `Volume`. When resting limit orders cross the swap price, query `GET /v2/estimate_coin_sell` (`swap_from=pool`) for the combined AMM and orderbook output. | Parameter or operation | `ExecutorV3` rule | Bot behavior | | :--- | :--- | :--- | | Route `coins[]` length (`0x17..0x19`) | `2` to `5` coin IDs (`1..4` pools, no duplicate pools) | 3-pool triangular arbitrage settles in a single transaction | | Slippage guard `minimumValueToBuyPip` (`0x17`) | `FLOOR` rounding after slippage tolerance | If `DeliverTx` output `< minimumValueToBuyPip`, execution fails with `MinimumValueToBuyReached`; principal stays intact, `failed_tx` (`($0.01 + $0.0002 × payload bytes) × gasPrice`) is charged in `gasCoin`, and `nonce` does not increment | | Minimum order volume (`0x23`, `$0.10`) | `valueToSellPip >= 10^10 pip` and `valueToBuyPip >= 10^10 pip` | Orders below `10_000_000_000n pip` on either side are rejected | | Order price corridor (`0x23`) | `[P_pool / 5, P_pool]` (`[reversePoolPrice / 5, reversePoolPrice]`) | Resting orders cannot cross current pool price or sit beyond `5x` from spot; filled volume pays `ceil(0.1%)` on each side | | Order TTL and cancel (`0x24`, `$0.01`) | Expires after `483,840` blocks (~28 days at 5 s nominal block time) | Expired orders are swept at heights where `height % 720 === 360` | Full matching mechanics are specified in [DEX: pools and limit orders](https://docs.minter.network/protocol/hybrid-dex-amm-orderbook). ## Bot implementation with `@minter-network/tx-core` The module below quotes `PairV2` pools, computes `minimumValueToBuyPip` in basis points (`ROUNDING.FLOOR`), enforces the `>= 10^10 pip` limit order floor, and confirms every transaction via `gate.waitForTransaction(txHash)`. #### TypeScript (@minter-network/tx-core) ```typescript import { MinterGateClient, ROUNDING, buildAddLimitOrderTx, buildSellSwapPoolTx, divRoundBigInt, estimateAmmOutPip, estimatePairV2SwapOutPip, formatPip, parsePip, signTx, type MxAddress, } from "@minter-network/tx-core"; const GATE_URL = process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2"; const EXPLORER_API_URL = process.env.MINTER_EXPLORER_API_URL ?? "https://api-v2.minter.network/api/v2"; const MIN_LIMIT_ORDER_PIP = 10_000_000_000n; // 10^10 pip const gate = new MinterGateClient(GATE_URL); // 1. Local pool quote (SwapV2 vs PairV2) and slippage-adjusted minimumValueToBuy export function quotePoolWithSlippage(params: { reserveInPip: bigint; reserveOutPip: bigint; amountInPip: bigint; isOrderbookPairV2: boolean; slippageBps: bigint; // e.g. 50n = 0.50% }) { const expectedOutPip = params.isOrderbookPairV2 ? estimatePairV2SwapOutPip(params.reserveInPip, params.reserveOutPip, params.amountInPip) : estimateAmmOutPip(params.reserveInPip, params.reserveOutPip, params.amountInPip); const minimumValueToBuyPip = divRoundBigInt( expectedOutPip * (10_000n - params.slippageBps), 10_000n, ROUNDING.FLOOR, ); return { expectedOutPip, minimumValueToBuyPip }; } // 2. Hybrid route quote (AMM + orderbook) and broadcast with block confirmation export async function executeArbRouteIfProfitable(opts: { routeCoins: number[]; // e.g. [1993, 0, 1902, 1993] inputPip: bigint; minNetProfitPip: bigint; traderAddress: MxAddress; privateKey: Uint8Array; }) { const cIn = opts.routeCoins[0] ?? 0; const cOut = opts.routeCoins[opts.routeCoins.length - 1] ?? 0; const mids = opts.routeCoins .slice(1, -1) .map((c) => `&route=${c}`) .join(""); const nodeV2Url = process.env.MINTER_NODE_V2_URL; if (!nodeV2Url) throw new Error("Set MINTER_NODE_V2_URL to the base /v2 URL of your own node"); const quoteRes = await fetch( `${nodeV2Url}/estimate_coin_sell?coin_id_to_sell=${cIn}&coin_id_to_buy=${cOut}` + `&value_to_sell=${opts.inputPip.toString()}&swap_from=pool${mids}`, ); if (quoteRes.ok === false) return null; const quote = (await quoteRes.json()) as { will_get: string }; const expectedOutPip = BigInt(quote.will_get); // 3-pool route fee: $0.03 + 2 * $0.005 = $0.04 USDTE const feeBudgetPip = parsePip("0.04"); const requiredMinOutPip = opts.inputPip + feeBudgetPip + opts.minNetProfitPip; if (expectedOutPip < requiredMinOutPip) { return null; } // If DeliverTx output falls below requiredMinOutPip, the swap fails with // MinimumValueToBuyReached; failed_tx ($0.01 in gasCoin) is charged and nonce stays unchanged. const nonce = await gate.getNextNonce(opts.traderAddress); const unsigned = buildSellSwapPoolTx( { coins: opts.routeCoins, valueToSellPip: opts.inputPip, minimumValueToBuyPip: requiredMinOutPip, }, { nonce, chainId: 1, gasPrice: 1, gasCoin: 1993, }, ); const signed = signTx(unsigned, opts.privateKey); const mempool = await gate.sendTransaction(signed.signedRawTxHex); if (mempool.code !== "0") { throw new Error(`CheckTx rejected (${mempool.code}): ${mempool.log}`); } const committed = await gate.waitForTransaction(signed.txHash); if (committed.code !== "0") { throw new Error(`DeliverTx failed (${committed.code}): ${committed.log ?? ""}`); } return { txHash: committed.hash, height: committed.height, expectedNetUsdte: formatPip(expectedOutPip - opts.inputPip - feeBudgetPip, { maxDecimals: 4, }), }; } // 3. Submit maker limit order (0x23) enforcing >= 10^10 pip on both sides export async function submitLimitOrder(params: { traderAddress: MxAddress; privateKey: Uint8Array; coinToSell: number; valueToSellPip: bigint; coinToBuy: number; valueToBuyPip: bigint; poolId: number; }) { if ( params.valueToSellPip < MIN_LIMIT_ORDER_PIP || params.valueToBuyPip < MIN_LIMIT_ORDER_PIP ) { throw new RangeError("Limit order volumes must be >= 10^10 pip on both sides"); } // Read current orderbook depth from Explorer REST API v2 before quoting const bookRes = await fetch(`${EXPLORER_API_URL}/pools/${params.poolId}/book`); const book = bookRes.ok ? await bookRes.json() : null; const nonce = await gate.getNextNonce(params.traderAddress); const unsignedOrder = buildAddLimitOrderTx( { coinToSell: params.coinToSell, valueToSellPip: params.valueToSellPip, coinToBuy: params.coinToBuy, valueToBuyPip: params.valueToBuyPip, }, { nonce, chainId: 1, gasPrice: 1, gasCoin: 1993 }, ); const signed = signTx(unsignedOrder, params.privateKey); await gate.sendTransaction(signed.signedRawTxHex); const committed = await gate.waitForTransaction(signed.txHash); return { txHash: committed.hash, height: committed.height, book }; } ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash GATE_URL="${MINTER_GATE_URL:-https://gate.minter.network/v2}" EXPLORER_API_URL="${MINTER_EXPLORER_API_URL:-https://api-v2.minter.network/api/v2}" # 1. Read BIP (0) / USDTE (1993) pool reserves curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/swap_pool/0/1993" # 2. Quote hybrid AMM + orderbook output when selling 250 USDTE -> BIP curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/estimate_coin_sell?coin_id_to_sell=1993&coin_id_to_buy=0&value_to_sell=250000000000000000000&swap_from=pool" # 3. Inspect aggregated orderbook for pool #132 on Explorer API v2 curl -sS "${EXPLORER_API_URL}/pools/132/book" ``` ## Validators (validators) ### Node setup and configuration URL: https://docs.minter.network/validators/node-setup Summary: Hardware profiles, OS RLIMIT_NOFILE limits, building Minter Go Node v3.3.0, port matrix 26656..28843, config.toml profiles, and pruning old state versions. The `minter` binary (`Minter Go Node v3.3.0`, commit `235a4a2f7a69452e1a3be50d91b5a51bcc0d2ada`) runs consensus, `ExecutorV3` transaction execution, and state tree commits inside a single OS process (`cmd/minter/cmd/node.go:200-254`; see [node overview](https://docs.minter.network/protocol)). Disk `fsync` latency and file descriptor limits determine whether a validator signs within the nominal `5 s` block interval. ## Hardware profiles by node role | Node role | CPU (`x86_64`) | Memory (RAM) | Local disk (NVMe SSD) | `config.toml` profile | | :--- | :--- | :--- | :--- | :--- | | Validator | `8+` dedicated cores (`>= 3.2 GHz`) | `16..32 GB` ECC | `500 GB .. 1 TB` NVMe (`>= 40k IOPS`) | Private tunnel to Sentry nodes, `validator_mode = true`, `keep_last_states = 120`, `pex = false` | | Sentry node | `8` cores (`>= 3.0 GHz`) | `16..32 GB` | `1 TB` NVMe | Public `:26656`, `validator_mode = true`, `pex = true` | | Full RPC / Gate node | `8..16` cores | `32..64 GB` | `1.5..2 TB` NVMe | `validator_mode = false` (writes `events.db` and `tx_index.db`), `keep_last_states = 1000..5000` | | Archive node | `16+` cores | `64+ GB` ECC | `4+ TB` NVMe | `validator_mode = false`, `keep_last_states = 100000+` | > **[warn] Use local NVMe disks instead of network block storage** > On every `Prevote` and `Precommit` step, the node flushes `tmdata/cs.wal` and `priv_validator_state.json` with synchronous `fsync`. Latency spikes above `10 ms` on network-attached volumes cause missed votes; missing more than `12` of the last `24` blocks disables the candidate and imposes a `17,280`-block jail (see the [penalty table](/protocol/staking-lockstake-and-penalties#penalties)). ## OS preparation and `RLIMIT_NOFILE` At startup, `checkRlimits()` (`cmd/minter/cmd/node.go`) inspects the open file descriptor limit (`ulimit -n`) and aborts startup when: ```text RLIMIT_NOFILE < 10000 + state_mem_available ``` Set `ulimit -n >= 65535`, synchronize the system clock via `chrony`, install `gcc` for `CGO_ENABLED=1`, and create an unprivileged `minter` user (Ubuntu `22.04` / `24.04 LTS` or Debian `12`): ```bash sudo apt-get update && sudo apt-get install -y \ build-essential git curl jq zstd lz4 chrony ca-certificates timedatectl status | grep -E "System clock synchronized|NTP service" sudo useradd --system --create-home --home-dir /var/lib/minter --shell /usr/sbin/nologin minter sudo mkdir -p /var/lib/minter/.minter/config /var/lib/minter/.minter/data sudo chown -R minter:minter /var/lib/minter ``` ## Building `Minter Go Node v3.3.0` Build the node with Go Modules (`Go 1.21+`) without `$GOPATH`. Pass `CGO_ENABLED=1` and `-tags "minter gcc"` to link the C `libsecp256k1` library: ```bash git clone --branch v3.3.0 https://github.com/MinterTeam/minter-go-node.git /tmp/minter-go-node cd /tmp/minter-go-node git rev-parse HEAD # 235a4a2f7a69452e1a3be50d91b5a51bcc0d2ada CGO_ENABLED=1 go build \ -tags "minter gcc" \ -ldflags "-s -w -X github.com/MinterTeam/minter-go-node/version.Version=3.3.0" \ -o /tmp/minter \ ./cmd/minter sudo install -m 0755 /tmp/minter /usr/local/bin/minter minter version ``` On a node with HTTP API v2 enabled, verify sync status and the node public key: ```bash curl -sS http://localhost:28843/v2/status | jq '{ version, network, latest_block_height, catching_up, keep_last_states, public_key }' ``` ## Network ports and `config.toml` Application settings and embedded `Tendermint v0.34.19` parameters live in `~/.minter/config/config.toml`. If `api_v2_listen_addr` and `api_v2_grpc_listen_addr` are omitted, `config/config.go` falls back to `:8842` and `:8843`, so declare both addresses explicitly. | Port or socket | Protocol | `config.toml` key | Access rule | Purpose | | :--- | :--- | :--- | :--- | :--- | | `26656` | TCP | `p2p.laddr` | Public on Sentry and RPC nodes; private tunnel on validators | Block, consensus vote, and mempool gossip | | `26657` | TCP | `rpc.laddr` | `localhost:26657` only | Internal Tendermint JSON-RPC and `/websocket` | | `28842` | TCP | `api_v2_grpc_listen_addr` | Internal network or TLS proxy on RPC nodes (disabled on validators) | Minter Node gRPC API v2 (`ApiService`) | | `28843` | TCP | `api_v2_listen_addr` | Rate-limited reverse proxy on RPC nodes (disabled on validators) | Minter Node HTTP API v2 (`/v2/*` via `node-grpc-gateway`) | | `26660` | TCP | `instrumentation.prometheus_listen_addr` | `localhost` or private monitoring network | Prometheus metrics endpoint (`/metrics`) | | `manager.sock` | Unix | `~/.minter/manager.sock` | Mode `0600`, user `minter` | Local `minter console` administration socket | ### Private validator profile (`validator_mode = true`) On a signing validator, disable public API v2 listeners, `events.db` writes, and transaction tag indexing: ```toml moniker = "validator-01" validator_mode = true keep_last_states = 120 state_cache_size = 1000000 state_mem_available = 2048 halt_height = 0 api_v2_enabled = false api_v2_listen_addr = "localhost:28843" api_v2_grpc_listen_addr = "localhost:28842" [rpc] laddr = "tcp://localhost:26657" [p2p] laddr = "tcp://172.16.0.2:26656" pex = false persistent_peers = "@172.16.0.11:26656,@172.16.0.12:26656" unconditional_peer_ids = "," addr_book_strict = false send_rate = 20480000 recv_rate = 20480000 [mempool] size = 10000 max_txs_bytes = 536870912 cache_size = 20000 [tx_index] indexer = "null" [instrumentation] prometheus = true prometheus_listen_addr = "localhost:26660" ``` ### Public RPC / Gate profile (`validator_mode = false`) An RPC node serves `/v2/*`, maintains `events.db` and `tx_index.db`, and keeps recent state versions for `?height=` queries: ```toml moniker = "rpc-01" validator_mode = false keep_last_states = 5000 state_cache_size = 2000000 state_mem_available = 4096 api_v2_enabled = true api_v2_listen_addr = "localhost:28843" api_v2_grpc_listen_addr = "localhost:28842" api_v2_timeout = "15s" snapshot_interval = 5000 snapshot_keep_recent = 2 [rpc] laddr = "tcp://localhost:26657" [p2p] laddr = "tcp://0.0.0.0:26656" pex = true max_num_inbound_peers = 60 max_num_outbound_peers = 20 [tx_index] indexer = "kv" ``` Memory and halt parameters: - `keep_last_states` (`int64 >= 1`) sets the number of recent `IAVL` versions retained in `data/state.db` (`120` on validators, `1000..5000` on RPC nodes, `100000+` on archive nodes). - `state_cache_size` (`int`) configures the in-memory `IAVL` node LRU cache (`1000000` by default; `2000000` on hosts with `32+ GB` RAM). - `state_mem_available` (`int`, MB) allocates memory for `goleveldb` block caches and write buffers; `ulimit -n` must satisfy `>= 10000 + state_mem_available`. - `halt_height` (`uint64`) stops the process cleanly after committing the specified block height (`0` disables local halt). ## Running under `systemd` and Docker Set `LimitNOFILE=65535` and `TimeoutStopSec=120` in `/etc/systemd/system/minter.service` so `goleveldb` flushes cleanly on `SIGTERM`: ```ini [Unit] Description=Minter Go Node v3.3.0 After=network-online.target time-sync.target Wants=network-online.target [Service] Type=simple User=minter Group=minter WorkingDirectory=/var/lib/minter ExecStart=/usr/local/bin/minter node --home-dir=/var/lib/minter/.minter Restart=on-failure RestartSec=5 LimitNOFILE=65535 TimeoutStopSec=120 KillSignal=SIGTERM NoNewPrivileges=true PrivateTmp=true [Install] WantedBy=multi-user.target ``` Enable and follow the service logs: ```bash sudo systemctl daemon-reload sudo systemctl enable --now minter sudo journalctl -u minter -f -o cat ``` When running in Docker, pass `--ulimit nofile=65535:65535` and `--stop-timeout 120`, and mount `/var/lib/minter/.minter` directly from a host NVMe partition rather than `overlay2`: ```bash docker run -d \ --name minter-node \ --restart unless-stopped \ --ulimit nofile=65535:65535 \ --stop-timeout 120 \ -p 26656:26656 \ -v /var/lib/minter/.minter:/minter/.minter \ minterteam/minter:v3.3.0 \ minter node --home-dir=/minter/.minter ``` ## Directory layout and state retention ```text ~/.minter/ ├── config/ │ ├── config.toml # Minter and Tendermint configuration │ ├── genesis.json # Chain genesis document │ ├── node_key.json # Ed25519 P2P transport key (NodeID) │ └── priv_validator_key.json # Ed25519 consensus signing key (Mp...) ├── data/ │ ├── priv_validator_state.json # FilePV last-signed state (high-water mark) │ ├── state.db/ # Versioned IAVL v0.17.3 subtrees │ ├── app.db/ # Height, emission, versions, and tariff metadata │ ├── events.db/ # Block events index (when validator_mode = false) │ ├── snapshots/ # State Sync snapshots │ └── tmdata/ │ ├── blockstore.db/ # Raw Tendermint blocks and commits │ ├── state.db/ # Tendermint consensus state │ ├── tx_index.db/ # SHA-256 transaction index (Mt...) │ ├── evidence.db/ # DuplicateVoteEvidence store │ └── cs.wal/ # Consensus write-ahead log └── manager.sock # Local administration Unix socket ``` ### Restoring from a state archive 1. Stop `minter.service`. 2. When restoring on an active validator host, back up `/var/lib/minter/.minter/data/priv_validator_state.json` outside the data directory first. Extract `state.db`, `app.db`, and `tmdata/`, then copy the saved `priv_validator_state.json` back into `data/`; replacing it with `{ "height": "0" }` risks double-signing. 3. Reset ownership with `sudo chown -R minter:minter /var/lib/minter/.minter`, start `minter.service`, and wait until `/v2/status` reports `"catching_up": false`. ### Pruning old state versions Both `keep_last_states` and `prune_blocks` delete historical `IAVL` versions from `data/state.db` without shrinking `data/tmdata/blockstore.db` or `tx_index.db`. To prune a height range online through `manager.sock`: ```bash sudo -u minter minter console --home-dir=/var/lib/minter/.minter --execute="available_versions" sudo -u minter minter console --home-dir=/var/lib/minter/.minter \ --execute="prune_blocks --from=1 --to=15000000" sudo du -sh /var/lib/minter/.minter/data/* ``` ### Sentry and double-sign protection URL: https://docs.minter.network/validators/sentry-architecture-and-security Summary: Isolating a Minter v3.3.0 signing validator behind Sentry nodes, persistent_peers and pex templates, firewall rules, priv_validator_state.json, and key migration with required SetCandidateOff (0x0B). A signing validator should not expose a public IP address or open port `:26656` to the internet. Traffic floods against an exposed signer delay `Prevote` and `Precommit` messages; missing more than `12` of the last `24` blocks sets the candidate `offline` and imposes a `17,280`-block jail (`validators.go:194, 1142`; see the [penalty table](https://docs.minter.network/protocol/staking-lockstake-and-penalties#penalties)). ## Isolation behind Sentry nodes Place the signing host on a private VLAN or WireGuard subnet (the examples below use the RFC 1918 range `172.16.0.0/24`) behind two or more public Sentry nodes in separate data centers: | Host | Private IP | Public `:26656` | `pex` | Role | | :--- | :--- | :--- | :--- | :--- | | Validator | `172.16.0.2` | Closed | `false` | Holds `priv_validator_key.json`, peers solely with owned Sentry nodes | | Sentry A | `172.16.0.11` | Open (`0.0.0.0:26656`) | `true` | Accepts public P2P peers and relays blocks and votes to the validator | | Sentry B | `172.16.0.12` | Open (`0.0.0.0:26656`) | `true` | Redundant public relay in an independent facility | Read the 40-character P2P transport `NodeID` (derived from `config/node_key.json`, distinct from the `Mp...` consensus key) on each host: ```bash sudo -u minter minter show_node_id --home-dir=/var/lib/minter/.minter # Validator: a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4 (172.16.0.2) # Sentry A: 1111222233334444555566667777888899990000 (172.16.0.11) # Sentry B: aaaabbbbccccddddeeeeffff0000111122223333 (172.16.0.12) ``` ### `[p2p]` on the private validator (`172.16.0.2`) Setting `pex = false` disables peer-exchange gossip, `addr_book_strict = false` permits RFC 1918 tunnel addresses, and `laddr` binds the listener to the private interface: ```toml [p2p] laddr = "tcp://172.16.0.2:26656" pex = false persistent_peers = "1111222233334444555566667777888899990000@172.16.0.11:26656,aaaabbbbccccddddeeeeffff0000111122223333@172.16.0.12:26656" unconditional_peer_ids = "1111222233334444555566667777888899990000,aaaabbbbccccddddeeeeffff0000111122223333" addr_book_strict = false ``` ### `[p2p]` on public Sentry nodes On every Sentry node, `private_peer_ids` prevents the validator's `NodeID` and tunnel IP from leaking in PEX messages, while `unconditional_peer_ids` preserves the validator link even when `max_num_inbound_peers` is full. Configure `persistent_peers` separately on each Sentry so neither node dials its own `NodeID`: ```toml # Sentry A (172.16.0.11): peers with validator and Sentry B [p2p] laddr = "tcp://0.0.0.0:26656" pex = true persistent_peers = "a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4@172.16.0.2:26656,aaaabbbbccccddddeeeeffff0000111122223333@172.16.0.12:26656" private_peer_ids = "a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4" unconditional_peer_ids = "a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4" addr_book_strict = false max_num_inbound_peers = 60 max_num_outbound_peers = 20 ``` ```toml # Sentry B (172.16.0.12): peers with validator and Sentry A [p2p] laddr = "tcp://0.0.0.0:26656" pex = true persistent_peers = "a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4@172.16.0.2:26656,1111222233334444555566667777888899990000@172.16.0.11:26656" private_peer_ids = "a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4" unconditional_peer_ids = "a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4" addr_book_strict = false max_num_inbound_peers = 60 max_num_outbound_peers = 20 ``` ## Firewall rules (`ufw`) On the private validator host, restrict inbound TCP `26656` to the `wg0` tunnel interface from Sentry A and Sentry B: ```bash sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow from 203.0.113.10 to any port 22 proto tcp sudo ufw allow 51820/udp sudo ufw allow in on wg0 from 172.16.0.11 to 172.16.0.2 port 26656 proto tcp sudo ufw allow in on wg0 from 172.16.0.12 to 172.16.0.2 port 26656 proto tcp sudo ufw enable ``` On each Sentry host, allow public TCP `26656` and the WireGuard UDP port while keeping RPC (`26657`), API (`28842`, `28843`), and metrics (`26660`) closed to external networks: ```bash sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow from 203.0.113.10 to any port 22 proto tcp sudo ufw allow 51820/udp sudo ufw allow 26656/tcp sudo ufw enable ``` ## `FilePV` and last-signed state Embedded `Tendermint v0.34.19` splits local signing state across two mode-`0600` files: 1. `config/priv_validator_key.json` stores the static `Ed25519` private key matching the candidate `Mp...` public key. 2. `data/priv_validator_state.json` stores the monotonic last-signed state (`height`, `round`, `step`, `signature`, `signbytes`), updated via temporary file write, `fsync`, and atomic `rename` on every signature. > **[warn] Do not run two processes with the same priv_validator_key.json** > A failover script that starts a second `minter` process with the same `priv_validator_key.json` during a network partition produces conflicting votes at the same height (`DuplicateVoteEvidence`). The protocol burns `5%` of the candidate's stake and moves the remaining `95%` into a `518,400`-block unbond queue (`blockchain.go:336`). Automate failover solely through an external threshold signer (`priv_validator_laddr`) that maintains a single high-water mark. ## Key migration procedure (`Server A -> Server B`) Follow every step in sequence when moving a validator to a new host: 1. Provision `Server B` with a fresh disposable `priv_validator_key.json`, connect it to the Sentry nodes, and wait until `/v2/status` reports `"catching_up": false`. 2. Broadcast `SetCandidateOff (0x0B)` from `ControlAddress` or `OwnerAddress` and wait until the transaction commits in a block with `code === "0"`. This step is required: stopping the process, copying files, and restarting two Sentry nodes takes longer than `12` blocks, and skipping `0x0B` triggers a `17,280`-block jail once missed blocks exceed `12` out of `24`. 3. Stop `minter.service` on `Server A` and disable signing on the old host by moving the key out of `config/`: ```bash sudo systemctl stop minter sudo systemctl disable minter sudo mv /var/lib/minter/.minter/config/priv_validator_key.json \ /var/lib/minter/.minter/config/priv_validator_key.json.disabled ``` 4. Check `latest_block_height` on a Sentry node's `/v2/status` and confirm that the chain has advanced at least `2` blocks past `height` in `Server A`'s `data/priv_validator_state.json`. 5. Stop `minter.service` on `Server B`, copy both `config/priv_validator_key.json` and `data/priv_validator_state.json` from `Server A`, and enforce ownership and `0600` permissions: ```bash sudo systemctl stop minter # Copy priv_validator_key.json and priv_validator_state.json from Server A to Server B sudo chown minter:minter /var/lib/minter/.minter/config/priv_validator_key.json \ /var/lib/minter/.minter/data/priv_validator_state.json sudo chmod 0600 /var/lib/minter/.minter/config/priv_validator_key.json \ /var/lib/minter/.minter/data/priv_validator_state.json ``` 6. Update `persistent_peers`, `private_peer_ids`, and `unconditional_peer_ids` on Sentry A and Sentry B to `Server B`'s `NodeID@IP`, restart the Sentry nodes one at a time, and start `minter.service` on `Server B`. 7. Confirm that `Server B` maintains peer connections to both Sentry nodes in `/net_info` with `"catching_up": false`, then submit `SetCandidateOn (0x0A)` from `ControlAddress`. ### Candidate: keys, launch, metadata URL: https://docs.minter.network/validators/validator-lifecycle-and-keys Summary: Minter v3.3.0 validator operator keys (Mp, OwnerAddress, ControlAddress, RewardAddress), transactions 0x06, 0x0A, 0x0E, 0x14, 0x1A, /v2/missed_blocks monitoring, and Explorer metadata convention. The Minter state machine separates the `Ed25519` block-signing key (`Mp...` on the validator host) from three `secp256k1` address roles (`Mx...`). Assigning a dedicated `ControlAddress` lets monitoring automation toggle candidate status without holding authority over commission rates or payout addresses. ## Operator keys and address roles | Key or role | Format | Recommended custody | Protocol authority | | :--- | :--- | :--- | :--- | | `OwnerAddress` | `Mx...` (`secp256k1`) | Hardware wallet or multisig (`0x0C`) | `EditCandidate (0x0E)`, `EditCandidatePublicKey (0x14)`, `EditCandidateCommission (0x1A)`, governance votes (`0x0F`, `0x20`, `0x21`), `SetCandidateOn/Off (0x0A/0x0B)` | | `ControlAddress` | `Mx...` (`secp256k1`) | Monitoring host key | `SetCandidateOn (0x0A)` and `SetCandidateOff (0x0B)` | | `RewardAddress` | `Mx...` (`secp256k1`) | Treasury accounting wallet | Receives validator commission every `720` blocks; holds zero administrative permissions | | Consensus `PubKey` | `Mp...` (`Ed25519`) | `priv_validator_key.json` (`0600`) on signer | Signs `Proposal`, `Prevote`, and `Precommit` votes in `Tendermint v0.34.19` | ## Registration, activation, and key rotation Exact RLP schemas are listed in the [transaction registry](https://docs.minter.network/protocol/transactions-registry), while active-set caps (`64` validators, `top-100` candidates, registration rule at `>= 192`) and slashing rules live in [Emission, staking, rewards and penalties](https://docs.minter.network/protocol/staking-lockstake-and-penalties#penalties). 1. `DeclareCandidacy (0x06)` (`declare_candidacy.go:184`, `$10` tariff): the inner `address` field sets `OwnerAddress`, whereas the outer transaction `sender` becomes both `RewardAddress` and `ControlAddress`. Initial stake must be `BIP` or a CRR reserve coin, with integer `commission` in `0..100`. 2. `EditCandidate (0x0E)` (`$0.10` tariff): signed by `OwnerAddress` to separate `RewardAddress`, `OwnerAddress`, and `ControlAddress` onto distinct accounts. 3. `SetCandidateOn (0x0A)` / `SetCandidateOff (0x0B)` (`$0.10` tariff): signed by `OwnerAddress` or `ControlAddress`. While `currentBlock <= JailedUntil`, `0x0A` fails with `CandidateJailed`. 4. `EditCandidateCommission (0x1A)` (`$10` tariff): signed by `OwnerAddress`. Each change is bounded to `+-10` percentage points (`|new - old| <= 10`, otherwise `CommissionDeltaTooBig`), and the minimum interval between changes is `1,555,200` blocks (`3 * GetUnbondPeriod`, roughly `90` days at the nominal `5 s` block interval). 5. `EditCandidatePublicKey (0x14)` (`$1,000` tariff): signed by `OwnerAddress`, switches the candidate to `newPubKey`, and adds the old `pubKey` to the global `BlockList` (`PubKeyInBlockList`) with no removal path. Operators can generate a fresh `priv_validator_key.json` on new hardware and switch over via `0x14` without copying private keys between hosts. ## Monitoring missed blocks Poll the 24-block sliding window via `GET /v2/missed_blocks/{public_key}`. If `missed_blocks_count` approaches the `> 12` threshold, automation holding `ControlAddress` can submit `SetCandidateOff (0x0B)` before the `17,280`-block downtime jail triggers. #### TypeScript ```typescript import { MinterGateClient, buildDeclareCandidacyTx, buildEditCandidateTx, buildSetCandidateOnTx, parsePip, signTx, } from "@minter-network/tx-core"; import type { MxAddress } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const hotSenderAddress: MxAddress; declare const controlPrivateKey: Uint8Array; const gate = new MinterGateClient( process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2", ); const pubKey = "Mpeeb140d1d932146cf394f868ac64467a2935c3f7d0ddd1517a954aa3fd2a7b04"; const ownerAddress = "Mx1111111111111111111111111111111111111111"; const rewardAddress = "Mx2222222222222222222222222222222222222222"; const controlAddress = "Mx3333333333333333333333333333333333333333"; // 1. DeclareCandidacy (0x06): inner address field assigns OwnerAddress const declareTx = buildDeclareCandidacyTx( { address: ownerAddress, pubKey, commission: 10, coinId: 0, stakePip: parsePip("10000"), }, { nonce: await gate.getNextNonce(hotSenderAddress), chainId: 1, gasCoin: 0 }, ); // 2. EditCandidate (0x0E): signed by cold OwnerAddress const editTx = buildEditCandidateTx( { pubKey, rewardAddress, ownerAddress, controlAddress }, { nonce: await gate.getNextNonce(ownerAddress), chainId: 1, gasCoin: 0 }, ); // 3. SetCandidateOn (0x0A): signed by ControlAddress and verified in a committed block const setOnSigned = signTx( buildSetCandidateOnTx( { pubKey }, { nonce: await gate.getNextNonce(controlAddress), chainId: 1, gasCoin: 0 }, ), controlPrivateKey, ); await gate.sendTransaction(setOnSigned.signedRawTxHex); const committed = await gate.waitForTransaction(setOnSigned.txHash); if (committed.code !== "0") { throw new Error(`SetCandidateOn failed with code ${committed.code}: ${committed.log}`); } ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash # 1. Inspect candidate owner_address, control_address, reward_address, and jail status curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/candidate/Mpeeb140d1d932146cf394f868ac64467a2935c3f7d0ddd1517a954aa3fd2a7b04?not_show_stakes=true" | jq '{ public_key, status, commission, used_slots, jailed_until, owner_address, control_address, reward_address }' # 2. Check the 24-block missed-signature window curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/missed_blocks/Mpeeb140d1d932146cf394f868ac64467a2935c3f7d0ddd1517a954aa3fd2a7b04" | jq . ``` ## Candidate metadata (Explorer indexer convention) Validator titles, websites, and icons are not stored in consensus state and are not validated by the node. Minter Explorer indexes candidate profiles through an on-chain convention: submit a `0 pip` `Send (0x01)` transaction to `Mxa62da2d2714f23738a4d1658909eb6c920669b0e` carrying UTF-8 JSON (`<= 10,000` bytes) in `payload`. | Field | Explorer indexer rule | | :--- | :--- | | Signer (`tx.sender`) | Current `OwnerAddress` of the candidate in node state: the `address` field from `DeclareCandidacy (0x06)` or the latest `ownerAddress` set via `EditCandidate (0x0E)`. Transactions signed by `ControlAddress` or `RewardAddress` are ignored when they differ from `OwnerAddress` | | Recipient (`data.to`) | `Mxa62da2d2714f23738a4d1658909eb6c920669b0e` | | `payload` JSON | UTF-8 JSON `{"PK","title","description","www","icon"}`, where `"PK"` matches the active `Mp...` key (re-publish metadata for the new `"PK"` after rotating via `0x14`) | | `icon` PNG | Public HTTPS URL returning a valid PNG between `33` bytes and `1 MiB` (`1,048,576` bytes) with `\x89PNG\r\n\x1a\n` and `IHDR` headers. Explorer fetches the file server-side, computes `digest = sha256(bytes)`, clears raw external `icon_url` fields, and serves the verified PNG from `/api/v2/assets/{digest}.png` and `/api/assets/{digest}` | ```typescript import { MinterGateClient, SecretLeakGuard, buildSendTx, signTx, } from "@minter-network/tx-core"; import type { MinterWallet } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const ownerWallet: MinterWallet; const gate = new MinterGateClient( process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2", ); const METADATA_ADDRESS = "Mxa62da2d2714f23738a4d1658909eb6c920669b0e"; const payload = JSON.stringify({ PK: "Mpeeb140d1d932146cf394f868ac64467a2935c3f7d0ddd1517a954aa3fd2a7b04", title: "Sentinel Validator", description: "Dedicated NVMe node behind dual Sentry relays", www: "https://validator.example.com", icon: "https://validator.example.com/icon.png", }); SecretLeakGuard.assertSafePublicText(payload); const nonce = await gate.getNextNonce(ownerWallet.address); const signed = signTx( buildSendTx( { coinId: 0, to: METADATA_ADDRESS, valuePip: 0n }, { nonce, chainId: 1, gasPrice: 1, gasCoin: 0, payload }, ), ownerWallet.privateKey, ); await gate.sendTransaction(signed.signedRawTxHex); const tx = await gate.waitForTransaction(signed.txHash); if (tx.code !== "0") { throw new Error(`Metadata transaction failed with code ${tx.code}`); } ``` ### Governance and upgrades URL: https://docs.minter.network/validators/governance-and-upgrades Summary: Minter v3.3.0 2/3 validator governance: VoteCommission (0x20, 51 RLP fields), VoteUpdate (0x21), SetHaltBlock (0x0F), and minter export rules. Protocol upgrades (`VoteUpdate 0x21`), fee schedule updates (`VoteCommission 0x20`), and coordinated chain halts (`SetHaltBlock 0x0F`) are enacted by on-chain votes from active validators. Full RLP signatures are listed in the [transaction registry](https://docs.minter.network/protocol/transactions-registry#0x20). ## Vote preconditions and `2/3` quorum calculation All three governance transactions (`0x0F`, `0x20`, `0x21`, `$0.10` tariff) fail unless every precondition holds: 1. The transaction sender equals the candidate's `OwnerAddress` (`IsNotOwnerOfCandidate`; `ControlAddress` and `RewardAddress` cannot vote). 2. Target `height >= currentBlock` (otherwise `VoteExpired`). 3. No prior vote exists for the same `(pubKey, height)` pair (`VoteAlreadyExists`). Governance votes in `0x0F`, `0x20`, and `0x21` are tallied by `calculatePowers` (`coreV2/minter/minter.go`), which differs from Tendermint block commits: | Property | Tendermint block commit (`Precommit`) | Minter governance vote (`0x0F`, `0x20`, `0x21`) | | :--- | :--- | :--- | | Eligible voters | All `<= 64` active block validators | Present validators (`present == true`, signed `H - 1`) not marked `toDrop` | | Weight unit | Normalized `int64` (`10^8` scale) | Exact raw `TotalBipStake` (`uint256 pip`) | | Passing threshold | `> 2/3` of active set voting power | Strictly `> 2/3` of total `present` validator stake | | Execution hook | Consensus `Commit` phase | `BeginBlock(height)` for `0x0F`; `EndBlock(height)` for `0x20` and `0x21` | Excluding offline (`!present`) validators from the denominator lets the active majority pass `VoteUpdate` or `SetHaltBlock` even when several nodes are unreachable. ## Fee schedule voting (`VoteCommission 0x20`) `VoteCommissionDataV3` (`vote_commission_v3.go:17-69`) encodes an RLP list of `51` elements: `pubKey ([32]byte)`, `height (uint64)`, `coin (uint32)`, and `48` `*big.Int` tariff fields followed by an empty `More` slice (`len(More) == 0`; any trailing element is rejected by the decoder). Exact field indices appear in the [transaction registry (`#0x20`)](https://docs.minter.network/protocol/transactions-registry#0x20), and all `48` tariff values in `USDTE` are documented in [Execution, gas and fees (`#tariffs`)](https://docs.minter.network/protocol/execution-and-fees#tariffs). - When `coin != 0` (`1993 USDTE` on Mainnet), a direct `{coin, BIP}` pool must exist in state (`PairNotExists` otherwise). - Votes are grouped by byte-identical RLP encoding of `coin` and all `48` tariff fields. When one proposal exceeds `2/3` of present stake in `EndBlock(height)`, `appDB.SavePrice` activates the new schedule starting at block `height + 1` (`UpdateCommissionsEvent`). ## Protocol upgrades (`VoteUpdate 0x21`) and halts (`SetHaltBlock 0x0F`) ### `VoteUpdate (0x21)` lifecycle 1. Operators compile and deploy the new `minter` binary containing the target version identifier in `knownUpdates` (`v3.3.0` declares `v300`, `v310`, `v320`, `v330`) before `height`. 2. Candidate `OwnerAddress` accounts submit `VoteUpdate (0x21)` with `[version, pubKey, height]`, where `version` matches `^[a-zA-Z0-9_]{1,20}$`. 3. If votes exceed `2/3` of present stake in `EndBlock(height)`, the version is recorded in `appDB` (`UpdateNetworkEvent`) and `GracePeriod` (`grace.go`) suspends automatic downtime jailing during upgrade restarts. 4. Any node running a previous binary whose `knownUpdates` map lacks the enacted `version` halts in `BeginBlock(height + 1)` before executing transactions, preventing an `AppHash` split. ### Coordinated halt (`SetHaltBlock 0x0F`) When `SetHaltBlock (0x0F)` votes for `height` exceed `2/3` of present stake, nodes stop inside `BeginBlock(height)` at the committed state of block `height - 1`. ## Submitting votes and inspecting quorum #### TypeScript ```typescript import { MinterGateClient, buildSetHaltBlockTx, buildVoteUpdateTx, signTx, } from "@minter-network/tx-core"; import type { MinterWallet } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const ownerWallet: MinterWallet; const gate = new MinterGateClient( process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2", ); const status = await gate.getStatus(); const currentHeight = BigInt(status.latest_block_height); const upgradeHeight = currentHeight + 17_280n; // +24h at nominal 5 s/block const validatorPubKey = "Mpeeb140d1d932146cf394f868ac64467a2935c3f7d0ddd1517a954aa3fd2a7b04"; // 1. VoteUpdate (0x21): example vote for placeholder version "v340" signed by OwnerAddress const nonce = await gate.getNextNonce(ownerWallet.address); const signedUpdateVote = signTx( buildVoteUpdateTx( { version: "v340", pubKey: validatorPubKey, height: upgradeHeight }, { nonce, chainId: 1, gasCoin: 0 }, ), ownerWallet.privateKey, ); await gate.sendTransaction(signedUpdateVote.signedRawTxHex); await gate.waitForTransaction(signedUpdateVote.txHash); // 2. SetHaltBlock (0x0F): build coordinated halt vote const unsignedHaltVote = buildSetHaltBlockTx( { pubKey: validatorPubKey, height: currentHeight + 34_560n }, { nonce: nonce + 1n, chainId: 1, gasCoin: 0 }, ); ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash # 1. Inspect enacted network upgrades curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/version_network" | jq . # 2. Query submitted update and commission votes for a future height (> latest_block_height) TARGET_HEIGHT=$(($(curl -sS "https://gate.minter.network/v2/status" | jq -r '.latest_block_height') + 17280)) curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/update_votes/${TARGET_HEIGHT}" | jq . curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/commission_votes/${TARGET_HEIGHT}" | jq . ``` ## Exporting state with `minter export` Account for four storage rules in `Minter Go Node v3.3.0` when exporting genesis JSON for a fork or chain migration: 1. Stop `minter.service` first and export at the latest committed height: passing an earlier `--height H` reads `IAVL` trees at `H`, whereas unversioned `app.db` records (`emission`, `versions`, `price`) come from the latest height on disk. 2. `State.Export` serializes `halt_blocks`, while `State.Import` ignores `halt_blocks` during `InitChain`; use `halt_height` in `config.toml` if a local stop height is needed. 3. Separate internal counters `App.Reward0` and `App.RewardSafe` fold into a single `PrevReward` field on export. 4. Raw blocks in `tmdata/blockstore.db` and events in `events.db` are not included in `genesis.json`; archive `data/` separately when historical blocks are required. ```bash sudo systemctl stop minter sudo -u minter minter export --home-dir=/var/lib/minter/.minter --indent > /var/backups/genesis-export.json ``` ## Protocol (protocol) ### Overview: node, consensus, addresses URL: https://docs.minter.network/protocol Summary: Minter Go Node v3.3.0 architecture: Tendermint v0.34.19 consensus, IAVL v0.17.3 state tree, single-block finality, CheckTx vs DeliverTx stages, and Mx, Mp, Mt, Mc prefixes. `Minter Go Node v3.3.0` (commit `235a4a2f7a69452e1a3be50d91b5a51bcc0d2ada`, `node-grpc-gateway` `53ffbb191668`) compiles consensus, the financial state machine, and versioned state storage into a single Go binary with no user smart-contract bytecode VM. ## `Minter Go Node v3.3.0` stack | Layer | Implementation and source files | Responsibility | | :--- | :--- | :--- | | Consensus and P2P | In-process `Tendermint v0.34.19` via `proxy.NewLocalClientCreator(app)` (`cmd/minter/cmd/node.go:200-254`), `CListMempool` | P2P gossip on `:26656`, mempool replication, and two-phase `Prevote` / `Precommit` BFT voting | | Execution dispatcher | `NewExecutorV3(GetDataV3)` (`coreV2/minter/blockchain.go:164`), `knownUpdates`: `v300`, `v310`, `v320`, `v330` | Decodes and executes `37` active transaction handlers out of `38` declared opcodes `0x01..0x26` (`0x13` is unregistered) | | State tree and DB | `IAVL v0.17.3` + `tm-db v0.6.6` backed by `goleveldb` (`tree/tree.go:33-114`, `cmd/utils/flags.go:42-67`) | Stores balances, coins, `SwapV2` pools, limit orders, candidates, and queues, producing a block `AppHash` | | Units and chain IDs | `1 coin = 10^18 pip` (`coreV2/types/types.go`); `ChainID = 1` (Mainnet, base coin `0 = BIP`), `ChainID = 2` (Testnet, base coin `0 = MNT`) | Arbitrary-precision integer accounting and cross-network replay protection | ## Block interval and single-block finality The protocol's nominal block interval is `BLOCK_TIME_NOMINAL = 5 s`: Mainnet periods derive from this constant (`720`-block reward and re-election interval, `17,280` blocks per day, `518,400` blocks per `30` days, `18,921,600` blocks per `3` years). Public Testnet (`chainId = 2`, base coin `MNT`, monthly epochs `minter-testnet-YYYYMM`) uses shortened protocol periods (`120`-block reward interval, order expiry phase `H % 120 == 60`, `Unbond = 531`, `MoveStake = 177`, `LockStake = 34,560`, `Jail = 354`, `OrderExpire = 86,400`, `EditCandidateCommission = 1,593` blocks). A block at height `H` is committed once validators controlling strictly more than `2/3` of active voting power sign `Precommit` votes for the same block hash: - As long as fewer than `1/3` of active stake is Byzantine, committed blocks cannot reorganize, so integrators do not wait for multi-block confirmation depth. - A transaction is final once included in a committed block with `code == 0` (`"0"` in JSON API v2 responses). - Signing two conflicting votes at the same height and round (`DuplicateVoteEvidence`) burns `5%` of the candidate's stake and moves the remaining `95%` into `FrozenFunds` for `518,400` blocks (`blockchain.go:336`). ## ABCI block stages (`CheckTx` vs `DeliverTx`) 1. `CheckTx` (mempool admission on `POST /v2/send_transaction`): verifies canonical RLP, `ChainID`, `tx.Nonce == account.Nonce + 1`, signature recovery, and spendable balance against `CheckState`. Rejected packets pay `0 pip`, and `code: "0"` from `send_transaction` indicates mempool acceptance rather than block execution. 2. `BeginBlock`: pays out matured `FrozenFunds` (`Unbond`, `MoveStake`, `Lock`), updates the 24-block validator liveness window, processes `DuplicateVoteEvidence`, and checks `SetHaltBlock (0x0F)` quorum. 3. `DeliverTx` (sequential block execution): on `code == 0`, state changes apply to `IAVL`, the sender's `Nonce` increments, and the fee enters `rewardPool`. If `handler.Run` fails in `DeliverTx` (`code != 0`), state changes do not apply, the `FailedTx` fee is deducted, and the sender's `Nonce` does not increment (see [Execution, gas and fees](https://docs.minter.network/protocol/execution-and-fees)). 4. `EndBlock` and `Commit`: sweeps expired limit orders (`height % 720 == 360` on Mainnet, `height % 120 == 60` on Testnet), distributes `PayRewardsV5Fix` rewards and recalculates the active validator set (`720` blocks on Mainnet, `120` blocks on Testnet), and commits the new `IAVL` `AppHash`. > **[warn] Monthly Testnet resets and cross-epoch replay** > The public Testnet (`https://testnet.minter.network/status.json`) resets cleanly to a fresh epoch `minter-testnet-YYYYMM` on the 1st of every month. Because `ChainID = 2` is constant across epochs and account `Nonce` restarts at `0`, a transaction signed by a reused user `Mx...` address in a prior epoch can be replayed in a later epoch if that address receives funds again. Service addresses rotate per epoch, and developers should generate a new disposable test mnemonic per epoch. ## Entity prefixes and BIP-44 derivation Every external Minter identifier carries a two-character prefix (`coreV2/types/types.go`): | Prefix | Entity | Byte length | String length | Derivation formula | | :--- | :--- | :--- | :--- | :--- | | `Mx` | Account or multisig address | `20` bytes | `42` chars | `"Mx" + hexLower(Keccak256(uncompressedSecp256k1PubKey[1:65])[12:32])` | | `Mp` | Validator consensus public key | `32` bytes | `66` chars | `"Mp" + hexLower(ed25519PublicKey32B)` | | `Mt` | On-chain transaction hash | `32` bytes | `66` chars | `"Mt" + hexLower(SHA256(rawSignedTxBytes))` (`10` RLP fields) | | `Mc` | Off-chain check (`RedeemCheck 0x09`) | Variable RLP | Variable | `"Mc" + hexLower(RLP([Nonce, ChainID, DueBlock, Coin, Value, GasCoin, Lock, V, R, S]))` (`10` fields) | User `secp256k1` keys derive from a BIP-39 mnemonic at BIP-44 path `m/44'/60'/0'/0/{index}`: the 20 address bytes after `Mx` match the EVM `0x` address derived from the same public key. > **[warn] Keccak-256 vs SHA-256 hash domains** > Pre-NIST `Keccak-256` computes `Mx...` addresses, the 9-field transaction `signingHash`, and `Mc...` check digests. Standard `SHA-256` (FIPS 180-4) computes the on-chain `Mt...` transaction hash over the 10-field signed RLP bytes and derives the check passphrase scalar `passKey = SHA256(passphrase)` (see [Encoding and signing](/protocol/rlp-and-cryptography)). ### Encoding and signing URL: https://docs.minter.network/protocol/rlp-and-cryptography Summary: Canonical Minter v3.3.0 RLP rules, 10-field transaction envelope, Keccak-256 signing digest vs SHA-256 Mt... hash, Mc... check cryptography, and the Send (0x01) reference vector. The transaction decoder in `coreV2/transaction/transaction.go` enforces canonical Recursive Length Prefix (`go-ethereum/rlp`) serialization for transactions and off-chain checks. Non-canonical length prefixes or leading zero bytes in integers fail immediately with `rlp: non-canonical integer`. ## Canonical RLP rules in Minter 1. Unsigned integers (`uint8`, `uint32`, `uint64`, `*big.Int` in `pip`) and booleans serialize as minimal big-endian byte slices with no leading `0x00` bytes: `0` and `false` encode as an empty slice (`0x80`), while `1` and `true` encode as `0x01`. A single byte in `0x00..0x7f` encodes as itself without a `0x81` prefix. 2. Double RLP wrapping of `Data` (index `5`) and `SignatureData` (index `9`): both fields are declared as `[]byte` in `transaction.go`. Encode the operation's inner fields into `dataBytes = RLP(innerFields)` first, then pass `dataBytes` as a byte string in the outer 10-element list. For example, empty `LockStakeData` (`0x25`) encodes internally to the 1-byte empty list `0xc0` (`>= 0x80`), which wraps at outer index `5` as `0x81 0xc0`. 3. Fixed 10-byte `CoinSymbol` (`[10]byte` in `0x05`, `0x10`, `0x11`, `0x1E`, `0x1F`): creation tickers match `^[A-Z0-9]{3,10}$` (cannot parse solely as digits) and are right-padded with `0x00` (`NUL`) bytes to exactly `10` bytes under RLP prefix `0x8a` (`"STUDIO"` -> `8a 53 54 55 44 49 4f 00 00 00 00`). ## Outer transaction envelope (`10` fields) Serialized signed transactions are bounded to `16,144` bytes (`maxTxLength` in `executor_v3.go`): | Index | Field | Go / RLP type | Encoding and precondition rule | | :--- | :--- | :--- | :--- | | `0` | `Nonce` | `uint64` | Equals `Accounts.GetNonce(sender) + 1` (`1` -> `0x01`) | | `1` | `ChainID` | `byte` | `1` (`0x01`) for Mainnet; `2` (`0x02`) for Testnet | | `2` | `GasPrice` | `uint32` | Fee multiplier `>= 1` (equals `1` for `RedeemCheck 0x09`) | | `3` | `GasCoin` | `uint32` | Numeric fee `CoinID` (`0` = `BIP` -> `0x80`, `1993` = `USDTE` -> `0x82 0x07 0xc9`) | | `4` | `Type` | `byte` | Opcode `0x01..0x26` (see [transaction registry](https://docs.minter.network/protocol/transactions-registry)) | | `5` | `Data` | `[]byte` | Byte string holding inner `RLP(innerFields)` | | `6` | `Payload` | `[]byte` | Arbitrary byte slice `<= 10,000` bytes (empty -> `0x80`) | | `7` | `ServiceData` | `[]byte` | Arbitrary service metadata `<= 128` bytes (empty -> `0x80`) | | `8` | `SignatureType` | `byte` | `0x01` single `secp256k1` signature; `0x02` weighted multisig | | `9` | `SignatureData` | `[]byte` | Byte string holding `RLP([V, R, S])` (`0x01`) or `RLP([MultisigAddr20B, [[V, R, S], ...]])` (`0x02`) | ## Dual-hash scheme and `secp256k1` signing Signatures cover the `Keccak-256` digest of the first `9` fields, whereas the network transaction hash uses `SHA-256` over all `10` fields (for `Mx`, `Mp`, `Mt`, `Mc` prefixes, see the [protocol overview](https://docs.minter.network/protocol)): ```text signingHash = Keccak256(RLP([Nonce, ChainID, GasPrice, GasCoin, Type, Data, Payload, ServiceData, SignatureType])) txHash = "Mt" + hexLower(SHA256(RLP([Nonce, ..., SignatureType, SignatureData]))) ``` - For `SignatureType == 0x01`, sign `signingHash` with `secp256k1` (RFC 6979) and `low-S` normalization (`1 <= S <= n / 2`). Set `V = recoveryId + 27` (`27` or `28`) and strip leading `0x00` bytes from `R` and `S` before encoding `RLP([V, R, S])`. - For `SignatureType == 0x02`, encode the 20-byte multisig address followed by `1..32` `[V, R, S]` tuples from distinct participants (`DuplicatedAddresses` on repeats) whose weights sum to at least `Threshold`. ## Two-key checks (`Mc...`) and `RedeemCheck (0x09)` preconditions A `Check` body (`coreV2/check/check.go`) is a 10-field RLP list: `[Nonce []byte, ChainID byte, DueBlock uint64, Coin uint32, Value *big.Int, GasCoin uint32, Lock *big.Int, V *big.Int, R *big.Int, S *big.Int]` (`DueBlock` is `uint64` in `check.go`, whereas `Lock 0x26` in `lock.go:14` uses `uint32`). 1. Compute `HashWithoutLock = Keccak256(RLP([Nonce, ChainID, DueBlock, Coin, Value, GasCoin]))` (`6` fields) and `passKey = SHA256(passphrase)`. 2. Sign `HashWithoutLock` with `passKey` to obtain the 65-byte recoverable signature `[R(32) || S(32) || V(0|1)]`, encoded in `Lock` as an unsigned `*big.Int` with no leading zero bytes (left-padded back to `65` bytes on decode). 3. Compute `CheckHash = Keccak256(RLP([Nonce, ChainID, DueBlock, Coin, Value, GasCoin, Lock]))` (`7` fields) and sign it with the `issuer` key (`V = 27 | 28, R, S`). 4. The redeemer computes `Proof` (`[65]byte`, RLP `0xb8 0x41 ...`) by signing `Keccak256(RLP([redeemerAddress20B]))` with `passKey`. `RedeemCheck (0x09)` (`redeem_check.go`) enforces five preconditions: `tx.GasPrice == 1` (`TooHighGasPrice`), `tx.GasCoin == check.GasCoin` (`WrongGasCoin`; `check.GasCoin` must be `BIP`, a CRR coin, or a coin with a `BIP` pool), `len(check.Nonce) <= 16` bytes (`TooLongNonce`), `check.ChainID == CurrentChainID`, and `check.DueBlock >= currentBlock` with `!IsCheckUsed`. On execution, `Value` and `price.RedeemCheck` are deducted from `issuer`. ## `Send (0x01)` reference vector The `tx-0x01-send` fixture from [`/test-vectors.json`](https://docs.minter.network/test-vectors.json) transfers `12.5 BIP` to `Mx6fac4d18c912343bf86fa7049364dd4e424ab9c0` with `payload = "invoice:2026-11"`, `nonce = 1`, `chainId = 1`, `gasPrice = 1`, `gasCoin = 0`. It is a regression fixture generated by `@minter-network/tx-core`; see [Test vectors and porting](https://docs.minter.network/developers/test-vectors-and-porting) for its Go verification status: - `dataBytesHex`: `0xdf80946fac4d18c912343bf86fa7049364dd4e424ab9c088ad78ebc5ac620000` (`32` bytes, wrapped with `0xa0` in the outer list) - `signingHash`: `0x4fdf01449f56ca56b2310e91e17d5cf07d930578ccf620d2354b0bf8edb47617` - `txHash`: `Mte53eeda7a4268983a7ea5481cf150ae9d6ef76c1e497f7489d99805a812b7011` #### TypeScript ```typescript import { buildSendTx, parsePip, signTx } from "@minter-network/tx-core"; // Public test private key from /test-vectors.json (do not fund on Mainnet) const TEST_PRIV_KEY = "1ab42cc412b618bdea3a599e3c9bae199ebf030895b039e9db1e30dafb12b727"; const unsigned = buildSendTx( { coinId: 0, to: "Mx6fac4d18c912343bf86fa7049364dd4e424ab9c0", valuePip: parsePip("12.5"), }, { nonce: 1n, chainId: 1, gasPrice: 1, gasCoin: 0, payload: "invoice:2026-11", }, ); const signed = signTx(unsigned, TEST_PRIV_KEY); console.log(signed.signingHash); // 0x4fdf01449f56ca56b2310e91e17d5cf07d930578ccf620d2354b0bf8edb47617 console.log(signed.txHash); // Mte53eeda7a4268983a7ea5481cf150ae9d6ef76c1e497f7489d99805a812b7011 console.log(signed.signedRawTxHex); // 0xf87f0101018001a0df80946fac4d18c912343bf86fa7049364dd4e424ab9c0... ``` #### cURL ```bash # Verify RLP decoding and commission quote for reference vector tx-0x01-send curl -sS "https://gate.minter.network/v2/estimate_tx_commission/0xf87f0101018001a0df80946fac4d18c912343bf86fa7049364dd4e424ab9c088ad78ebc5ac6200008f696e766f6963653a323032362d31318001b845f8431ba04acb879e7e90f8475c553a23e4c2f11c7ba71ff8a36cc4ae15dc1a74f2fdc511a04da0b3d26cde48103cde55dd74e9d867e539cbbb8516f74cb3dd085b4dc951de" | jq . ``` ### Execution, gas and fees URL: https://docs.minter.network/protocol/execution-and-fees Summary: 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` | ### Transaction registry 0x01–0x26 URL: https://docs.minter.network/protocol/transactions-registry Summary: Complete specification of all 38 Minter v3.3.0 transaction opcodes (37 active handlers plus unregistered 0x13 TypePriceVote), exact RLP struct signatures, and price.* tariff keys. `coreV2/transaction/transaction.go` declares `38` transaction opcodes `0x01..0x26` (decimal `1..38`). `GetDataV3` (`coreV2/transaction/decoder.go`) registers `37` active handlers, while `0x13` (`TypePriceVote`) has no registered decoder or handler and fails inside `DecodeFromBytesWithoutSig` with `tx type 13 is not registered`. ## All 38 opcodes (`0x01..0x26`) Fields in each row follow the exact Go struct RLP order inside the outer `Data` byte slice (envelope index `5`). Current `USDTE` amounts for every `price.*` key appear in [Execution, gas and fees (`#tariffs`)](https://docs.minter.network/protocol/execution-and-fees#tariffs). | Hex (Dec) | Go constant and struct | RLP `Data` fields (order and types) | Tariff key and handler rules | | :--- | :--- | :--- | :--- | | `0x01` (`1`) | `TypeSend` (`SendData`) | `[Coin: uint32, To: [20]byte, Value: bigint]` | `price.Send`; `Coin` exists, sender covers `Value` and fee | | `0x02` (`2`) | `TypeSellCoin` (`SellCoinData`) | `[CoinToSell: uint32, ValueToSell: bigint, CoinToBuy: uint32, MinimumValueToBuy: bigint]` | `price.SellBancor`; `CRR` reserve conversion, output `>= MinimumValueToBuy` | | `0x03` (`3`) | `TypeSellAllCoin` (`SellAllCoinData`) | `[CoinToSell: uint32, CoinToBuy: uint32, MinimumValueToBuy: bigint]` | `price.SellAllBancor`; commission is deducted from `CoinToSell` regardless of `tx.GasCoin` | | `0x04` (`4`) | `TypeBuyCoin` (`BuyCoinData`) | `[CoinToBuy: uint32, ValueToBuy: bigint, CoinToSell: uint32, MaximumValueToSell: bigint]` | `price.BuyBancor`; exact-output `CRR` purchase, spend `<= MaximumValueToSell` | | `0x05` (`5`) | `TypeCreateCoin` (`CreateCoinData`) | `[Name: string, Symbol: [10]byte, InitialAmount: bigint, InitialReserve: bigint, ConstantReserveRatio: uint32, MaxSupply: bigint]` | `PayForSymbol(price) + price.CreateCoin`; `Name <= 64 B`, `Symbol` `^[A-Z0-9]{3,10}$` (non-numeric), `CRR 10..100`, `InitialReserve >= 10,000 BIP`, `1 BIP <= InitialAmount <= MaxSupply <= 10^33 pip` | | `0x06` (`6`) | `TypeDeclareCandidacy` (`DeclareCandidacyData`) | `[Address: [20]byte, PubKey: [32]byte, Commission: uint32, Coin: uint32, Stake: bigint]` | `price.DeclareCandidacy`; `Commission 0..100`; `Address` becomes `OwnerAddress`, while `tx.sender` becomes `RewardAddress` and `ControlAddress` (`declare_candidacy.go:184`) | | `0x07` (`7`) | `TypeDelegate` (`DelegateDataV260`) | `[PubKey: [32]byte, Coin: uint32, Value: bigint]` | `price.Delegate`; `BIP` or `CRR` coin, merges sender's `Waitlist` entry for `(PubKey, Coin)` | | `0x08` (`8`) | `TypeUnbond` (`UnbondDataV3`) | `[PubKey: [32]byte, Coin: uint32, Value: bigint]` | `price.Unbond`; fails when `LockStakeUntilBlock > currentBlock`; deducts `Waitlist` first, then active stake, frozen for `518,400` blocks | | `0x09` (`9`) | `TypeRedeemCheck` (`RedeemCheckData`) | `[RawCheck: []byte, Proof: [65]byte]` | `price.RedeemCheck` (paid by `issuer`); requires `GasPrice == 1`, `tx.GasCoin == check.GasCoin`, `len(check.Nonce) <= 16` | | `0x0A` (`10`) | `TypeSetCandidateOnline` (`SetCandidateOnData`) | `[PubKey: [32]byte]` | `price.SetCandidateOn`; `OwnerAddress` or `ControlAddress`, fails with `CandidateJailed` while jailed | | `0x0B` (`11`) | `TypeSetCandidateOffline` (`SetCandidateOffData`) | `[PubKey: [32]byte]` | `price.SetCandidateOff`; `OwnerAddress` or `ControlAddress` | | `0x0C` (`12`) | `TypeCreateMultisig` (`CreateMultisigData`) | `[Threshold: uint32, Weights: []uint32, Addresses: [][20]byte]` | `price.CreateMultisig`; `1..32` unique addresses, `len(Weights) == len(Addresses)`, each `weight <= 1023`, `Threshold <= sum(Weights)` | | `0x0D` (`13`) | `TypeMultisend` (`MultisendData`) | `[List: [Coin: uint32, To: [20]byte, Value: bigint][]]` | `price.MultisendBase + (len(List) - 1) * price.MultisendDelta` (`multisend.go:69`); `1..100` items | | `0x0E` (`14`) | `TypeEditCandidate` (`EditCandidateData`) | `[PubKey: [32]byte, RewardAddress: [20]byte, OwnerAddress: [20]byte, ControlAddress: [20]byte]` | `price.EditCandidate`; current `OwnerAddress` | | `0x0F` (`15`) | `TypeSetHaltBlock` (`SetHaltBlockData`) | `[PubKey: [32]byte, Height: uint64]` | `price.SetHaltBlock`; `OwnerAddress`, `Height >= currentBlock` | | `0x10` (`16`) | `TypeRecreateCoin` (`RecreateCoinData`) | `[Name: string, Symbol: [10]byte, InitialAmount: bigint, InitialReserve: bigint, ConstantReserveRatio: uint32, MaxSupply: bigint]` | `price.RecreateCoin`; ticker owner (`version 0`), issues new `CoinID` and archives prior coin as `SYMBOL-N` | | `0x11` (`17`) | `TypeEditCoinOwner` (`EditCoinOwnerData`) | `[Symbol: [10]byte, NewOwner: [20]byte]` | `price.EditTickerOwner`; current ticker owner (`owner != nil`) | | `0x12` (`18`) | `TypeEditMultisig` (`EditMultisigData`) | `[Threshold: uint32, Weights: []uint32, Addresses: [][20]byte]` | `price.EditMultisig`; `tx.sender` equals the multisig address (`SignatureType == 0x02`), `1..32` unique addresses, `len(Weights) == len(Addresses)`, each `weight <= 1023`, `Threshold <= sum(Weights)` | | `0x13` (`19`) | `TypePriceVote` | Unregistered in `decoder.go` (no struct fields) | No handler; `DecodeFromBytesWithoutSig` returns `tx type 13 is not registered` | | `0x14` (`20`) | `TypeEditCandidatePublicKey` (`EditCandidatePublicKeyData`) | `[PubKey: [32]byte, NewPubKey: [32]byte]` | `price.EditCandidatePublicKey`; `OwnerAddress`, adds old `PubKey` to `BlockList` | | `0x15` (`21`) | `TypeAddLiquidity` (`AddLiquidityDataV260`) | `[Coin0: uint32, Coin1: uint32, Volume0: bigint, MaximumVolume1: bigint]` | `price.AddLiquidity`; pool exists, required `Coin1` amount `<= MaximumVolume1` | | `0x16` (`22`) | `TypeRemoveLiquidity` (`RemoveLiquidityV240`) | `[Coin0: uint32, Coin1: uint32, Liquidity: bigint, MinimumVolume0: bigint, MinimumVolume1: bigint]` | `price.RemoveLiquidity`; returned amounts satisfy `>= MinimumVolume0` and `>= MinimumVolume1` | | `0x17` (`23`) | `TypeSellSwapPool` (`SellSwapPoolDataV260`) | `[Coins: uint32[2..5], ValueToSell: bigint, MinimumValueToBuy: bigint]` | `price.SellPoolBase + (len(Coins) - 2) * price.SellPoolDelta`; `1..4` distinct pools, output `>= MinimumValueToBuy` | | `0x18` (`24`) | `TypeBuySwapPool` (`BuySwapPoolDataV260`) | `[Coins: uint32[2..5], ValueToBuy: bigint, MaximumValueToSell: bigint]` | `price.BuyPoolBase + (len(Coins) - 2) * price.BuyPoolDelta`; `1..4` distinct pools, spend `<= MaximumValueToSell` | | `0x19` (`25`) | `TypeSellAllSwapPool` (`SellAllSwapPoolDataV260`) | `[Coins: uint32[2..5], MinimumValueToBuy: bigint]` | `price.SellAllPoolBase + (len(Coins) - 2) * price.SellAllPoolDelta`; commission is deducted from `Coins[0]` regardless of `tx.GasCoin` | | `0x1A` (`26`) | `TypeEditCandidateCommission` (`EditCandidateCommission`) | `[PubKey: [32]byte, Commission: uint32]` | `price.EditCandidateCommission`; `OwnerAddress`, `0..100`, max delta `+-10` percentage points, `1,555,200`-block interval between changes | | `0x1B` (`27`) | `TypeMoveStake` (`MoveStakeData`) | `[FromPubKey: [32]byte, ToPubKey: [32]byte, Coin: uint32, Value: bigint]` | `price.MoveStake`; permitted during active `LockStake`, moves via `FrozenFunds` over `134,400` blocks | | `0x1C` (`28`) | `TypeMintToken` (`MintTokenData`) | `[Coin: uint32, Value: bigint]` | `price.MintToken`; ticker owner (`version 0`), `Mintable == true`, `Volume + Value <= MaxSupply` | | `0x1D` (`29`) | `TypeBurnToken` (`BurnTokenDataV260`) | `[Coin: uint32, Value: bigint]` | `price.BurnToken`; any holder when `Burnable == true`, remaining `Volume - Value >= 1 pip` | | `0x1E` (`30`) | `TypeCreateToken` (`CreateTokenData`) | `[Name: string, Symbol: [10]byte, InitialAmount: bigint, MaxSupply: bigint, Mintable: bool, Burnable: bool]` | `PayForSymbol(price) + price.CreateCoin` (`create_token.go:90`); `1 pip <= InitialAmount <= MaxSupply <= 10^33 pip` | | `0x1F` (`31`) | `TypeRecreateToken` (`RecreateTokenData`) | `[Name: string, Symbol: [10]byte, InitialAmount: bigint, MaxSupply: bigint, Mintable: bool, Burnable: bool]` | `price.RecreateToken`; ticker owner (`version 0`), archives prior token as `SYMBOL-N` | | `0x20` (`32`) | `TypeVoteCommission` (`VoteCommissionDataV3`) | `51` RLP fields + empty `More` tail (listed below) | `price.VoteCommission`; `OwnerAddress`, `Height >= currentBlock`, `len(More) == 0` | | `0x21` (`33`) | `TypeVoteUpdate` (`VoteUpdateDataV230`) | `[Version: string, PubKey: [32]byte, Height: uint64]` | `price.VoteUpdate`; `OwnerAddress`, `Version` `^[a-zA-Z0-9_]{1,20}$`, `Height >= currentBlock` | | `0x22` (`34`) | `TypeCreateSwapPool` (`CreateSwapPoolData`) | `[Coin0: uint32, Coin1: uint32, Volume0: bigint, Volume1: bigint]` | `price.CreateSwapPool`; `floor(sqrt(Volume0 * Volume1)) > 1000`, `1000` LP locked at the zero address, `LP-{poolID}` has `owner = nil` | | `0x23` (`35`) | `TypeAddLimitOrder` (`AddLimitOrderData`) | `[CoinToSell: uint32, ValueToSell: bigint, CoinToBuy: uint32, ValueToBuy: bigint]` | `price.AddLimitOrder`; pool exists, both sides `>= 10^10 pip`, price in `[reversePoolPrice/5, reversePoolPrice]` | | `0x24` (`36`) | `TypeRemoveLimitOrder` (`RemoveLimitOrderData`) | `[ID: uint32]` | `price.RemoveLimitOrder`; signed by `order.Owner` | | `0x25` (`37`) | `TypeLockStake` (`LockStakeData`) | `[]` (`0xc0`, outer envelope `0x81c0`) | `price.LockStake`; `currentBlock > 10,197,360`, sets `LockStakeUntilBlock = currentBlock + 18,921,600` (`3x` weight on `safeReward` component) | | `0x26` (`38`) | `TypeLock` (`LockData`, `lock.go:14`) | `[DueBlock: uint32, Coin: uint32, Value: bigint]` | `price.Lock`; locks liquid balance until `DueBlock > currentBlock` (`DueBlock` is `uint32` in `lock.go:14`, whereas check `0x09` uses `uint64`) | ## Exact 51 fields of `VoteCommissionDataV3` (`0x20`) `vote_commission_v3.go:17-69` decodes `51` positional fields (`0..50`), where indices `3..50` are `*big.Int` values and the trailing `More []*big.Int` slice must decode empty (`len(More) == 0`): ```text RLP([ 0: PubKey ([32]byte), 1: Height (uint64), 2: Coin (uint32), 3: PayloadByte, 4: Send, 5: BuyBancor, 6: SellBancor, 7: SellAllBancor, 8: BuyPoolBase, 9: BuyPoolDelta, 10: SellPoolBase, 11: SellPoolDelta, 12: SellAllPoolBase, 13: SellAllPoolDelta, 14: CreateTicker3, 15: CreateTicker4, 16: CreateTicker5, 17: CreateTicker6, 18: CreateTicker7to10, 19: CreateCoin, 20: CreateToken, 21: RecreateCoin, 22: RecreateToken, 23: DeclareCandidacy, 24: Delegate, 25: Unbond, 26: RedeemCheck, 27: SetCandidateOn, 28: SetCandidateOff, 29: CreateMultisig, 30: MultisendBase, 31: MultisendDelta, 32: EditCandidate, 33: SetHaltBlock, 34: EditTickerOwner, 35: EditMultisig, 36: EditCandidatePublicKey, 37: CreateSwapPool, 38: AddLiquidity, 39: RemoveLiquidity, 40: EditCandidateCommission, 41: MintToken, 42: BurnToken, 43: VoteCommission, 44: VoteUpdate, 45: FailedTx, 46: AddLimitOrder, 47: RemoveLimitOrder, 48: MoveStake, 49: LockStake, 50: Lock ]) ``` ### Coins, tokens and CRR reserve URL: https://docs.minter.network/protocol/coins-tokens-and-crr Summary: Asset primitives in Minter v3.3.0 state: Bancor CRR reserve coins (10..100%), non-reserve Mintable and Burnable tokens, system LP-* shares, ticker recreation, and system CoinIDs. Every fungible asset in the `IAVL` state tree receives an immutable numeric `CoinID` (`uint32`). The state machine implements three asset classes: `BIP`-backed reserve coins (`CreateCoin 0x05`, `RecreateCoin 0x10`), non-reserve tokens (`CreateToken 0x1E`, `RecreateToken 0x1F`), and system pool share tokens (`LP-{poolId}`, minted by `CreateSwapPool 0x22`). Exact RLP schemas appear in the [transaction registry](https://docs.minter.network/protocol/transactions-registry), and symbol-length creation tariffs (`$50,000..$100`) live in the [48-field tariff schedule (`#tariffs`)](https://docs.minter.network/protocol/execution-and-fees#tariffs). ## System and bridged `CoinID` values (`Mainnet`) | `CoinID` (`uint32`) | Symbol | Minter asset class | External network and protocol role | | :--- | :--- | :--- | :--- | | `0` | `BIP` | Base network coin (`BasecoinID = 0`) | Staking, `CRR` reserves, pool routing; bridged as `BIPx` on Ethereum and BNB Smart Chain (`18` decimals) | | `1902` | `HUB` | Non-reserve token (`18` `pip` decimals) | Minter Hub oracle token (Ethereum ERC-20) | | `1993` | `USDTE` | Non-reserve token (`18` `pip` decimals) | Bridged Ethereum `USDT` (`6` external decimals, `10^12` scale factor); tariff anchor `price.Coin` | | `1994` | `USDCE` | Non-reserve token (`18` `pip` decimals) | Bridged Ethereum `USDC` (`6` external decimals, `10^12` scale factor) | | `2065` | `ETH` | Non-reserve token (`18` `pip` decimals) | Bridged Ethereum `ETH` (`18` decimals, pool `#248`) | | `2107` | `BNB` | Non-reserve token (`18` `pip` decimals) | Bridged BNB Smart Chain `BNB` (`18` decimals) | | `3494` | `USDTBSC` | Non-reserve token (`18` `pip` decimals) | Bridged BNB Smart Chain `USDT` (`18` decimals, `1:1` scale) | > **[warn] Identify assets by numeric CoinID rather than symbol** > `RecreateCoin (0x10)` and `RecreateToken (0x1F)` rename the existing asset to `SYMBOL-N` (keeping its original `CoinID` and holder balances without migrating balances to the new asset) and assign `SYMBOL` to a fresh numeric `CoinID`. Exchanges, bridges, and payment gateways must match numeric `coin.id` values rather than ticker strings. ## Asset classes and symbol validation | Property | CRR reserve coin (`0x05` / `0x10`) | Non-reserve token (`0x1E` / `0x1F`) | Pool share token (`LP-{poolId}`, `0x22`) | | :--- | :--- | :--- | :--- | | `BIP` reserve | `>= 10,000 BIP` (`10 <= CRR <= 100`) | None (`CRR = 0`) | Paired pool reserves `(Reserve0, Reserve1)` | | Supply bounds | `1 BIP <= InitialAmount <= MaxSupply <= 10^33 pip` | `1 pip <= InitialAmount <= MaxSupply <= 10^33 pip` (if `!Mintable`, `InitialAmount == MaxSupply`) | Minted and burned in `0x22`, `0x15`, `0x16` (`Bound = 1000 pip` at zero address) | | Reserve swap (`0x02..0x04`) | Supported (`formula.go`) | Fails with `CoinHasNotReserve` | Fails with `CoinHasNotReserve` | | DEX pools and orders (`0x15..0x24`) | Supported | Supported | Not applicable | | Manual mint and burn (`0x1C` / `0x1D`) | Forbidden | Controlled by `Mintable` and `Burnable` flags | Forbidden (`owner = nil`) | | Delegation (`0x07`) | Supported (reserve-weighted `BipValue`) | Fails with `CoinIsNotAllowedToDelegate` | Fails with `CoinIsNotAllowedToDelegate` | | Fee payment (`GasCoin`) | Via `{coin, BIP}` pool or `CRR` reserve | Requires a direct `{token, BIP}` pool | Requires a direct `{lp, BIP}` pool | Metadata rules enforced by `types.IsValidSymbol`: - `Name` is a UTF-8 string of at most `64` bytes; - `Symbol` is a `[10]byte` array right-padded with `0x00`, matching `^[A-Z0-9]{3,10}$` with at least one uppercase letter `A-Z` (because `-` is rejected in user transactions, `LP-` symbols are created solely by `CreateSwapPool`); - `EditCoinOwner (0x11)` transfers ticker ownership and `MintToken` rights to `NewOwner` (`BIP` and `LP-*` have `owner = nil`). ## Bancor `CRR` formulas (`10..100%`) Let `S` denote current coin `Volume` in `pip`, `R` denote current `BIP` `Reserve` in `pip`, and `c = CRR / 100` (`0.10 <= c <= 1.00`, `coreV2/formula/formula.go`). At `CRR == 100` (`c = 1`), `formula.go` uses exact `*big.Int` integer arithmetic without fractional exponents: ```text PurchaseReturn(CRR=100) = floor((S * dR_in) / R) SaleReturn(CRR=100) = floor((R * dS_in) / S) PurchaseAmount(CRR=100) = ceil((R * dS_out) / S) SaleAmount(CRR=100) = ceil((S * dR_out) / R) ``` For `10 <= CRR < 100`, `CalculatePurchaseReturn`, `CalculateSaleReturn`, `CalculatePurchaseAmount`, and `CalculateSaleAmount` in `formula.go` evaluate fractional powers in `big.Float` at `100`-bit mantissa precision (`prec = 100`) and truncate the result to integer `pip`: ```text dS_out = floor_100bit(S * ((1 + dR_in / R)^c - 1)) dR_out = floor_100bit(R * (1 - (1 - dS_in / S)^(1 / c))) dR_in = floor_100bit(R * ((1 + dS_out / S)^(1 / c) - 1)) dS_in = floor_100bit(S * (1 - (1 - dR_out / R)^c)) ``` Reserve invariants: - Minimum reserve is `10,000 BIP` (`10,000 * 10^18 pip`) and minimum remaining supply `S` is `1` whole coin (`10^18 pip`). Any `0x02..0x04` conversion or fee deduction that would push `R` or `S` below these floors fails with `CoinReserveUnderflow`. - Converting between two custom CRR coins (`CustomA -> CustomB`) in `0x02..0x04` executes atomically as `CustomA -> BIP -> CustomB` for a single `$0.03` tariff. ## Token supply operations (`MintToken 0x1C` and `BurnToken 0x1D`) - `MintToken (0x1C)` requires the current ticker owner (`version == 0`), `Mintable == true`, and `Volume + Value <= MaxSupply`. Newly minted units credit the sender's balance. - `BurnToken (0x1D)` (`BurnTokenDataV260`) allows any holder of a `Burnable == true` token to burn units as long as `Volume - Value >= 1 pip`. `0x1D` decrements on-chain `coin.Volume` (`SubCoinVolume`), freeing headroom under `MaxSupply`, whereas sending tokens to the zero address leaves `coin.Volume` unchanged. #### TypeScript ```typescript import { buildCreateTokenTx, parsePip, signTx } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const ownerPrivateKey: Uint8Array; const unsignedCreateToken = buildCreateTokenTx( { name: "Merchant Settlement Token", // <= 64 UTF-8 bytes symbol: "PAYUSD1", // 7 chars -> $100 USDTE tariff initialAmountPip: parsePip("1000000"), maxSupplyPip: parsePip("100000000"), mintable: true, burnable: true, }, { nonce: 7n, chainId: 1, gasPrice: 1, gasCoin: 0 }, ); const signed = signTx(unsignedCreateToken, ownerPrivateKey); console.log(signed.txHash); ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash # 1. Read asset metadata by immutable numeric CoinID curl -sS "https://gate.minter.network/v2/coin_info_by_id/1993" | jq . # 2. Quote exact-output purchase of a CRR reserve coin (CoinID 61) via Bancor reserve (swap_from=bancor) curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/estimate_coin_buy?coin_id_to_buy=61&coin_id_to_sell=0&value_to_buy=10000000000000000000&swap_from=bancor" | jq . ``` ### DEX: pools and limit orders URL: https://docs.minter.network/protocol/hybrid-dex-amm-orderbook Summary: Minter v3.3.0 DEX specification: SwapV2 integer math (998/1000, FLOOR - 1, CEIL + 1), PairV2 burn-address transfer to Mx00cedde..., OrderV2 limit orders, and U256 overflow-safe quoting. Minter's exchange engine (`swap.go`, `swapV2.go`, `order.go`, `orderV2.go`) combines constant-product `x * y = k` pools and an on-chain limit order book inside the `IAVL` state tree. At each step of a swap (`0x17`, `0x18`, `0x19`), execution advances the AMM curve to the best resting price level, fills orders at that price level in ascending `OrderID` order, and resumes along the curve. RLP signatures for `0x15..0x24` appear in the [transaction registry](https://docs.minter.network/protocol/transactions-registry#0x15). ## Liquidity pools and `SwapV2` / `PairV2` math Each pool stores a sorted asset pair `(Coin0, Coin1)` with `Coin0 < Coin1`, integer reserves `(Reserve0, Reserve1)` in `pip`, and a share token `LP-{poolId}` (`owner = nil`): - `CreateSwapPool (0x22)` requires `L_total = floor(sqrt(R0 * R1)) > 1000 pip` (`InsufficientInputAmount` when `<= 1000`). Exactly `Bound = 1000 pip` of `LP-{poolId}` is locked at the zero address `Mx0000000000000000000000000000000000000000` for the lifetime of the pool, and the creator receives `L_total - 1000 pip`. - `AddLiquidity (0x15)` computes `volume1 = floor((volume0 * R1 + 1) / R0)` (`<= MaximumVolume1`) and mints `floor((S_LP * volume0) / R0) > 0` LP units. - `RemoveLiquidity (0x16)` returns `floor((L_burn * R0) / S_LP)` and `floor((L_burn * R1) / S_LP)` while keeping both remaining reserves `>= 1000 pip`. ### `PairV2` transfer and `FLOOR - 1` / `CEIL + 1` formulas On the order-aware `PairV2` execution path (`orderV2.go:18, 82, 156`) combined with `SwapV2` (`swapV2.go:930, 962`), two deductions apply in sequence: 1. `AmountInBurned` transfer to `Mx00cedde786b34d733d1dc96559253081572df2c6`: exact-input swaps (`0x17`, `0x19`) deduct `dBurn = ceil(dx / 1000) = floor((dx + 999) / 1000)` up front, whereas exact-output swaps (`0x18`) add `ceil(dx_curve / 999) = floor((dx_curve + 998) / 999)` on top of the curve input. This transfer increases the balance of `Mx00cedde786b34d733d1dc96559253081572df2c6` without reducing the coin's on-chain `Volume` (`total supply`). 2. A `0.20%` pool fee (`998 / 1000` factor) remains inside pool reserves, increasing reserves backing `LP-{poolId}`: ```text // Exact input (calcBuy, swapV2.go:930): FLOOR minus 1 pip dBurn = floor((dx + 999) / 1000) dx_net = dx - dBurn dy = max(0, Y - floor((X * Y * 10^6) / (((dx_net + X) * 1000 - dx_net * 2) * 1000)) - 1) // Exact output (calcSell, swapV2.go:962, for dy < Y): CEIL plus 1 pip dx_curve = floor((X * dy * 1000) / ((Y - dy) * 998)) + 1 dx_total = dx_curve + floor((dx_curve + 998) / 999) ``` ## On-chain limit orders `OrderV2` (`0x23` / `0x24`) and matching Limit orders are indexed in a red-black price-time tree (`OrderIndex`, ordered by exact rational ratio `Sale / Buy` and FIFO `OrderID`): - The `{CoinToSell, CoinToBuy}` AMM pool must exist (`PairNotExists`, `code 701`). - Both `ValueToSell` and `ValueToBuy` must satisfy `>= 10^10 pip` (`0.00000001` coin; otherwise `TooSmallOrderVolume`, `code 712`). - Limit prices in `AddLimitOrder (0x23)` must lie inside `[reversePoolPrice / 5, reversePoolPrice]`: an order cannot cross the current pool price (`OrderPriceIsTooLow`) and cannot sit more than `5x` away (`OrderPriceIsTooHigh`). - Unfilled Mainnet orders expire after `483,840` blocks (`4 * 7 * 17,280` = `28` days at the nominal `5 s` block interval; `86,400` blocks on Testnet) and are swept in batches during `EndBlock` when `height % 720 == 360`, returning remaining `WantSell` to `order.Owner` (`OrderExpiredEvent`). - Order matching deducts `ceil(0.1%)` on both sides into pool reserves (`order.go:436`). If a partial fill leaves `< 10^10 pip` on either side, the order closes and returns the remaining `WantSell` to its owner (`OrderExpiredEvent`). ### Multi-hop routes and directional slippage bounds `Coins` in `0x17..0x19` lists `2..5` coin IDs (`1..4` distinct pools with no repeated pair). In `SellAllSwapPool (0x19)`, monetary commission is deducted from `Coins[0]`, while `tx.GasCoin` is still checked for existence in state and adds `+1` to `Gas` when `GasCoin != 0`. Compute client slippage limits in integer `pip`: round `minimumValueToBuy` down (`FLOOR`) and `maximumValueToSell` up (`CEIL`). ## Interactive AMM and `PairV2` quote calculator ## Overflow-safe `U256` quoting With pool reserves near `10^25 pip` and trade sizes near `10^22 pip`, the numerator `X * Y * 10^6` reaches `~10^56`, exceeding `u128::MAX` (`~3.4 * 10^38`). Rust integrations must compute quotes in `U256` with `checked_mul` and return `None` on overflow rather than saturating `u128`: #### TypeScript ```typescript import { buildSellSwapPoolTx, estimatePairV2SwapOutPip, parsePip, signTx, } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const reserveInPip: bigint; declare const reserveOutPip: bigint; declare const traderPrivateKey: Uint8Array; const quotedOutPip = estimatePairV2SwapOutPip( reserveInPip, reserveOutPip, parsePip("10000"), ); // FLOOR slippage bound at 50 bps (0.50%) const minBuyPip = (quotedOutPip * 9_950n) / 10_000n; const swapTx = buildSellSwapPoolTx( { coins: [0, 1993, 1902], valueToSellPip: parsePip("10000"), minimumValueToBuyPip: minBuyPip, }, { nonce: 42n, chainId: 1, gasPrice: 1, gasCoin: 0 }, ); const signed = signTx(swapTx, traderPrivateKey); console.log(signed.txHash); ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash # 1. Inspect BIP (0) / USDTE (1993) pool reserves curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/swap_pool/0/1993" | jq . # 2. Compute order-aware best route and output for 100 BIP -> USDTE curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/best_trade/0/1993/input/100000000000000000000" | jq . # 3. Query pool order book and fetch specific orders via repeated ids parameters curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/limit_orders/0/1993?limit=20" | jq . curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/limit_orders?ids=1&ids=2" | jq . ``` ### Emission, staking, rewards and penalties URL: https://docs.minter.network/protocol/staking-lockstake-and-penalties Summary: PayRewardsV5Fix emission and 720-block distribution, 64-validator and 1,000-slot caps, Waitlist, 3-year LockStake (0x25), and the consensus penalty table. Minter's delegated Proof-of-Stake module (`candidates.go`, `validators.go`, `frozen_funds.go`, `blockchain.go`) prices stakes in `BIP` and `CRR` reserve coins, distributes block emission alongside transaction commissions, and enforces slashing and downtime rules. RLP signatures for `0x07`, `0x08`, `0x1B`, `0x25`, and `0x26` appear in the [transaction registry](https://docs.minter.network/protocol/transactions-registry#0x07). ## Emission and `PayRewardsV5Fix` distribution All transaction commissions converted into `BIP` enter `rewardPool` with zero fee burn and combine with block `BIP` emission (`blockchain.go:401`, `validators.go:435`): 1. Cadence: rewards accumulate every `12` blocks in `AccumReward` across signing validators and distribute once every `720` blocks (`1` hour at the nominal `5 s` block interval). 2. Deduction order every `720` blocks: `10%` transfers to `DAOAddress` and `10%` transfers to `DevelopersAddress`; the validator retains its `commission%` (`0%..100%`) of the remaining `80%` at `RewardAddress`, and the balance distributes across active delegators. 3. Auto-compounding into stake: each delegator's reward share queues via `candidate.AddUpdate` directly into that delegator's `BIP` stake slot on the same validator (`RewardEvent`) rather than paying out to liquid wallet balance. 4. Price-drop adjustment: when the `BIP` price drops by `10%` or more, the dynamic base block reward steps down (down to `calcReward == 0`), while the protected `safeReward` component keeps accruing to all stakes, with `LockStake` stakes weighted `3x` in its distribution. ## Delegation, validator caps, and the `20%` concentration limit `Delegate (0x07)` accepts `BIP` (`CoinID 0`) and `CRR` reserve coins (`0x05` / `0x10`); non-reserve tokens and `LP-*` shares fail with `CoinIsNotAllowedToDelegate`. For a custom `CRR` coin with supply `S`, `BIP` reserve `R`, and network-wide delegated amount `D_total`, `candidates.go` values each stake from the locked `BIP` reserve: ```text lockedBipReserve = R - CalculateSaleReturn(S, R, CRR, S - D_total) stakeBipValue = floor((lockedBipReserve * stakeAmount) / D_total) ``` Validator and candidate set limits (`RecalculateStakesV2` runs every `720` blocks): - Up to `64` candidates with `online` status, `currentBlock > JailedUntil`, and `TotalBipStake >= 1,000 BIP` form the active `Tendermint` validator set (`votingPower = max(1, floor(validatorBipStake * 10^8 / totalSelectedBipStake))`). - Candidates outside the `top-100` by `TotalBipStake` are dropped every `720` blocks, moving their stakes into `518,400`-block `FrozenFunds`. - When `Candidates.Count >= 192`, `DeclareCandidacy (0x06)` requires initial stake exceeding at least one existing candidate. - Concentration cap (`IsDelegatorStakeAllowed`): when active validators number `>= 4`, `Delegate (0x07)` fails with `code 415` (`TooBigStake`) if integer division `floor(newTotalStakes / newCandidateStake) < 5` (roughly `20%` of network stake). ## `1,000` stake slots and `Waitlist` Each candidate keeps at most `MaxDelegatorsPerCandidate = 1,000` active `(Owner, Coin)` slots sorted by `BipValue`: - When all `1,000` slots are occupied and a new `Delegate (0x07)` transaction's combined `(Owner, Coin)` `BipValue` falls below the `1,000`th slot (`GetMinStake`), `delegate_v260.go` rejects the transaction with `TooLowStake`. - Existing active stakes displaced below slot `1,000` during the `720`-block `RecalculateStakesV2` pass move into `Waitlist` and emit `StakeKickEvent`. - `Waitlist` entries carry `0` voting weight and earn `0` rewards. Submitting a new `Delegate (0x07)` for the same `(PubKey, Coin)` merges the `Waitlist` balance into the new stake, while `Unbond (0x08)` and `MoveStake (0x1B)` deduct `Waitlist` first before touching active `stakes`. ## `LockStake (0x25)`, `Unbond`, `MoveStake`, and `Lock` `LockStake (0x25)` (empty RLP list `[]` -> `0xc0`, enabled at `currentBlock > 10,197,360`, `lock_stake.go:70`) sets `LockStakeUntilBlock = currentBlock + 18,921,600` (`1,095` days = `3` years at the nominal `5 s` block interval; `34,560` blocks on Testnet). > **[warn] LockStake irreversibility and 3x weight scope** > No transaction cancels `LockStake` early, and submitting `0x25` again resets `LockStakeUntilBlock` to `currentBlock + 18,921,600` (ordinary `Delegate 0x07` calls do not extend the lock). The `3x` weight multiplier applies solely to the `safeReward` emission component in `PayRewardsV5Fix`; transaction commissions and remaining emission distribute at `1x` weight. Mainnet block periods and execution rules (calibrated at `BLOCK_TIME_NOMINAL = 5 s`): | Operation | Blocks (`Mainnet` / `Testnet`) | Nominal duration (`5 s/block`) | Execution rule | | :--- | :--- | :--- | :--- | | `LockStake (0x25)` | `18,921,600` / `34,560` | `1,095` days (`3` years) | While `LockStakeUntilBlock > currentBlock` (`unbond_v3.go:106`), `Unbond (0x08)` fails; once `LockStakeUntilBlock <= currentBlock`, unbonding is allowed | | `Unbond (0x08)` | `518,400` / `531` | `30` days | Queues funds in `FrozenFunds` for release in `BeginBlock(height + 518,400)` | | `MoveStake (0x1B)` | `134,400` / `177` | `7.78` days | Permitted during active `LockStake`; transfers stake to `ToPubKey` via `FrozenFunds` (verify target existence via `GET /v2/candidate/{public_key}` before broadcasting) | | `Lock (0x26)` | `DueBlock > currentBlock` | Until `DueBlock` | Locks liquid wallet balance of any coin or token on `Mx...` (`DueBlock` is `uint32` in `lock.go:14`) | ## Consensus penalty table | Violation or action | Trigger condition | Stake burn | Stake disposition and candidate status | Jail (`Mainnet`) | | :--- | :--- | :--- | :--- | :--- | | Double-signing (`DuplicateVoteEvidence`, `blockchain.go:336`) | Two conflicting signed votes at the same `(height, round, step)` | Burns `5%` (retains `floor(stake * 95 / 100)`) across active `stakes` and `FrozenFunds` in `[height, height + 518,400]` | Sets `offline` + `toDrop`; moves remaining `95%` into `FrozenFunds` for `518,400` blocks | Not applicable: candidate is dropped; stakes sit in `FrozenFunds` for `518,400` blocks | | Missed blocks (`Absent`, `validators.go:194, 1142`) | Missing `> 12` out of the sliding `24`-block window | `0%` (principal stake is untouched) | Sets `offline` + `toDrop`; delegations stay on the candidate unless dropped outside `top-100` | `17,280` blocks (`24` hours at `5 s/block`, `SetCandidateOn 0x0A` fails with `CandidateJailed`) | | Voluntary shutdown (`SetCandidateOff 0x0B`) | Signed by `OwnerAddress` or `ControlAddress` | `0%` | Sets `offline` + `toDrop` | `0` blocks (`0x0A` available immediately) | #### TypeScript ```typescript import { MinterGateClient, buildDelegateTx, buildLockStakeTx, buildMoveStakeTx, parsePip, signTx, } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const delegatorPrivKey: Uint8Array; const gate = new MinterGateClient( process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2", ); const fromPubKey = "Mpeeb140d1d932146cf394f868ac64467a2935c3f7d0ddd1517a954aa3fd2a7b04"; const toPubKey = "Mp0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; // 1. Delegate (0x07) and LockStake (0x25, empty RLP list 0xc0) const delegateTx = buildDelegateTx( { pubKey: fromPubKey, coinId: 0, valuePip: parsePip("50000") }, { nonce: 14n, chainId: 1, gasPrice: 1, gasCoin: 0 }, ); const lockStakeTx = buildLockStakeTx({ nonce: 15n, chainId: 1, gasPrice: 1, gasCoin: 0 }); // 2. MoveStake (0x1B): permitted while LockStake is active const moveTx = buildMoveStakeTx( { fromPubKey, toPubKey, coinId: 0, valuePip: parsePip("50000") }, { nonce: 16n, chainId: 1, gasPrice: 1, gasCoin: 0 }, ); console.log(signTx(delegateTx, delegatorPrivKey).txHash, lockStakeTx.type, moveTx.type); ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash # 1. Inspect candidate slot usage and minimum stake threshold before delegating curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/candidate/Mpeeb140d1d932146cf394f868ac64467a2935c3f7d0ddd1517a954aa3fd2a7b04?not_show_stakes=true" | jq . # 2. Query Waitlist entries and pending FrozenFunds unlocks for an address curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/waitlist/Mx9858effd232b4033e47d90003d41ec34ecaeda94" | jq . curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/frozen/Mx9858effd232b4033e47d90003d41ec34ecaeda94" | jq . ``` ## API (api) ### API overview and network endpoints URL: https://docs.minter.network/api Summary: Matrix of the four Minter v3.3.0 network interfaces (Node Gate API v2, Explorer REST API v2, Centrifugo WebSocket, Minter Hub API) and public Mainnet and Testnet endpoints. External Minter integrations use four specialized interfaces: `Node Gate API v2` reads recent state and broadcasts transactions, `Explorer API v2` serves full indexed history and analytics, `Centrifugo WebSocket` pushes committed block and wallet events, and `Minter Hub API` exposes cross-chain bridge parameters. ## Interface matrix | Interface | Protocol and OpenAPI 3.1 spec | Scope | | :--- | :--- | :--- | | [Node Gate API v2](https://docs.minter.network/api/node-gate-v2) | HTTP/JSON (`:28843/v2`) and gRPC (`:28842`) · [minter-gate-node-v2.yaml](https://docs.minter.network/openapi/minter-gate-node-v2.yaml) | Reads `IAVL` state within `keep_last_states`, fetches account `transaction_count` (`nonce`), quotes fees via `estimate_tx_commission`, and broadcasts signed transactions via `POST /v2/send_transaction` (`41` RPC methods) | | [Explorer API v2](https://docs.minter.network/api/explorer-v2) | HTTP/JSON (`/api/v2/...`, PostgreSQL 18 + ClickHouse) · [minter-explorer-v2.yaml](https://docs.minter.network/openapi/minter-explorer-v2.yaml) | Full history from genesis, cursor pagination, reward aggregates, hybrid pool order books (`/pools/{id}/book`), and verified PNG asset delivery | | [WebSocket events (Centrifugo)](https://docs.minter.network/api/centrifugo-websocket) | JSON WebSocket (`/connection/websocket`, Centrifugo v6) | Real-time subscriptions to `explorer:blocks`, `explorer:transactions`, and `explorer:address:` with stream history recovery | | [Minter Hub API](https://docs.minter.network/api/minter-hub-v2) | HTTP/JSON · [minter-hub-v2.yaml](https://docs.minter.network/openapi/minter-hub-v2.yaml) | Ethereum and BNB Smart Chain token registry (`token_infos`), EVM payout gas quotes (`ethereum_fee`, `bsc_fee`), settlement fees, and batch tracking | ## Networks, `ChainID`, and public endpoints | Network | `chainId` (RLP) | Base coin (`CoinID 0`) | Public base URLs | | :--- | :--- | :--- | :--- | | Mainnet (`minter-mainnet-5`) | `1` (`0x01`) | `BIP` | Public Node API: `https://gate.minter.network/v2`
Explorer API v2: `https://api-v2.minter.network/api/v2`
Centrifugo WS: `wss://explorer.minter.network/connection/websocket`
Minter Hub API: `https://hub-api.minter.network`
Explorer UI: `https://explorer.minter.network/` · Console: `https://console.minter.network/` | | Public Testnet (`minter-testnet-YYYYMM`) | `2` (`0x02`) | `MNT` | Gate API v2: `https://gate-api.testnet.minter.network/v2`
Node API v2 (alias): `https://node-api.testnet.minter.network/v2`
Faucet API: `https://faucet.testnet.minter.network`
Epoch manifest: `https://testnet.minter.network/status.json`
Explorer UI: `https://explorer.testnet.minter.network/` · Explorer API v2: `https://explorer-api.testnet.minter.network/api/v2`
Centrifugo WS: `wss://explorer.testnet.minter.network/connection/websocket`
Console: `https://console.minter.network/` (built-in Mainnet / Testnet switcher) | The public Mainnet Node API serves eight read methods and signed `POST /v2/send_transaction`. The Console and Status use the Gate API service at `https://gate-api.minter.network/api/v2`. > **[warn] Monthly full reset and cross-epoch replay on Testnet** > The public Testnet resets completely on the 1st of every month to a fresh epoch `minter-testnet-YYYYMM` (shortened protocol periods: payout `120`, `Unbond = 531`, `MoveStake = 177`, `LockStake = 34,560`, `Jail = 354`, `OrderExpire = 86,400` blocks). Read `https://testnet.minter.network/status.json` to verify the active `chain_id`, `first_block_hash`, and `state` (`ok` vs `resetting`). Because `chainId = 2` remains constant across monthly epochs and account `nonce` resets to `0`, transactions signed for a reused user `Mx...` address in a prior epoch can be replayed in a new epoch once that address is funded again; generate fresh test mnemonics per epoch. ## JSON integer strings and connectivity check Both `Node Gate API v2` and `Explorer API v2` serialize `uint64` fields (`height`, `code`, `coin.id`, `transaction_count`) and `256`-bit `pip` amounts as decimal strings; `BigInt` parsing conventions are documented in [`@minter-network/tx-core` reference (`#amounts`)](https://docs.minter.network/developers/tx-core-sdk#amounts). ```bash curl -sS "https://gate.minter.network/v2/status" | jq '{version, network, latest_block_height, catching_up}' ``` ### Node Gate API v2 URL: https://docs.minter.network/api/node-gate-v2 Summary: Minter Node Gate API v2 reference and interactive playground (41 RPC methods): Protobuf3-JSON string typing, GET /v2/estimate_tx_commission/{tx}, and POST /v2/send_transaction. `node-grpc-gateway` exposes all `41` RPC methods of `Minter Go Node v3.3.0` over HTTP/JSON (`:28843/v2`) and gRPC (`:28842`). Every operation, parameter, and response schema is defined in [`/openapi/minter-gate-node-v2.yaml`](https://docs.minter.network/openapi/minter-gate-node-v2.yaml) and listed in the reference below. The Playground runs only public read methods. Use your own Minter node for full Node API access. ## Protobuf3-JSON typing and core endpoints Under `protobuf-json` rules, `uint64` fields and `uint256 pip` amounts serialize as decimal strings: - `code`, `height`, `latest_block_height`, `transaction_count`, `keep_last_states`, and nested `coin.id` arrive as strings (`tx.code === "0"`, `nextNonce = BigInt(addr.transaction_count) + 1n`). Calling `Number.isInteger(tx.code)` on raw Gate JSON evaluates to `false`. - Array query parameters repeat the key name: `?addresses=Mx...&addresses=Mx...`, `?ids=1&ids=2`, `?fields=transactions&fields=missed`. - Dry-run fee estimation uses `GET /v2/estimate_tx_commission/{tx}`, where `{tx}` is a `0x`-prefixed signed RLP hex string (the node does not expose `POST /v2/estimate_tx_commission`). The response returns the exact fee in `gasCoin` (`pip`), accounting for `Payload` / `ServiceData` length and `USDTE / BIP` pool conversion (see [paying fees in non-BIP coins](https://docs.minter.network/protocol/execution-and-fees#gas-coin)). - `POST /v2/send_transaction` (`{"tx": "0x..."}`, alongside `GET /v2/send_transaction/{tx}`) is the sole mutating endpoint on the node. > **[info] Finality:** `POST /v2/send_transaction` validates mempool admission (`CheckTx`) only; finality occurs after block commit (`DeliverTx`) with `code === "0"`. A `code: "0"` response from `POST /v2/send_transaction` confirms mempool `CheckTx` admission only. Poll `GET /v2/transaction/{hash}` (or call `gate.waitForTransaction(txHash)`) to verify inclusion in a committed block with `code === "0"`. If `DeliverTx` fails (`code !== "0"`), the node deducts `FailedTx` without incrementing the sender's `Nonce`. ## Node Gate API v2 playground Spec: https://docs.minter.network/openapi/minter-gate-node-v2.yaml ## Reading `nonce`, estimating fees, and broadcasting #### TypeScript ```typescript import { MinterGateClient, buildSendTx, formatPip, parsePip, signTx, } from "@minter-network/tx-core"; import type { MinterWallet } from "@minter-network/tx-core"; // Supply these inputs from your application. declare const senderWallet: MinterWallet; const gate = new MinterGateClient( process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2", ); // 1. Next valid nonce = BigInt(transaction_count) + 1n const nonce = await gate.getNextNonce(senderWallet.address); // 2. Build and sign Send (0x01) in USDTE (coinId: 1993, paying gas in coinId 1993) const unsigned = buildSendTx( { coinId: 1993, to: "Mx6fac4d18c912343bf86fa7049364dd4e424ab9c0", valuePip: parsePip("10"), }, { nonce, chainId: 1, gasPrice: 1, gasCoin: 1993, payload: "invoice:2026-9001", }, ); const signed = signTx(unsigned, senderWallet.privateKey); // 3. Dry-run commission quote via GET /v2/estimate_tx_commission/{tx} const quote = await gate.estimateTxCommission(signed.signedRawTxHex); console.log("Estimated fee (USDTE):", formatPip(BigInt(quote.commission))); // 4. Broadcast to mempool (CheckTx) and wait for block execution (DeliverTx) const mempool = await gate.sendTransaction(signed.signedRawTxHex); if (mempool.code !== "0") { throw new Error(`CheckTx rejected (${mempool.code}): ${mempool.log}`); } const committed = await gate.waitForTransaction(signed.txHash); if (committed.code !== "0") { throw new Error(`DeliverTx failed (${committed.code}); Nonce was not incremented`); } console.log("Committed in block:", committed.height, "hash:", committed.hash); ``` #### cURL For extended methods, set `MINTER_NODE_V2_URL` to the base `/v2` URL of your own node. ```bash # 1. Read account balances and transaction_count curl -sS "https://gate.minter.network/v2/address/Mx9858effd232b4033e47d90003d41ec34ecaeda94" | jq . # 2. Compute order-aware best route for 100 BIP -> USDTE curl -sS "${MINTER_NODE_V2_URL:?Set the base /v2 URL of your own node}/best_trade/0/1993/input/100000000000000000000" | jq . # 3. Estimate commission for the tx-0x01-send test vector (chainId 1) curl -sS "https://gate.minter.network/v2/estimate_tx_commission/0xf87f0101018001a0df80946fac4d18c912343bf86fa7049364dd4e424ab9c088ad78ebc5ac6200008f696e766f6963653a323032362d31318001b845f8431ba04acb879e7e90f8475c553a23e4c2f11c7ba71ff8a36cc4ae15dc1a74f2fdc511a04da0b3d26cde48103cde55dd74e9d867e539cbbb8516f74cb3dd085b4dc951de" | jq . ``` ### Explorer API v2 URL: https://docs.minter.network/api/explorer-v2 Summary: Minter Explorer Rust API v2 reference: response wrapper, strict query validation (405, 400 invalid_query, 409 ambiguous_hash), cursor pagination, and SHA-256 PNG assets. `Minter Explorer Rust API v2` (`/api/v2/...`, specification [`/openapi/minter-explorer-v2.yaml`](https://docs.minter.network/openapi/minter-explorer-v2.yaml)) serves full genesis history from PostgreSQL 18 and daily reward and trading aggregates from ClickHouse. Every JSON endpoint returns the response wrapper `{ chain_id, base_coin_symbol, source_context, coverage, data }`. ## Strict query validation and error codes `explorer-dev-api` validates the HTTP method and every query parameter before querying storage: | HTTP status | Error code | Condition | | :--- | :--- | :--- | | `405 Method Not Allowed` | `method_not_allowed` | Any HTTP verb other than `GET` | | `400 Bad Request` | `invalid_query` | Unknown query key for the target route (such as `cursor` or `limit` on `/addresses/{address}/rewards/chart`, `all` on `/coins/cross-chain`, or `period` on `/home-statistics`) | | `400 Bad Request` | `duplicate_query` | Repeated query key (`?limit=10&limit=20`) | | `400 Bad Request` | `invalid_hash` | `GET /api/v2/blocks/{height}/validators` called without a non-empty block `hash` | | `400 Bad Request` | `invalid_tab` | `GET /api/v2/validators/{public_key}/activity` called without required `tab` (`transactions` \| `stakes` \| `penalties`) | | `409 Conflict` | `ambiguous_hash` | `GET /api/v2/transactions/{hash}` matches multiple records across source namespaces or `invalid_transactions` without disambiguating parameters | Route-specific rules: - Wallet limit orders use singular `GET /api/v2/address/{address}/orders`, whereas wallet profile endpoints use plural `/api/v2/addresses/{address}`. - The `all` parameter exists solely on `GET /api/v2/coins` and `GET /api/v2/pools` (do not pass `all` to `/api/v2/coins/cross-chain` or `/api/v2/coins/{id}`). - `GET /api/v2/validators` enforces `limit <= 50`. - Optional `stand` and `source` parameters select a specific stand or archive namespace (such as `?source=legacy-business-full-20261031`). ## Resolving `409 ambiguous_hash` and cursor pagination When `GET /api/v2/transactions/{hash}` returns `409 ambiguous_hash`, the body includes `choices[]` and an optional `choices_cursor`. Re-request the desired record by passing its `namespace`, `relation` (`transactions` or `invalid_transactions`), and `id` to `GET /api/v2/transactions/{hash}?namespace=...&relation=...&id=...`. Global feeds (`/api/v2/blocks`, `/api/v2/transactions`) paginate via `page` and `limit` (`1..100`), whereas deep feeds on `/api/v2/addresses/{address}`, `/api/v2/pools/{id}/trades`, and `/api/v2/addresses/{address}/rewards/history` paginate via opaque `cursor` tokens (`/api/v2/addresses/{address}` also exposes section cursors `failed_cursor`, `frozen_cursor`, `balance_cursor`, `positions_cursor`, `unbond_cursor`, `move_cursor`, `legacy_move_cursor`, `waitlist_cursor`). ## Verified PNG assets (`/api/v2/assets/{digest}.png`) Explorer clears raw external icon URLs (`icon_url: null`) in JSON responses. Verified PNG icons (`<= 1 MiB`, `\x89PNG\r\n\x1a\n` + `IHDR` headers) are content-addressed by lowercase 64-hex SHA-256 digest (`^[0-9a-f]{64}$`): - Rust backend route: `GET /api/v2/assets/{digest}.png`; - Next.js SSR proxy route referenced by `icon.src`: `GET /api/assets/{digest}` (serves `image/png` with `Cache-Control: public, max-age=31536000, immutable` and `X-Content-Type-Options: nosniff`). ## Explorer API v2 playground Spec: https://docs.minter.network/openapi/minter-explorer-v2.yaml ## Request examples #### TypeScript ```typescript const EXPLORER_API = process.env.MINTER_EXPLORER_API_URL ?? "https://api-v2.minter.network/api/v2"; // 1. Fetch an address profile page using cursor pagination export async function fetchAddressPage(address: string, cursor?: string) { const params = new URLSearchParams({ limit: "25" }); if (cursor) params.set("cursor", cursor); const res = await fetch( `${EXPLORER_API}/addresses/${encodeURIComponent(address)}?${params}`, ); if (!res.ok) { throw new Error(`Explorer HTTP ${res.status}`); } return (await res.json()) as { chain_id: string; base_coin_symbol: string | null; source_context: Record; coverage: Record; data: Record; }; } // 2. Fetch a transaction by Mt... hash and resolve 409 ambiguous_hash export async function fetchTransactionByHash(hash: string) { const res = await fetch(`${EXPLORER_API}/transactions/${encodeURIComponent(hash)}`); if (res.status === 409) { const conflict = (await res.json()) as { choices: Array<{ source: { namespace: string; relation: string; id: string } }>; }; const primary = conflict.choices[0]?.source; if (!primary) throw new Error("Empty choices in 409 ambiguous_hash"); const qs = new URLSearchParams({ namespace: primary.namespace, relation: primary.relation, id: primary.id, }); const resolved = await fetch( `${EXPLORER_API}/transactions/${encodeURIComponent(hash)}?${qs}`, ); return resolved.json(); } if (!res.ok) throw new Error(`Explorer HTTP ${res.status}`); return res.json(); } ``` #### cURL ```bash # 1. Network home statistics (no period parameter) curl -sS "https://api-v2.minter.network/api/v2/home-statistics" | jq . # 2. Hybrid order book and AMM basis for pool #48 (BIP / USDTE) curl -sS "https://api-v2.minter.network/api/v2/pools/48/book" | jq . # 3. Validator activity feed with required tab=stakes parameter curl -sS "https://api-v2.minter.network/api/v2/validators/Mpeeb140d1d932146cf394f868ac64467a2935c3f7d0ddd1517a954aa3fd2a7b04/activity?tab=stakes&limit=20" | jq . ``` ### WebSocket events (Centrifugo) URL: https://docs.minter.network/api/centrifugo-websocket Summary: Centrifugo v6 WebSocket protocol in Minter Explorer: explorer:blocks, explorer:transactions, and explorer:address: channels, live_publish.rs payloads, recover: true, and cursor HTTP catchup. `live_publish.rs` in Minter Explorer broadcasts committed events to `Centrifugo v6` right after PostgreSQL commits each block (public Mainnet endpoint: `wss://explorer.minter.network/connection/websocket`). Channels run with an in-memory recovery ring of `history_size = 20`, `history_ttl = 300s`, and `force_recovery = true`. Because `Tendermint v0.34.19` finalizes blocks after `> 2/3` validator signatures without chain reorganizations, published frames reflect committed state (see [single-block finality](https://docs.minter.network/protocol#finality)). ## Channels and legacy aliases In `explorer:address:`, write both the `mx` prefix and the 40 hex characters in lowercase; in the legacy `` channel, capitalize `M` and keep the 40 hex characters lowercase. `live_publish.rs` does not publish a separate `explorer:pools` channel: pool swap receipts stream on `explorer:transactions`. | `v2` channel | Legacy aliases | `pub.data` payload (`live_publish.rs`) | | :--- | :--- | :--- | | `explorer:blocks` | `blocks` | `{ "block": blockCard, "totals": { "latest_block_height": "...", "total_transactions": "..." } }` | | `explorer:transactions` | `transactions`, `transactions_100` | Hydrated committed `txCard` object (including `0x17..0x19` pool swaps) | | `explorer:address:` | `` | Two event kinds: `{ "kind": "transaction", "height": "...", "transaction": txCard }` and `{ "kind": "balances", "address": "Mx...", "height": "...", "current_wallet": {...}, "liquid_balances": {...} }` | | None | `stake`, `commissions` | Staking transactions and `UpdateCommissionsEvent` notifications | ## Centrifugo v6 JSON wire frames Frames are newline-delimited JSON commands (`\n`). After opening the socket, send `connect` followed by `subscribe` commands. Reply `{}\n` whenever the broker sends an empty `{}` ping frame (every `25 s`). Sample `explorer:blocks` push frame: ```json { "push": { "channel": "explorer:blocks", "pub": { "offset": 1042, "data": { "block": { "height": "40893715", "hash": "375349d74f84738d3accb2c88b8de9c83d1381966e80c8fef214aa56ba175ec0", "time": "2026-11-15T23:06:02Z", "tx_count": "3", "block_reward": "103", "proposer": { "public_key": "Mpeeb140d1d932146cf394f868ac64467a2935c3f7d0ddd1517a954aa3fd2a7b04", "moniker": "Sentinel Validator" } }, "totals": { "latest_block_height": "40893715", "total_transactions": "130482910" } } } } } ``` Sample `explorer:address:` push frame wrapping `txCard` under `transaction`: ```json { "push": { "channel": "explorer:address:mx9858effd232b4033e47d90003d41ec34ecaeda94", "pub": { "offset": 88, "data": { "kind": "transaction", "height": "40893715", "transaction": { "hash": "Mte53eeda7a4268983a7ea5481cf150ae9d6ef76c1e497f7489d99805a812b7011", "height": "40893715", "type": 1, "code": "0", "status": "success", "from_address": "Mx6fac4d18c912343bf86fa7049364dd4e424ab9c0", "payload": "INV-2026-8841", "data": { "coin": { "id": "1993", "symbol": "USDTE" }, "to": "Mx9858effd232b4033e47d90003d41ec34ecaeda94", "value_pip": "25000000000000000000" } } } } } } ``` ## Stream recovery (`recover: true`) and cursor HTTP catchup Because `explorer:address:` emits both incoming and outgoing wallet activity, payment handlers must check `txCard.code` (`"0"` or `0`), `Send` type (`1`), `(txCard.data?.to ?? "").toLowerCase() === MERCHANT_MX.toLowerCase()`, numeric `coin.id`, and replay deduplication on `txCard.hash`. To recover cleanly across disconnects: 1. Persist `epoch`, the latest channel `offset`, and `lastHeight`. 2. Re-subscribe with `recover: true`, `offset`, and `epoch`. When the outage fits inside `20` messages and `300 s`, Centrifugo sets `recovered: true` and replays missed `publications[]`. 3. When `recovered === false` (ring evicted or broker restarted with a new `epoch`), walk `GET /api/v2/addresses/{address}?limit=50&cursor=...` page by page until transaction height reaches `<= lastHeight`. ```typescript import { parsePip } from "@minter-network/tx-core"; const WS_URL = process.env.MINTER_WS_URL ?? "wss://explorer.minter.network/connection/websocket"; const EXPLORER_API = process.env.MINTER_EXPLORER_API_URL ?? "https://api-v2.minter.network/api/v2"; const MERCHANT_MX = "Mx9858effd232b4033e47d90003d41ec34ecaeda94"; const CHANNEL = `explorer:address:${MERCHANT_MX.toLowerCase()}`; interface StreamCursorState { epoch?: string; offset?: number; lastHeight: bigint; } interface TxCard { hash: string; height: string | number; type: string | number; code?: string | number | null; status?: string; payload?: string; data?: { to?: string; value_pip?: string; coin?: { id?: string | number }; }; } const state: StreamCursorState = { lastHeight: 0n }; const creditedHashes = new Set(); const consumedInvoiceIds = new Set(); function processPaymentCard(txCard: TxCard, openInvoices: Map): void { if (!txCard?.hash) return; const hashKey = `mt${txCard.hash.trim().replace(/^(mt|0x)/i, "").toLowerCase()}`; if (creditedHashes.has(hashKey)) return; const codeOk = txCard.code !== undefined && txCard.code !== null && String(txCard.code) === "0" && txCard.status !== "failed"; const isSend = Number(txCard.type) === 1; const toOk = (txCard.data?.to ?? "").toLowerCase() === MERCHANT_MX.toLowerCase(); const coinOk = Number(txCard.data?.coin?.id) === 1993; const invoiceId = (txCard.payload ?? "").trim(); const expectedPip = openInvoices.get(invoiceId); if ( !codeOk || !isSend || !toOk || !coinOk || !txCard.data?.value_pip || expectedPip === undefined || consumedInvoiceIds.has(invoiceId) ) { return; } if (BigInt(txCard.data.value_pip) >= expectedPip) { creditedHashes.add(hashKey); consumedInvoiceIds.add(invoiceId); console.log("Credited USDTE invoice:", invoiceId, "tx:", txCard.hash); } } async function catchUpViaHttpCursor( sinceHeight: bigint, openInvoices: Map, ): Promise { let cursor: string | undefined; while (true) { const qs = new URLSearchParams({ limit: "50" }); if (cursor) qs.set("cursor", cursor); const res = await fetch(`${EXPLORER_API}/addresses/${MERCHANT_MX}?${qs}`); if (!res.ok) throw new Error(`Backfill HTTP ${res.status}`); const body = (await res.json()) as { data?: { transactions?: TxCard[]; next_cursor?: string | null }; }; const items = body.data?.transactions ?? []; if (items.length === 0) break; let reachedSavedHeight = false; for (const txCard of items) { const h = BigInt(txCard.height); if (h <= sinceHeight) { reachedSavedHeight = true; break; } processPaymentCard(txCard, openInvoices); } if (reachedSavedHeight || !body.data?.next_cursor) break; cursor = body.data.next_cursor; } } export function startMerchantStream( openInvoices = new Map([["invoice:2026-9001", parsePip("25")]]), ): WebSocket { const ws = new WebSocket(WS_URL); ws.addEventListener("open", () => { const sub: Record = { channel: CHANNEL, recover: true }; if (state.epoch !== undefined && state.offset !== undefined) { sub.epoch = state.epoch; sub.offset = state.offset; } ws.send( `${JSON.stringify({ id: 1, connect: {} })}\n${JSON.stringify({ id: 2, subscribe: sub })}\n`, ); }); ws.addEventListener("message", (event) => { for (const line of String(event.data).split("\n")) { const trimmed = line.trim(); if (!trimmed) continue; if (trimmed === "{}") { ws.send("{}\n"); continue; } const msg = JSON.parse(trimmed) as { id?: number; subscribe?: { epoch?: string; offset?: number; recovered?: boolean; publications?: Array<{ offset?: number; data?: { kind?: string; height?: string; transaction?: TxCard } }>; }; push?: { channel?: string; pub?: { offset?: number; data?: { kind?: string; height?: string; transaction?: TxCard } }; }; }; if (msg.id === 2 && msg.subscribe) { const hadPriorPosition = state.epoch !== undefined; state.epoch = msg.subscribe.epoch; state.offset = msg.subscribe.offset; for (const pub of msg.subscribe.publications ?? []) { if (pub.offset !== undefined) state.offset = pub.offset; if (pub.data?.kind === "transaction" && pub.data.transaction) { processPaymentCard(pub.data.transaction, openInvoices); const h = BigInt(pub.data.height ?? pub.data.transaction.height); if (h > state.lastHeight) state.lastHeight = h; } } if (hadPriorPosition && msg.subscribe.recovered === false && state.lastHeight > 0n) { void catchUpViaHttpCursor(state.lastHeight, openInvoices); } } const pub = msg.push?.pub; if (msg.push?.channel === CHANNEL && pub) { if (pub.offset !== undefined) state.offset = pub.offset; if (pub.data?.kind === "transaction" && pub.data.transaction) { processPaymentCard(pub.data.transaction, openInvoices); const h = BigInt(pub.data.height ?? pub.data.transaction.height); if (h > state.lastHeight) state.lastHeight = h; } } } }); return ws; } ``` ## Inspecting raw frames with `websocat` Send newline-separated `connect` and `subscribe` frames from a terminal with `websocat`: ```bash printf '{"id":1,"connect":{}}\n{"id":2,"subscribe":{"channel":"explorer:blocks"}}\n' | \ websocat wss://explorer.minter.network/connection/websocket ``` ### Minter Hub API URL: https://docs.minter.network/api/minter-hub-v2 Summary: Token discovery, withdrawal quotes and cross-chain evidence for a real BIP payout to BSC. The mainnet adapter exposes read-only JSON at `https://hub-api.minter.network`. Clients use `/v2` for discovery, quotes and tracking. The legacy Console uses the compatibility routes below. [Download the OpenAPI specification](https://docs.minter.network/openapi/minter-hub-v2.yaml). | GET route | Response | | --- | --- | | `/v2/tokens` | `contracts.minter_multisig`, per-chain token contracts and decimals. Map Minter coin IDs as strings. | | `/v2/fee?chain=bsc&minter_token_id=0&amount=2500` | Quote for 2,500 BIP. The input amount is a decimal coin amount. The `*_pip` fields are integer strings in Minter's 18-decimal unit. | | `/v2/status/{txHash}?chain=bsc` | Track a withdrawal by its source `Mt…` or a deposit by its source `0x…`. Read `status`, `fee_source`, `out_tx_hash` and `settlement_minter_tx_hash` together. | | `/mhub2/v1/token_infos` and `/oracle/v1/prices` | The legacy client reads `list.token_infos` and `prices.list`. The adapter limits the legacy registry to coins with price coverage. | | `/oracle/v1/ethereum_fee` and `/oracle/v1/bsc_fee` | `min` and `fast` are decimal **USD** strings. | | `/mhub2/v1/transaction_status/{txHash}` and `/mhub2/v1/transaction_fee_record/{txHash}` | Legacy status and settlement fees. A fee record can return HTTP 404 while the settlement is unconfirmed by the adapter. | ## Quoting a withdrawal Read `breakdown.sufficient_amount` and `breakdown.expected_received`. `bridge_fee_token_pip` is the network fee in the transferred coin. `breakdown.bridge_commission_pip` is the protocol commission at 100 basis points before rounding to the destination precision. Minter transaction gas is separate. The legacy holder endpoint currently returns `{"discount":"0"}`. For Ethereum USDTE (coin 1993), external USDT has six decimals and each raw unit represents `1000000000000` pip. BSC BIPx has 18 decimals. Use your own external address as `recipient` to request an unsigned `tx_template`. Review its coin, vault, amount and JSON payload. Current templates carry `recipient` and `type`. A historical legacy payload may also carry `fee`. Its value belongs to that transaction. Never copy a historical fee into a new quote. ```bash curl -fsS 'https://hub-api.minter.network/v2/tokens?chain=bsc' curl -fsS 'https://hub-api.minter.network/v2/fee?chain=bsc&minter_token_id=0&amount=2500' curl -fsS 'https://hub-api.minter.network/v2/status/Mtba3524a0b225937f9cd976b35dae4a35bee41849d26f4dd705e680b84c583ff8?chain=bsc' ``` A read-only TypeScript client can check the source hash directly. ```typescript const base = "https://hub-api.minter.network"; const hash = "Mtba3524a0b225937f9cd976b35dae4a35bee41849d26f4dd705e680b84c583ff8"; const response = await fetch(`${base}/v2/status/${hash}?chain=bsc`); if (!response.ok) throw new Error(`Hub API HTTP ${response.status}`); const report = await response.json() as { status: string; fee_source: string | null; out_tx_hash: string }; console.log(report.status, report.fee_source, report.out_tx_hash); ``` ## Reading a transfer across both chains At 06:38 UTC on 1 December 2026 the adapter reported `deposit_received` and `fee_source: estimated` for a BIP withdrawal. During this stage `out_tx_hash` can be empty, and a fresh quote can differ materially from settlement. The two chains establish the payout independently. | Evidence | Confirmed amount | | --- | --- | | [Minter Send, block 41048614](https://explorer.minter.network/transactions/Mtba3524a0b225937f9cd976b35dae4a35bee41849d26f4dd705e680b84c583ff8) | The sender transferred **2175.924385324264389766 BIP** to the vault. Its legacy `send_to_bsc` payload set `fee` to `2153165141471021745868` pip. | | [Minter Multisend, block 41048639](https://explorer.minter.network/transactions/Mt32c4fb71c612049526738ec5927907fe37419182d569b0ce31b0ca195958e52b) | Network fee **2153.165141471021745868 BIP**, protocol commission **21.759243853242643897 BIP**. Their deduction leaves **1.000000000000000001 BIP**. | | [BSC receipt, block 136759040](https://bscscan.com/tx/0x5235acf91681a53a8019688cac00ebee42e8ca4c7d4d53e90e2261bacf38b921) | Successful BIPx `Transfer` of `1000000000000000001` raw units to `0x0ea540c1dbf72879ac70aedb0b4239e9dc5aa4c0`. | Use the [withdrawal guide](https://docs.minter.network/earn/cross-chain-and-hub#withdraw) to check the destination chain and asset before sending. ## Interactive Hub API playground The embedded Playground proxies read-only `GET` requests to `https://hub-api.minter.network` and falls back to offline fixtures if the bridge adapter is unreachable. Spec: https://docs.minter.network/openapi/minter-hub-v2.yaml ## Appendix A: All 38 Minter v3.3.0 Transaction Opcodes (0x01..0x26) | Hex | Dec | Name | Go Type | Active | RLP Tuple | Base Tariff | Notes | | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | | `0x01` | 1 | `SEND` | `TypeSend / SendData` | yes | `[coinId: uint32, to: bytes20, value: uint256]` | $0.01 | | | `0x02` | 2 | `SELL` | `TypeSellCoin / SellCoinData` | yes | `[coinToSell: uint32, valueToSell: uint256, coinToBuy: uint32, minimumValueToBuy: uint256]` | $0.03 | | | `0x03` | 3 | `SELL_ALL` | `TypeSellAllCoin / SellAllCoinData` | yes | `[coinToSell: uint32, coinToBuy: uint32, minimumValueToBuy: uint256]` | $0.03 | | | `0x04` | 4 | `BUY` | `TypeBuyCoin / BuyCoinData` | yes | `[coinToBuy: uint32, valueToBuy: uint256, coinToSell: uint32, maximumValueToSell: uint256]` | $0.03 | | | `0x05` | 5 | `CREATE_COIN` | `TypeCreateCoin / CreateCoinData` | yes | `[name: utf8, symbol: bytes10, initialAmount: uint256, initialReserve: uint256, crr: uint32, maxSupply: uint256]` | $100..$50,000 (by ticker length) | | | `0x06` | 6 | `DECLARE_CANDIDACY` | `TypeDeclareCandidacy / DeclareCandidacyData` | yes | `[address: bytes20, pubKey: bytes32, commission: uint32, coinId: uint32, stake: uint256]` | $10.00 | | | `0x07` | 7 | `DELEGATE` | `TypeDelegate / DelegateDataV260` | yes | `[pubKey: bytes32, coinId: uint32, value: uint256]` | $0.10 | | | `0x08` | 8 | `UNBOND` | `TypeUnbond / UnbondDataV3` | yes | `[pubKey: bytes32, coinId: uint32, value: uint256]` | $0.10 | | | `0x09` | 9 | `REDEEM_CHECK` | `TypeRedeemCheck / RedeemCheckData` | yes | `[rawCheck: bytes, proof: bytes65]` | $0.03 (paid by issuer; 0 BIP for redeemer) | Gasless check redemption: requires gasPrice == 1 and tx.gasCoin == check.gasCoin; check does not reserve issuer balance prior to DeliverTx | | `0x0A` | 10 | `SET_CANDIDATE_ON` | `TypeSetCandidateOnline / SetCandidateOnData` | yes | `[pubKey: bytes32]` | $0.10 | | | `0x0B` | 11 | `SET_CANDIDATE_OFF` | `TypeSetCandidateOffline / SetCandidateOffData` | yes | `[pubKey: bytes32]` | $0.10 | | | `0x0C` | 12 | `CREATE_MULTISIG` | `TypeCreateMultisig / CreateMultisigData` | yes | `[threshold: uint32, weights: uint32[], addresses: bytes20[]]` | $0.10 | | | `0x0D` | 13 | `MULTISEND` | `TypeMultisend / MultisendData` | yes | `[list: [coinId: uint32, to: bytes20, value: uint256][]]` | $0.01 + $0.005 * (N - 1) | | | `0x0E` | 14 | `EDIT_CANDIDATE` | `TypeEditCandidate / EditCandidateData` | yes | `[pubKey: bytes32, rewardAddress: bytes20, ownerAddress: bytes20, controlAddress: bytes20]` | $0.10 | | | `0x0F` | 15 | `SET_HALT_BLOCK` | `TypeSetHaltBlock / SetHaltBlockData` | yes | `[pubKey: bytes32, height: uint64]` | $0.10 | | | `0x10` | 16 | `RECREATE_COIN` | `TypeRecreateCoin / RecreateCoinData` | yes | `[name: utf8, symbol: bytes10, initialAmount: uint256, initialReserve: uint256, crr: uint32, maxSupply: uint256]` | $100.00 | | | `0x11` | 17 | `EDIT_COIN_OWNER` | `TypeEditCoinOwner / EditCoinOwnerData` | yes | `[symbol: bytes10, newOwner: bytes20]` | $100.00 | | | `0x12` | 18 | `EDIT_MULTISIG` | `TypeEditMultisig / EditMultisigData` | yes | `[threshold: uint32, weights: uint32[], addresses: bytes20[]]` | $0.10 | | | `0x13` | 19 | `PRICE_VOTE` | `TypePriceVote (unregistered)` | no | none | N/A (unregistered in ExecutorV3) | Declared ID 19 (TypePriceVote) with no fields and no registered handler in ExecutorV3 | | `0x14` | 20 | `EDIT_CANDIDATE_PUBLIC_KEY` | `TypeEditCandidatePublicKey / EditCandidatePublicKeyData` | yes | `[pubKey: bytes32, newPubKey: bytes32]` | $1,000.00 | | | `0x15` | 21 | `ADD_LIQUIDITY` | `TypeAddLiquidity / AddLiquidityDataV260` | yes | `[coin0: uint32, coin1: uint32, volume0: uint256, maximumVolume1: uint256]` | $0.10 | | | `0x16` | 22 | `REMOVE_LIQUIDITY` | `TypeRemoveLiquidity / RemoveLiquidityV240` | yes | `[coin0: uint32, coin1: uint32, liquidity: uint256, minimumVolume0: uint256, minimumVolume1: uint256]` | $0.10 | | | `0x17` | 23 | `SELL_SWAP_POOL` | `TypeSellSwapPool / SellSwapPoolDataV260` | yes | `[coins: uint32[2..5], valueToSell: uint256, minimumValueToBuy: uint256]` | $0.03 + $0.005/extra hop | | | `0x18` | 24 | `BUY_SWAP_POOL` | `TypeBuySwapPool / BuySwapPoolDataV260` | yes | `[coins: uint32[2..5], valueToBuy: uint256, maximumValueToSell: uint256]` | $0.03 + $0.005/extra hop | | | `0x19` | 25 | `SELL_ALL_SWAP_POOL` | `TypeSellAllSwapPool / SellAllSwapPoolDataV260` | yes | `[coins: uint32[2..5], minimumValueToBuy: uint256]` | $0.03 + $0.005/extra hop | | | `0x1A` | 26 | `EDIT_CANDIDATE_COMMISSION` | `TypeEditCandidateCommission / EditCandidateCommission` | yes | `[pubKey: bytes32, commission: uint32]` | $10.00 | | | `0x1B` | 27 | `MOVE_STAKE` | `TypeMoveStake / MoveStakeData` | yes | `[fromPubKey: bytes32, toPubKey: bytes32, coinId: uint32, value: uint256]` | $0.10 | | | `0x1C` | 28 | `MINT_TOKEN` | `TypeMintToken / MintTokenData` | yes | `[coinId: uint32, value: uint256]` | $0.10 | | | `0x1D` | 29 | `BURN_TOKEN` | `TypeBurnToken / BurnTokenDataV260` | yes | `[coinId: uint32, value: uint256]` | $0.10 | | | `0x1E` | 30 | `CREATE_TOKEN` | `TypeCreateToken / CreateTokenData` | yes | `[name: utf8, symbol: bytes10, initialAmount: uint256, maxSupply: uint256, mintable: bool, burnable: bool]` | $100..$50,000 (by ticker length) | | | `0x1F` | 31 | `RECREATE_TOKEN` | `TypeRecreateToken / RecreateTokenData` | yes | `[name: utf8, symbol: bytes10, initialAmount: uint256, maxSupply: uint256, mintable: bool, burnable: bool]` | $100.00 | | | `0x20` | 32 | `VOTE_COMMISSION` | `TypeVoteCommission / VoteCommissionDataV3` | yes | `[pubKey: bytes32, height: uint64, coin: uint32, payloadByte..lock (48 uint256 fee fields)]` | $0.10 | Validator commission governance vote: 51 RLP items (pubKey, height, coin + 48 uint256 USDTE fee fields) | | `0x21` | 33 | `VOTE_UPDATE` | `TypeVoteUpdate / VoteUpdateDataV230` | yes | `[version: utf8, pubKey: bytes32, height: uint64]` | $0.10 | | | `0x22` | 34 | `CREATE_SWAP_POOL` | `TypeCreateSwapPool / CreateSwapPoolData` | yes | `[coin0: uint32, coin1: uint32, volume0: uint256, volume1: uint256]` | $10.00 | | | `0x23` | 35 | `ADD_LIMIT_ORDER` | `TypeAddLimitOrder / AddLimitOrderData` | yes | `[coinToSell: uint32, valueToSell: uint256, coinToBuy: uint32, valueToBuy: uint256]` | $0.10 | | | `0x24` | 36 | `REMOVE_LIMIT_ORDER` | `TypeRemoveLimitOrder / RemoveLimitOrderData` | yes | `[id: uint32]` | $0.01 | | | `0x25` | 37 | `LOCK_STAKE` | `TypeLockStake / LockStakeData` | yes | `[] (0xc0)` | $0.10 | Locks stake for 18,921,600 blocks (~3 years, irreversible); grants x3 weight to safeReward emission component only (does not multiply voting power or fee share) | | `0x26` | 38 | `LOCK` | `TypeLock / LockData` | yes | `[dueBlock: uint32, coinId: uint32, value: uint256]` | $0.01 | Account balance lock: dueBlock is uint32 (unlike check dueBlock which is uint64) | ## Appendix B: All 48 PriceCommission Tariff Parameters (VoteCommissionDataV3) | RPC parameter | VoteCommissionDataV3 field | USDTE tariff | Atomic pip (10^18) | | :--- | :--- | :--- | :--- | | `payload_byte` | `payloadByte` | $0.0002 | `200000000000000` | | `send` | `send` | $0.01 | `10000000000000000` | | `buy_bancor` | `buyBancor` | $0.03 | `30000000000000000` | | `sell_bancor` | `sellBancor` | $0.03 | `30000000000000000` | | `sell_all_bancor` | `sellAllBancor` | $0.03 | `30000000000000000` | | `buy_pool_base` | `buyPoolBase` | $0.03 | `30000000000000000` | | `buy_pool_delta` | `buyPoolDelta` | $0.005 | `5000000000000000` | | `sell_pool_base` | `sellPoolBase` | $0.03 | `30000000000000000` | | `sell_pool_delta` | `sellPoolDelta` | $0.005 | `5000000000000000` | | `sell_all_pool_base` | `sellAllPoolBase` | $0.03 | `30000000000000000` | | `sell_all_pool_delta` | `sellAllPoolDelta` | $0.005 | `5000000000000000` | | `create_ticker3` | `createTicker3` | $50000 | `50000000000000000000000` | | `create_ticker4` | `createTicker4` | $10000 | `10000000000000000000000` | | `create_ticker5` | `createTicker5` | $2000 | `2000000000000000000000` | | `create_ticker6` | `createTicker6` | $400 | `400000000000000000000` | | `create_ticker7_10` | `createTicker7to10` | $100 | `100000000000000000000` | | `create_coin` | `createCoin` | $0 | `0` | | `create_token` | `createToken` | $0 | `0` | | `recreate_coin` | `recreateCoin` | $100 | `100000000000000000000` | | `recreate_token` | `recreateToken` | $100 | `100000000000000000000` | | `declare_candidacy` | `declareCandidacy` | $10 | `10000000000000000000` | | `delegate` | `delegate` | $0.1 | `100000000000000000` | | `unbond` | `unbond` | $0.1 | `100000000000000000` | | `redeem_check` | `redeemCheck` | $0.03 | `30000000000000000` | | `set_candidate_on` | `setCandidateOn` | $0.1 | `100000000000000000` | | `set_candidate_off` | `setCandidateOff` | $0.1 | `100000000000000000` | | `create_multisig` | `createMultisig` | $0.1 | `100000000000000000` | | `multisend_base` | `multisendBase` | $0.01 | `10000000000000000` | | `multisend_delta` | `multisendDelta` | $0.005 | `5000000000000000` | | `edit_candidate` | `editCandidate` | $0.1 | `100000000000000000` | | `set_halt_block` | `setHaltBlock` | $0.1 | `100000000000000000` | | `edit_ticker_owner` | `editTickerOwner` | $100 | `100000000000000000000` | | `edit_multisig` | `editMultisig` | $0.1 | `100000000000000000` | | `edit_candidate_public_key` | `editCandidatePublicKey` | $1000 | `1000000000000000000000` | | `create_swap_pool` | `createSwapPool` | $10 | `10000000000000000000` | | `add_liquidity` | `addLiquidity` | $0.1 | `100000000000000000` | | `remove_liquidity` | `removeLiquidity` | $0.1 | `100000000000000000` | | `edit_candidate_commission` | `editCandidateCommission` | $10 | `10000000000000000000` | | `mint_token` | `mintToken` | $0.1 | `100000000000000000` | | `burn_token` | `burnToken` | $0.1 | `100000000000000000` | | `vote_commission` | `voteCommission` | $0.1 | `100000000000000000` | | `vote_update` | `voteUpdate` | $0.1 | `100000000000000000` | | `failed_tx` | `failedTx` | $0.01 | `10000000000000000` | | `add_limit_order` | `addLimitOrder` | $0.1 | `100000000000000000` | | `remove_limit_order` | `removeLimitOrder` | $0.01 | `10000000000000000` | | `move_stake` | `moveStake` | $0.1 | `100000000000000000` | | `lock_stake` | `lockStake` | $0.1 | `100000000000000000` | | `lock` | `lock` | $0.01 | `10000000000000000` |