Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 58 additions & 46 deletions ecosystem/explorers/tonviewer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Using Tonviewer"
---

**TODO: check links**
import { Aside } from '/snippets/aside.jsx';

Tonviewer is a TON Blockchain explorer that allows you to inspect blocks, transactions, contracts, and tokens, as well as analyze activity.

Expand All @@ -17,7 +17,7 @@ They are essential for identifying transactions and tracing data flow across the
- [Transactions](/ton/transaction) — records of executed messages. Explorers display their details linked to a specific address.
- [Blocks](/ton/blocks) — containers of transactions. In explorers, they expose block metadata and configuration parameters, allowing you to trace activity and understand how the blockchain operates.

## Analyzing operations
## Reading traces

### Traces

Expand All @@ -27,55 +27,69 @@ A trace is a directed acyclic graph (DAG) where:
- transactions are nodes on an account's address
- messages are edges between addresses

![Trace overview](/resources/images/tonviewer/overview.png)
![Trace overview](/resources/images/tonviewer/trace.svg)

### Steps to analyze an operation
### Using the UI

1. **Identify the entry point**
Tonviewer provides a visual interface for exploring traces:
- Hover over a **node** to see details about the account where a transaction succeeded or failed.
- Hover over an **edge** to inspect the message contents.
- Use **Show details** to examine full transaction and message information.

Start with the external-in message that initiates the trace. It defines the intent of the operation, such as a transfer, swap, or staking action.
<Aside>
The UI may change, but the approach to reading traces remains consistent.
</Aside>

2. **Identify accounts**
![UI overview](/resources/images/tonviewer/ui_overview.png)

Examine the accounts involved — wallet addresses, jetton wallets, jetton master wallets, and DEX contracts. It clarifies the role of each entity in the flow.
### Steps to read a trace

3. **Inspect messages**
1. **Determine the operation**

For each edge, review its payload:
The external-in message initiates the trace and defines the operation, such as a transfer, swap, or staking action.

2. **Clarify accounts' roles**

Examine the accounts involved — wallet addresses, jetton wallets, jetton master wallets, and DEX contracts. It clarifies the role of each account in the operation flow.

3. **Read messages**

Examine each message (edge in the trace). Its payload defines the intended actions and the transferred value:

- value — amount of TON or jettons transferred
- opcode — instruction type
- payload — instructions

4. **Check transaction phases**

Each transaction executes in phases. In the compute and action phases, an exit code of 0 indicates success; a non-zero code signals an error.
Each transaction executes in phases. In the compute and action phases, an exit code of 0 indicates success; a non-zero code signals an error. This identifies which action succeeded and which failed.

5. **Find the failure point**

Even if all transactions succeed, failures can still occur due to message or payload constraints.
Some failures can occur even if all transactions are successful. Examine messages and payloads to identify where an operation was constrained or prevented from proceeding.

## Failed use cases

The following examples illustrate common operation failures in Tonviewer. Each case demonstrates how to systematically analyze traces to identify the failure point, even when transactions appear to be successful or partially executed.
The following examples illustrate traces where operations did not complete as intended, even when transactions appear successful. They demonstrate a general approach to reading traces and identifying the point of failure.

### Jetton transfer

Analyze a [jetton transfer](https://tonviewer.com/transaction/d5d50c3e5bde493ddc7853f784bdff75a37bf89473e77ba8d04615323c7c8117) attempt.

![NFT transfer](/resources/images/tonviewer/jetton_transfer.png)
![Jetton transfer](/resources/images/tonviewer/jetton_transfer.png)

1. **Identify the entry point**
1. **Determine the operation**

At point **A** (mintmachine.ton), an external-in message initiates the operation, instructing a jetton transfer.
At point **A** (mintmachine.ton), an external-in message initiates the operation, instructing _a jetton transfer_.

2. **Identify accounts**
- A — sender's wallet contract (mintmachine.ton).
- B — jetton wallet contract governed by the jetton master.
2. **Clarify accounts' roles**

3. **Inspect messages**
- A — sender’s wallet contract (mintmachine.ton), initiates the transfer.
- B — jetton wallet contract governed by the jetton master, holds the tokens and executes the transfer.

- A → B: jetton transfer message with TON attached to cover execution fees.
3. **Read messages**

- A → B: jetton transfer message with 0.2 TON attached to cover execution fees.

4. **Check transaction phases**

Expand All @@ -92,19 +106,19 @@ Analyze an [NFT transfer](https://tonviewer.com/transaction/d8b5dbfe1c115178f47b

![NFT transfer](/resources/images/tonviewer/nft_transfer.png)

1. **Identify the entry point**
1. **Determine the operation**

At point **A** (address `UQDj…D0lN`), the user’s wallet sends an **external-in** message to transfer an NFT.
At point **A** (address `UQDj…D0lN`), the user’s wallet sends an external-in message to _transfer an NFT_.

2. **Identify accounts**
2. **Clarify accounts' roles**

- A — the user's wallet.
- B — the NFT contract at address `EQCo…gJdV`.
- A — the user's wallet, initiates the transfer.
- B — the NFT contract at address `EQCo…gJdV`, validates ownership and executes the transfer.

3. **Inspect messages**
3. **Read messages**

- A → B: NFT transfer message with 0.04 TON attached.
- B → A: bounce returning 0.0365 TON.
- B → A: bounce returning 0.036514 TON.

4. **Check transaction phases**

Expand All @@ -121,18 +135,18 @@ Analyze a [token swap](https://tonviewer.com/transaction/fa8e119f8911d20bb078b9b

![DEX swap](/resources/images/tonviewer/dex_swap.png)

1. **Identify the entry point**
1. **Determine the operation**

The trace begins at point **A** (the user’s `mintmachine.ton` contract). An external-in message initiates the swap attempt.
The trace begins at point **A** (the user’s `mintmachine.ton` contract). An external-in message initiates the _token swap attempt_.

2. **Identify accounts**
2. **Clarify accounts' roles**
- A — user's mintmachine.ton account, sending the initial funds.
- B — user's jetton wallet.
- C — DEX jetton wallet.
- B — user's jetton wallet, holds the tokens.
- C — DEX jetton wallet, forwards tokens to the DEX.
- D — DEX smart contract executing the swap.
- E — jetton master (minter) of the token.
- E — jetton master (minter), authorizes token operations.

3. **Inspect messages**
3. **Read messages**

- A → B: 0.3 TON transferred via a jetton transfer.
- B → C: jetton internal transfer to the DEX wallet.
Expand All @@ -157,20 +171,20 @@ Analyze a [token swap](https://tonviewer.com/transaction/b1dce2881224590a7c60e61

![DEX swap successful case](/resources/images/tonviewer/dex_swap_1.png)

1. **Identify the entry point**
1. **Determine the operation**

An **external-in** message arrives at point **A** (mintmachine.ton), initiating the swap.
An **external-in** message arrives at point **A** (mintmachine.ton), initiating the _token swap_.

2. **Identify accounts**
2. **Clarify accounts' roles**

- A — mintmachine.ton account.
- B — user's jetton wallet.
- C — DEX jetton wallet.
- A — mintmachine.ton account, provides initial funds for the swap.
- B — user's jetton wallet, holds the tokens.
- C — DEX jetton wallet, forwards tokens to the DEX.
- D — DEX smart contract executing the swap.
- E — jetton master (minter) of the token.
- F — DEX payout account (mergesort.t.me).
- E — jetton master (minter), authorizes token operations.
- F — DEX payout account (mergesort.t.me), receives the swapped tokens.

3. **Inspect messages**
3. **Read messages**

- A → B: 0.2 TON transferred via a jetton transfer.
- B → C: internal jetton transfer to the DEX wallet.
Expand All @@ -188,5 +202,3 @@ All transactions along the trace completed their phases without error, no warnin
5. **Find the failure point**

No failure point — the operation completed successfully.


Binary file modified resources/images/tonviewer/dex_swap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/images/tonviewer/dex_swap_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/images/tonviewer/jetton_transfer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/images/tonviewer/nft_transfer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed resources/images/tonviewer/overview.png
Binary file not shown.
Loading
Loading