acton retrace
Reference manual for the acton retrace command
Synopsis
acton retrace [options] hash
Description
Download a transaction by hash and replay it locally in the TON sandbox.
acton retrace is useful for debugging failures, inspecting outgoing actions,
reviewing VM and executor logs, and comparing local replay results with the
original on-chain execution.
When --contract is provided, Acton also prepares a source-level retrace for
the named project contract by recompiling it with debug info and source maps.
When --debug is added, the prepared replay is exposed as a local Debug
Adapter Protocol (DAP) server for editor integration.
Options
Retrace Options
Transaction hash in hex format.
Network to retrace from.
Without this flag, Acton tries mainnet first and then falls back to testnet.
Show full cell hex in outgoing actions instead of only hashes.
Write VM and executor logs into the specified directory.
Source-Level Debugging Options
Contract name from Acton.toml used to build a source-level trace for the
retraced transaction.
Expose the prepared source-level retrace as a local DAP server.
Requires --contract.
Debug server port to use with --debug.
When omitted, Acton uses 12345.
Display Options
Control when to use colored output.
auto, always, never
Project Options
Path to the Acton.toml file to use for this invocation.
Use this when running the command outside the project directory or when the manifest lives at a non-default location.
Path to the project root to use for configuration discovery and relative defaults.
This conflicts with --manifest-path.
Network And API Behavior
- Without
--net, Acton tries mainnet and then testnet localnetandcustom:<name>are not supported by the retrace backend
TonCenter API Keys
Built-in mainnet/testnet requests read TONCENTER_MAINNET_API_KEY or
TONCENTER_TESTNET_API_KEY, depending on the selected network.
Acton loads .env automatically, so the simplest setup during project work is
usually to keep these keys there and use shell environment variables only for
one-off overrides or CI.
If no matching key is configured, Acton throttles requests to reduce rate-limit failures.
For library fallback lookups, retrace also supports DTON_API_KEY from the
environment.
Source-Level Retrace
When --contract is set:
- the contract must exist in the resolved
Acton.toml - the selected source must be a
.tolkcontract - Acton refreshes the bundled stdlib under
.acton/before preparing the source-level retrace - Acton recompiles the contract for the current invocation with debug info and source maps
- no prior
acton build --debugstep is required, but the current local sources and import mappings must compile cleanly - the recompilation must return both source maps and debug marks; missing either is a hard error
- the compiled local code hash must match the code hash used by the retraced transaction
If you run the command outside the project directory, use --manifest-path or
--project-root so Acton can resolve the contract configuration and import mappings.
Debug Mode
When --debug is used together with --contract:
- Acton starts a local DAP server on
127.0.0.1:<port> - the normal retrace summary is still printed before the debug server starts
- the command stays attached to that debug session until the client disconnects
This mode is intended for editor integrations that speak the Debug Adapter Protocol.
--debug-port follows the same convention as other Acton debug commands:
without --debug it does not start a debug server.
Current replay-debug limits:
- the retrace adapter exposes one DAP thread only
- replay sessions do not expose the live
Registersscope available in local debug sessions - the supported request set is intentionally narrow: source breakpoints, continue/step, stack/scopes/variables, exception info, evaluate, and disconnect
- unsupported client-specific extension requests are ignored rather than emulated
VS Code Setup
Typical setup:
-
Install or load the TON VS Code extension.
-
Make sure VS Code can find your
actonbinary.If needed, point the extension at a specific binary with an environment variable such as
ACTON_BIN, or start VS Code from a shell whereactonis already onPATH. -
Open the project workspace that contains the target contract in
Acton.toml. -
Start a retrace debug session either through the extension command or through a manual
launch.jsonentry.
For a manual setup, create .vscode/launch.json like this:
{
"version": "0.2.0",
"configurations": [
{
"type": "tolk",
"request": "launch",
"name": "Attach to Acton Retrace",
"debugServer": 4711
}
]
}Then start retrace in a terminal from the project root:
acton retrace <HASH> --contract <NAME> --debug --debug-port 4711After the DAP server is listening, launch the matching VS Code debug
configuration. Breakpoints should be set in the same .tolk sources that
belong to the selected contract from Acton.toml.
Output
The command prints:
- network selection and state-hash check status
- transaction metadata and fee summary
- compute and action phase summaries
- decoded outgoing actions
- additional full VM and executor logs when
--logs-diris used - source-level debug preparation errors when
--contractis used - DAP startup status when
--debugis used
When --logs-dir is set, Acton creates the target directory and writes
vm.log plus executor.log there.
Exit Status
0: The transaction was fetched and replayed successfully.1: The transaction could not be found, network lookup failed, replay data was incomplete, local contract validation or compilation failed, the local code hash did not match the retraced account code, the DAP server could not start, or local log files could not be written.
Examples
-
Retrace with automatic network fallback:
acton retrace 3c1b02a33390e596d83b306eab57b3f7271bc90e2e527ea4cafccfde25139d41 -
Force mainnet and use an API key from the environment:
TONCENTER_MAINNET_API_KEY=your-key acton retrace 3c1b02a33390e596d83b306eab57b3f7271bc90e2e527ea4cafccfde25139d41 --net mainnet -
Save logs and show full outgoing cell bodies:
acton retrace 3c1b02a33390e596d83b306eab57b3f7271bc90e2e527ea4cafccfde25139d41 --verbose --logs-dir build/retrace -
Prepare a source-level retrace for a project contract:
acton retrace 3c1b02a33390e596d83b306eab57b3f7271bc90e2e527ea4cafccfde25139d41 --contract JettonMinter -
Start a local DAP server for editor debugging:
acton retrace 3c1b02a33390e596d83b306eab57b3f7271bc90e2e527ea4cafccfde25139d41 --contract JettonMinter --debug --debug-port 4711
See Also
acton help disasm- Retrace command guide
Last updated on