acton script
Reference manual for the acton script command
Synopsis
acton script [options] path [args...]
Description
Execute a standalone Tolk script.
Scripts are useful for experimentation, deployment flows, blockchain queries,
and one-off operational tasks. Unlike tests, scripts use a main() entry point
and can send real transactions when --net is provided.
Options
Script Options
Path to the script file to execute.
Arguments parsed against the main() ABI and passed to the script.
May be passed multiple times.
Enable executor debug logs at verbosity level 1.
Currently only level 1 is supported. Pass --verbose at most once.
Use this for low-level executor output such as debug.dumpStack(). For richer
debug output, use --backtrace full or --debug.
0
May be passed multiple times.
Debugging Options
Enable debug mode.
Enable execution backtraces.
Currently supported value: full.
full
Debug server port.
12345
Cache Options
Clear the compilation cache before running.
Remote Options
Fork blockchain state from a remote network for local execution.
When --net is set, omitted --fork-net defaults to the selected broadcast
network.
Historical block sequence number to fork from.
When a fork block number is set, Acton caches resolved remote accounts under
build/cache/<network>/<seqno>/<workchain>_<address-hash>.json. Later script
runs with the same fork network, block number, and address read that file before
calling the remote API.
Disable persistent account cache for pinned fork block numbers. Use this when
you want every script run to fetch forked accounts from the remote API. The
regular --clear-cache flag removes this cache together with the rest of
build/cache.
Broadcasting Options
Broadcast to the selected network. If omitted, the script runs in emulation
mode. Conflicting --net and --fork-net values are rejected.
Use TON Connect wallet approval for broadcast messages.
This opens a local browser page, connects a wallet, and sends net.send(...)
messages through that wallet instead of loading local wallet mnemonics.
The TON Connect session is saved under build/sessions/tonconnect/<network>.json and
reused by later runs in the same project. Currently supported only with
--net mainnet or --net testnet.
Local TON Connect page port. Defaults to 52258.
Acton keeps this port stable so injected wallets can recognize the same local dApp on later runs. If the default port is busy, pass another port explicitly and keep using the same value for that project.
52258
Explorer to use for transaction links.
tonscan, toncx, dton, tonviewer
Output Options
Show decoded message bodies in printed transaction trees when ABI is known.
Display Options
Control when to use colored output.
auto, always, never
auto
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.
--project-root
Path to the project root to use for configuration discovery and relative defaults.
--manifest-path
Script Model
A Tolk script defines a main() function and runs as an isolated execution.
- state is not preserved between runs
- local execution uses emulator wallets and balances
--fork-netkeeps execution local but resolves remote state--netsends real transactions using configured wallets--net ... --tonconnectsends real transactions through the connected TON Connect wallet
Wallet names referenced by the script are resolved from the merged wallet
configuration, with local wallets.toml entries overriding
global.wallets.toml on name conflicts. With --tonconnect, any
scripts.wallet("name") call resolves to the connected wallet address.
Acton saves the TON Connect session in build/sessions/tonconnect/<network>.json, so
the next script run can restore the wallet connection without asking the user
to connect again.
Argument Forwarding
Arguments after _path_ are passed through to the script runtime.
If a forwarded argument could be mistaken for an Acton flag, insert -- before
the script arguments:
acton script scripts/query.tolk -- --net-like-valueScript Arguments
Forwarded arguments are parsed against the ABI for main().
- the number of CLI arguments must exactly match the
main()parameters - integers use Tolk integer literal syntax such as
42,-1,0xff, and0b1010 boolacceptstrueandfalse- nullable supported types accept
null cell,slice, andbitsNaccept plain BoC hex withoutC{}orCS{}prefixesany_addressaccepts an internal address or theaddr_noneliteral- arrays accept
[item1, item2]
Unsupported parameter types currently include structs, tuple, map,
dict, builder and other complex types.
Side Effects
acton script always compiles and executes the selected script. With
--net, it can send real blockchain transactions; without --net, execution
stays local even when --fork-net is used.
Executor debug logs are hidden by default. Re-run with --verbose when you need
level-1 executor output such as debug.dumpStack().
Exit Status
0: The script completed successfully, including successful broadcast flows.1: Script execution failed, broadcast submission failed, or remote network access such as fork-state resolution failed.
Safe Execution Order
When a script can affect on-chain state, the usual safe sequence is:
acton buildacton testacton script <path>without--net- only then
acton script <path> --net testnet
Examples
-
Execute locally in the emulator:
acton script scripts/deploy.tolk -
Show executor debug logs from
debug.*helpers:acton script scripts/deploy.tolk --verbose -
Broadcast to testnet:
acton script scripts/deploy.tolk --net testnet -
Query mainnet state without broadcasting:
TONCENTER_MAINNET_API_KEY=your-key acton script query.tolk --fork-net mainnet -
Broadcast a deploy flow and print explorer links:
acton script scripts/deploy.tolk --net testnet --explorer tonscan -
Broadcast through TON Connect instead of local wallet keys:
acton script scripts/deploy.tolk --net testnet --tonconnect
TonCenter API Keys
Built-in mainnet/testnet requests read TONCENTER_MAINNET_API_KEY or
TONCENTER_TESTNET_API_KEY, depending on the selected network.
For custom:<name>, Acton reads <NORMALIZED_NAME>_API_KEY. Custom network
names are uppercased and non-alphanumeric characters are replaced with _, so
custom:mock-remote becomes MOCK_REMOTE_API_KEY.
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.
See Also
acton help run- Scripting guide
- Wallet setup
Last updated on