Troubleshooting the Error: "too-long-mempool-chain"

While attempting to broadcast a transaction on a UTXO-based chain like Bitcoin, Litecoin, Dogecoin, or others, you may encounter an error similar to the following:

Error example:

{
    "statusCode": 403,
    "errorCode": "###.blockchain.broadcast.error",
    "message": "Unable to broadcast transaction.",
    "cause": "too-long-mempool-chain",
    "dashboardLog": "https://dashboard.tatum.io/logs?id=#####"
}

Understanding the Error

This error occurs when attempting to broadcast a transaction, and the node rejects it due to a too-long-mempool-chain issue. This happens when:

  • The transaction is part of a chain of unconfirmed transactions that exceeds the node's maximum allowed size for unconfirmed transaction chains in the mempool.
  • The nodes enforce this limit to prevent excessive resource consumption.

📘

Note

Tatum uses default node settings set by the chain consortiums. These settings is not subject to change.


Possible Causes

  1. Excessive Chain of Unconfirmed Transactions
    The transaction depends on multiple unconfirmed parent transactions. Nodes typically limit the number of chained transactions in the mempool for performance reasons.

  2. Improper UTXO Selection
    UTXOs (Unspent Transaction Outputs) used in the transaction are not optimally selected, leading to dependency on too many unconfirmed ancestors.

  3. Backend Node Visibility
    The node broadcasting the transaction lacks visibility into all unconfirmed transactions, causing chain validation failure.


Troubleshooting Steps

  1. Review the Transaction Chain

    • Identify all unconfirmed parent transactions that the current transaction depends on.
    • Use a blockchain explorer to inspect the mempool status of these transactions.
  2. Optimize UTXO Selection

    • Select UTXOs from confirmed transactions to reduce dependencies.
  3. Consolidate Inputs

    • Consider consolidating smaller UTXOs into a single transaction during low network activity.
    • This minimizes dependencies in future transactions.
  4. Rebroadcast Parent Transactions

    • Ensure all parent transactions are successfully broadcasted and confirmed before broadcasting the dependent transaction.

Best Practices

  • Prevent Long Chains:
    Always aim to use confirmed UTXOs when creating transactions to avoid creating long chains of unconfirmed transactions.

  • Batch Transactions:
    Batch multiple outputs into a single transaction when possible to reduce mempool congestion.


Related Resources