Maya Protocol One-Stop-Shop
  • Introduction
    • 🍫What is Maya Protocol?
      • Getting Started
      • Roles
        • Liquidity Providers
        • Swappers
        • Arbitrageurs
        • Node Operators
      • Maya Protocol Native Assets
    • 🌐Maya Ecosystem
      • User interfaces & Wallets
      • Tools
    • 🍫How to buy CACAO?
    • 🛣️Roadmap 2025
  • Deep Dive
    • 🚶‍♂️Step-by-Step Guides
      • Set up a MAYAChain wallet
        • Using El Dorito Club
        • Using THORWallet web APP
        • Using THORWallet Mobile APP
        • Through MAYANode cli
        • By importing Ledger hard wallet into Ctrl Wallet
      • Custom Memos
        • Swap
        • Add Liquidity
        • Withdraw Liquidity
    • 🛠️How It Works
      • Technology
      • Incentive Curve
      • Fees
      • Governance
      • Constants and Mimir
      • Security
      • Dynamic Inflation
      • Liquidity Nodes
      • Impermanent Loss Protection (ILP)
      • ELI5
        • What is Threshold Signature Scheme (TSS)?
    • 💵DeFi Products
      • Synthetics
      • Liquidity
    • 🔐Audits
    • 🎭Maya Masks
    • ❓FAQs
  • Blockchain Explorer
    • 🔎MayaScan
      • 🪙MRC-20 Tokens
      • 🖼️M-NFTS
  • Airdrop
    • 🪂$MAYA Airdrops Guide
  • Media
    • 📽️Aaluxx Interviews
    • 🐦Twitter Spaces
    • 🔗Links
  • Contribute
    • 😎Ambassador Program
    • 🎨Content Creators Guide
  • Node Docs
    • 🖥️MAYANodes
      • MAYANode Overview
      • Cluster Launcher
        • Setup - Linode
        • Setup - Azure
        • Setup - Hetzner Bare Metal
        • Setup - Google Cloud
        • Setup - HCloud
        • Setup - Digital Ocean
        • Setup - AWS
      • Deploying
      • Joining
      • Managing
      • Pooled MAYANodes
      • Alerting
      • Leaving
      • 🛑Emergency Procedures
      • ✔️ CHECKLIST
      • Multi-node Deployment
      • Fullnode Installation Guide
    • Bonding & Unbonding Guide
    • Bare Metal Node Guides
  • MAYACHAIN DEV DOCS
    • Introduction
      • MAYAName Guide
      • Swapping Guide
        • Quickstart Guide
        • Fees and Wait Times
        • Streaming Swaps
      • Add MAYAChain to your Wallet
    • Examples
      • Tutorials
      • Typescript (XChainJS) WIP
        • Query Package
        • AMM Package
        • Client Packages
        • Packages Breakdown
        • Coding Guide
      • SwapKit SDK
    • Concepts
      • Connecting to MAYAChain
      • Querying MAYAChain
      • Transaction Memos
      • Asset Notation
      • Memo Length Reduction
      • Network Halts
      • Fees
      • Delays
      • Sending Transactions
      • Math
    • Aggregators
      • Memos
      • EVM Implementation
    • CLI
      • Multisig
      • Offline Ledger Support
    • Protocol Development
      • Adding New Chains
      • Chain Clients
        • UTXO
        • EVM Chains
        • Cosmos Chains
      • ERC-20 Tokens
      • THORChain Version Updates I
      • THORChain Version Updates II
  • White Paper
    • 📖Maya Whitepaper 2.0
      • Introduction
      • 🍫Fair Launch
        • Philosophical perspective FL
        • Economic overview FL
        • Technical overview FL
      • 🪙$MAYA token
        • Philosophical perspective MT
        • Economic overview MT
        • Technical overview MT
      • 🌊Liquidity Nodes
        • Philosophical perspective LN
        • Economic overview LN
        • Technical overview LN
      • 🔒Security Nodes
        • Philosophical perspective SN
        • Economic overview SN
        • Technical overview SN
      • 🔴Aztec Chain & $AZTEC token
        • Philosophical perspective AC
        • Economic overview AC
        • Technical overview AC
      • ⚖️Stable Pools & Route Optimization
        • Philosophical perspective RO
        • Economic overview RO
        • Technical overview RO
      • 👣Roadmap. Maya 3.0
        • Philosophical perspective 3.0
        • Economic overview 3.0
        • Technical overview 3.0
  • Website
  • GitLab
  • Archive
    • Liquidity Auction
    • THORChads Airdrop
    • Add ETH, USDC, or USDT through THORWallet using Metamask + Ledger
    • $MAYA Airdrop for Maya Mask Holders
    • Maya Integration Guide
    • Roadmap 2023
Powered by GitBook

Social Media

  • Twitter
  • Telegram
  • Discord
On this page
  • Chain Client
  • Scanning Blocks
  • Confirmation Counting
  • Re-orgs
  • Network Fees
  • Handling Gas
  • Other Considerations
  • Wallet Client
  • Fees
  • Pending UTXOS
  • MEMO

Was this helpful?

Export as PDF
  1. MAYACHAIN DEV DOCS
  2. Protocol Development
  3. Chain Clients

UTXO

How the Bifrost works for UTXO chains like Bitcoin and its forks.

PreviousChain ClientsNextEVM Chains

Last updated 1 year ago

Was this helpful?

Chain Client

Example for Bitcoin.

Observer

Signer

Scanning Blocks

The block scanner monitors the Asgard Addresses and looks for incoming UTXOs spending to those addresses. When it sees one performs validation on it and witnesses to MAYAChain. For Bitcoin, it looks that at least 1 output is spent to Asgard, and searchs for another output to have an OP_RETURN. These two outputs form the amount and memo witness to MAYAChain.

Confirmation Counting

The txValue is the sum of all transactions received in a block to Asgard vaults. The blockValue is the coinbase value, which includes fees and subsidy. If a miner forgets to add a coinbase value (it has happened) a default of 6.25 is used. (This should be updated every 4 years, or use logic to auto-update).

Re-orgs

Bifrost tracks the BlockCacheSize = 144 blocks of transactions reported in a local KV store. Every time it detects a new block at a previous height it has seen, it checks for the presence of every transaction it has reported. If the transaction is missing then it has been re-orged out. The missing txID is reported to MAYAChain as an ErrataTx

Network Fees

Reported as sats/byte where the fee rate is computed over the last block. Reports the highest seen in the last 20 blocks.

Handling Gas

The gas amount for a transaction is just the difference between outputs and inputs.

Other Considerations

UTXO consolidation

UTXOs consume inputs, and these inputs need to be signed independently. Thus consuming 15 inputs requires 15 times the TSS bandwidth than a single input. To prevent runaway liabilities the client will automatically enter a TSS signing ceremony for Asgard every 15 inputs to consolidate them back to one. This transaction uses the consolidate memo and can be seen regularly on MAYAChain vaults.

ReplaceByFee

RBF transactions allow the spender to double-spend with a higher fee. Users can use RBF transactions to spend to Asgard, but RBF does not need to be used in the THORChain vaults.

Wallet Client

UTXO clients implemented in XChainJS have the following nuances:

Fees

The wallet client should spend with a fee rate at least equal to what is reported on inbound_addresses - if not it risks not being confirmed by the time the vault migrates.

Pending UTXOS

Do not consume pending transactions when spending to Asgard (with a memo) since it may consume a low-fee tx and get stuck.

MEMO

The memo is inserted as an OP_RETURN in an output. It can be any output. The MEMO is limited to 80 bytes, so it should be trimmed and use abbreviated memos or Asset identifiers where possible.

https://gitlab.com/mayachain/mayanode/-/blob/develop/bifrost/pkg/chainclients/bitcoin/client.go?ref_type=heads#L1161
https://gitlab.com/mayachain/mayanode/-/blob/develop/bifrost/pkg/chainclients/bitcoin/client.go?ref_type=heads#L376
https://gitlab.com/mayachain/mayanode/-/blob/develop/bifrost/pkg/chainclients/bitcoin/client.go?ref_type=heads#L725
https://gitlab.com/mayachain/mayanode/-/blob/develop/bifrost/pkg/chainclients/bitcoin/client.go?ref_type=heads#L1055
https://gitlab.com/thorchain/thornode/-/blob/4bcaf4f80787d0aaee711388578ed453959ef673/bifrost/pkg/chainclients/bitcoin/client.go#L915
bifrost/pkg/chainclients/bitcoin/signer.go · develop · Maya Protocol / MAYANode · GitLabGitLab
bifrost/pkg/chainclients/bitcoin/client.go · develop · Maya Protocol / MAYANode · GitLabGitLab
Logo
Logo