The most common reason that a transaction might fail is due to underlying orders being taken. dYdX uses a market order to fill orders and if many orders are taken before your transaction is mined, the underlying trade price may no longer match the price originally displayed to you in the UI. We refer to this in the UI as ‘Max Slippage’ and is set to a default of 1%.
What can I do to improve my chances of success?
To improve the chances that your transaction will succeed, we recommend accepting the transaction in your wallet as quickly as possible after pressing Buy or Sell. When you press the Buy or Sell button, we automatically check that the transaction would succeed if it were to be mined in the next block. (If we know the transaction will fail, then we will instantly display an error to you rather than letting you send the transaction using your wallet.) We also default the transaction's gas-cost to be about 4 gwei higher than the safe-low value at EthGasStation. This helps to ensure that the transaction will be processed in a timely manner. By waiting to confirm the transaction in your wallet or changing the gas-costs, you are increasing the chances that the transaction will no longer be valid by the time your transaction is mined into the blockchain.