Delays

Understanding end to end transaction times.

Overview

There are four phases of a transaction sent to MAYAChain.

Wait times can be between a few seconds to several hours. The assets being swapped, the size of the swap and the current network traffic within MAYAChain will determine the wait time.

Inbound Confirmation

This depends purely on the host chain and is out of the control of MAYAChain.

  • Bitcoin/Dash: ~10 minutes

  • ETH/ARB: ~15 seconds

  • Cosmos: ~6 seconds

Observation Counting

MAYANodes have to witness to MAYAChain when they see a transaction. It could seconds to minutes depending on how fast nodes can scan their blockchains to find transactions. Once 67% of MAYANodes see a tx, then it can be confirmed. You can count the number of nodes that have seen a tx by counting the signatures in the signers parameter or look at the status field on the /tx endpoint.

Example: https://mayanode.mayachain.info/mayachain/tx/09DCAEF3F7D76AB1D621E684824503DD7E36C48A2F35C5122569159DA884153F

Confirmation Counting

MAYAChain has to defend against 51% attacks, which it does by counting to economic finality for each block (the value of the block relative to the value of the block reward). It tracks both, then computes the number of blocks to wait. It then populates this on the /tx endpoint.

Example: https://mayanode.mayachain.info/mayachain/tx/09DCAEF3F7D76AB1D621E684824503DD7E36C48A2F35C5122569159DA884153F

block_height is the external height it first saw it.

finalise_height is the external height it needs to see before it will confirm it.

An event is not sent until the external block height crosses finalise_height so Midgard will NOT see the tx until confirmation-counted.

Examples:

  • 10 BTC: 2 blocks

  • 50 ETH: 16 blocks

Outbound Delay

MAYAChain throttles all outputs to prevent fund loss attacks, but the maximum delay is 1hr. It does this by computing the value of the outbound transaction then applying an artificial delay. If the tx is in "scheduled", it will be delayed by a number of blocks. Once it is "outbound" it is being processeed. See more information here.

Queue

https://mayanode.mayachain.info/mayachain/queue

Delayed txOuts:

https://mayanode.mayachain.info/mayachain/queue/scheduled

Finalised txOuts:

https://mayanode.mayachain.info/mayachain/queue/outbound

Outbound Confirmation

This depends purely on the host chain and is out of the control of MAYAChain.

  • Bitcoin: ~10 minutes

  • Dash: ~2.5 minutes

  • ETH/ARB: ~15 seconds

  • Cosmos: ~6 seconds

How to Handle Delays

Follow these guidelines

  1. Use the Quote endpoint to get the estimated fee.

  2. Don't leave the user with a swap screen spinner, instead, move the swap to a "pending state" with a 10 minute countdown. Let the user exit the app, perhaps even send them a notification after.

  3. Every minute, poll Midgard and see if the swap is processed.

  4. Once processed, you can inform the user, perhaps surprise them if the swap is done faster

Last updated