LogoLogo
HomeEcosystemBridgeUnstake
  • About Merlin
    • Key Modules
      • ZK-Rollup Network
      • Decentralized Oracle Network
      • Data Availability
      • Two-Step ZKP Submission Mechanism
      • Fraud Proofs Based on Bitcoin
    • Tokenomics
    • Milestone
  • Developers
    • Builder Guides
      • Networks
        • Mainnet
        • Testnet
      • General Contracts
        • Contract Addresses(Mainnet)
        • Bridged Tokens
      • Fees
        • Fee Model
        • Gas
          • Bridging assets to Merlin
      • Developer Tools
        • Wallet
          • Connecting to Merlin via EVM wallet
          • Connecting to Merlin via BTC wallet
          • Multi-sig Wallets
        • RPC
        • Oracle
        • On-Chain Data
    • Junior Builder Guides
      • Write a Contract
      • Deploy a Contract with Hardhat
    • Run a Merlin Node (Coming Soon)
      • Overview
      • Node types
      • Deployment and Configuration
        • Deploy a rpc only node
        • Deploy a validator node
        • Testnet fork9 upgrade guideline
        • Mainnet fork9 upgrade guideline
        • Deploy an erigon rpc for mainnet
        • Deploy an erigon rpc for testnet
      • Validator
    • Ethereum & Merlin Differences
  • User Quick Start
    • Important Concepts
      • BTC Layer2
      • UTXO
      • AA Wallet
      • Merlin_BTC
    • How to
      • Wallet
      • MERL
        • Claim MERL
        • Where to trade MERL?
      • Gas
        • Merlin_BTC
        • MERL (AA Wallet)
          • How to Withdraw MERL to Your AA Wallet on Merlin Chain
          • MERL as Gas
      • M-Token
        • What is M-Token?
        • Why we need M-Token?
        • How to Claim M-Token? (Now Pause)
        • M-Token Contract Address
        • User Scenarios and Playbook
        • FAQ
      • Staking and Unstaking
        • Staking: Merlin’s Seal (Already Concluded)
          • M-Points Rewards and Team Rules
          • Merlin’s Seal Timeline
        • Unstaking
          • BTC
          • BRC-20
          • NFT
          • USDT/USDC
          • ETH (M-STONE)
          • Website Content Prompt
      • Bridge
        • Official Bridge
        • Third-party Bridge
      • Merlin Phantom
        • Detailed Guides
Powered by GitBook
On this page
  • What is UTXO?
  • How does UTXO work between transactions?
  • User Concerns: Transaction Fees
  1. User Quick Start
  2. Important Concepts

UTXO

PreviousBTC Layer2NextAA Wallet

Last updated 10 months ago

What is UTXO?

As one of the earliest cryptocurrencies to emerge, Bitcoin adopted the UTXO model as its underlying storage data structure. Unspent Transaction Outputs (UTXOs) represent specific amounts of Bitcoin that you have received but have not yet spent. Think of each UTXO as a distinct bill in your wallet, each with its own unique value.

As implied by its name, a UTXO is an output from a Bitcoin transaction. It remains a UTXO until it is used as an input for a subsequent transaction. When you receive Bitcoin, what you are actually receiving is a UTXO. The balance displayed in your wallet is the sum of all UTXOs you have received.

The UTXO set encompasses all UTXOs present on the Bitcoin blockchain at any given time. Bitcoin nodes maintain this set to verify the existence and ownership of coins, thus helping to prevent double-spending, an issue that had undermined earlier efforts to create a decentralized digital currency.

How does UTXO work between transactions?

Transactions based on the UTXO model consist of two parts: inputs and outputs. When a user initiates a new transaction, their wallet selects sufficient UTXOs to cover the required amount. In every valid transaction, the sum of all input values must be greater than the sum of all output values. The difference between these sums represents the transaction fee:

Similar to cash payments, a person can't pay someone $5 by tearing a $10 bill in half. Instead, they must use the $10 bill and receive the change. UTXOs function similarly; they must be spent in their entirety, and any Change is given back as a new UTXO.

User Concerns: Transaction Fees

Transaction fees are a significant concern for BTC users during transactions. It's common to hear complaints within the community about small transactions necessitating additional fees, sometimes consuming up to 80% of the transaction amount. As mentioned earlier, the number of UTXOs involved in a transaction determines the transaction cost for the user.

Where:

  • Transaction size: influenced by the number of input UTXOs being spent and the number of output UTXOs being created in that transaction.

  • Input & Output size: varies depending on the type of Bitcoin address used.

The total fee for a transaction is determined by multiplying the transaction size by the selected fee rate.

Where:

  • Fee rate: measured in Satoshis per virtual byte (Sat/vByte), which depends on the current fee market.

In a UTXO-based blockchain network, consolidating multiple UTXOs into a single UTXO is a common practice, in addition to making change. In the Bitcoin network, each UTXO is roughly the same size regardless of the amount of money it holds. Therefore, large transactions often require multiple UTXOs as inputs, which significantly increases the transaction's miner fees.

∑inputsvalue=∑outputsvalue+fee\sum_{\text{inputs}} \text{value} = \sum_{\text{outputs}} \text{value} + \text{fee}inputs∑​value=outputs∑​value+fee
Change=∑inputsvalue−Price−fee\text{Change} = \sum_{\text{inputs}}\text{value} -\text{Price} - \text{fee}Change=inputs∑​value−Price−fee
Transaction size=input count×input size+output count×output size+10\text{Transaction size} = \text{input count} \times \text{input size} + \\ \text{output count} \times \text{output size} + 10Transaction size=input count×input size+output count×output size+10
Total fee=Transaction size×Fee rate\text{Total fee} = \text{Transaction size} \times \text{Fee rate}Total fee=Transaction size×Fee rate