How to Use Tenderly to Debug a Failed BSC Transaction Step by Step
You can use Tenderly's transaction simulator and debugger to inspect a failed BSC transaction by pasting its hash, selecting the BNB Chain network, and walking through each opcode step to see exactly where execution reverted and why. Tenderly provides a more detailed breakdown than BscScan's built-in debugger, including state changes, gas consumption per step, and decoded output data.
What tenderly shows that bscscan does not
BscScan's "View Input" and "View Decoded" tabs give you the raw function call and parameters. Tenderly goes further: it replays the transaction against the exact block state, shows every internal call and event emitted, and highlights the specific opcode that caused the revert. This is especially useful when a transaction fails with a generic "execution reverted" message and you need to trace the exact condition that failed.
Prerequisites
- A Tenderly account (free tier works for manual debugging)
- The transaction hash of a failed BSC transaction
- Basic familiarity with reading Solidity error messages and event logs
Step-by-Step Process
1. open tenderly's transaction debugger
Go to dashboard.tenderly.co and log in. In the top navigation, select "Debugger" or navigate directly to https://dashboard.tenderly.co/tx/mainnet/ (you will replace "mainnet" with the BSC network identifier).
2. Enter the Transaction Hash
Paste the full 0x-prefixed transaction hash into the search field. Tenderly automatically detects the network from the transaction's chain ID. For BSC, the chain ID is 56. If it does not auto-detect, manually select "BNB Chain" or "Binance Smart Chain" from the network dropdown.
3. Review the Overview Panel
Once loaded, the overview panel shows: - Status: "Reverted" (red) or "Success" (green) - Gas Used vs. Gas Limit - Block number and timestamp - From and To addresses - Value transferred in BNB - Input data as a hex string and decoded function call if the ABI is known
If the transaction reverted, the overview will show a Revert Reason string, such as "execution reverted: PancakeRouter: INSUFFICIENT_OUTPUT_AMOUNT". This alone often tells you the problem.
4. Use the Step-by-Step Opcode Debugger
Click "Simulate" or "Debug" to open the opcode view. You will see a list of operations (opcodes) executed in order, from the first to the last. Each row shows: - Opcode (e.g., CALL, SSTORE, REVERT) - Gas consumed at that step - Stack and memory state after the operation
Scroll to the bottom of the list. The final opcode is almost always REVERT (if the transaction failed) or STOP/RETURN (if it succeeded). Click on the REVERT line to see the error data pushed onto the stack. This data is the revert reason encoded as a 4-byte selector plus the error message.
5. inspect state changes
Switch to the "State Changes" tab. This shows every storage slot that was modified during execution, including: - Contract addresses that were written to - Old value (before the transaction) - New value (what would have been written if the transaction succeeded, or the partial writes that occurred before the revert)
If a transaction failed partway through, state changes before the revert were rolled back, but Tenderly still shows them as "reverted" entries. This is useful to see which variables were being updated at the time of failure.
6. Check Internal Transactions and Events
Under "Internal Transactions", Tenderly lists every contract-to-contract call that happened inside the transaction. Each entry shows: - The calling contract - The called contract - The amount of BNB sent - The function selector and decoded parameters (if ABI is available)
Under "Events", you see all emitted logs. A failed transaction may still emit events before the revert. Look for events like Transfer, Swap, or custom error events that can pinpoint the failure.
7. Decode the Revert Reason
If the revert reason is a custom error (not a standard string), Tenderly can decode it if you provide the contract ABI. You can upload the ABI of the contract that failed by clicking "Add ABI" in the debugger. Without the ABI, you see only the hex-encoded revert data. To decode it manually, copy the first 4 bytes (the error selector) and compare it against the contract's verified source on BscScan.
Common revert patterns you can debug with tenderly
- "execution reverted: TransferHelper: TRANSFER_FROM_FAILED": The token transfer from your address to the router failed, likely because you did not approve enough tokens or the approval was zeroed out.
- "execution reverted: PancakeRouter: INSUFFICIENT_OUTPUT_AMOUNT": Slippage tolerance was too low; the actual swap rate was worse than your minimum.
- "execution reverted: SafeMath: subtraction overflow": A math operation underflowed, usually because a contract tried to subtract more than available.
- Custom errors like
ERC20InsufficientBalance: Tenderly shows the decoded error parameters (e.g., the account address, required amount, available amount).
Limitations of Tenderly for BSC
- Tenderly's free tier has rate limits on simulations. If you debug many transactions in quick succession, you may hit a cap or need to wait.
- Not all BSC contracts have verified ABIs on Tenderly. If the ABI is missing, you will see raw hex data and must manually decode it using BscScan's verified source.
- Tenderly does not show the full transaction pool or mempool data; it replays only the confirmed transaction's execution path.
When to Use Tenderly Instead of BscScan
Use Tenderly when: - BscScan shows "execution reverted" but no reason string. - You need to inspect internal calls to understand which subcall failed. - You want to see partial state changes before the revert. - You are debugging a complex multi-step swap or a contract interaction with multiple hops.
Use BscScan first for a quick check: it is free, instant, and often shows the revert reason. Turn to Tenderly when that is not enough.
Not financial advice. dogesound.club publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.
Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.