Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ton-blockchain/acton/llms.txt

Use this file to discover all available pages before exploring further.

acton library manages the lifecycle of TON on-chain libraries — shared code cells stored in a special library account that multiple contracts can reference by hash. Publishing a contract as a library avoids duplicating bytecode across deployments: contracts include a library reference cell instead of the full code, reducing deploy costs and making upgrades easier. Acton tracks published library metadata in libraries.toml (project-local) or global.libraries.toml (shared across projects), so you can inspect and top up libraries long after publication.

Synopsis

acton library <SUBCOMMAND> [OPTIONS]

Subcommands

SubcommandDescription
publishCompile and publish a contract as an on-chain library
fetchDownload library code from the blockchain by hash
infoShow metadata and storage runway for a tracked library
topupSend additional TON to a library account to extend storage

acton library publish

Compile a project contract (or supply raw code) and publish it as a TON on-chain library. Acton calculates storage costs from the contract size and requested duration, prompts for confirmation, sends the publication transaction, and optionally saves the library metadata to a tracking file. Synopsis
acton library publish [CONTRACT_NAME] [OPTIONS]
Options
FlagTypeDefaultDescription
CONTRACT_NAMEstringpromptedContract name from Acton.toml to publish
--codestring (BoC)Raw base64 or hex code to publish instead of compiling a contract
--durationstringpromptedStorage duration, e.g. 100d, 1y, 6m
--walletstringpromptedWallet from wallets.toml to pay the transaction
--netstringtestnetNetwork: testnet, mainnet, localnet, or custom:<name>
--amountstringExplicit TON amount (overrides duration-based estimation)
--localflagSave metadata to project-local libraries.toml
--globalflagSave metadata to global.libraries.toml
-y, --yesflagSkip confirmation prompts
--tonconnectflagUse a TON Connect wallet for the transaction
--tonconnect-portnumber52258Local port for the TON Connect approval page
If neither --local nor --global is passed, Acton prompts for where to save the library metadata after a successful publication.

acton library fetch

Download a library’s code cell from the blockchain by its hash. Useful for backup, inspection, or disassembly of any published library. Synopsis
acton library fetch <HASH> [OPTIONS]
Options
FlagTypeDefaultDescription
HASHstringrequiredLibrary code hash to fetch
--disasmflagDisassemble the fetched code and print TASM
-o, --outputpathWrite output to a file (.boc → binary, other → base64 text)
--netstringtestnetNetwork to query
--jsonflagEmit JSON output (ignored when --disasm is also set)
Output behavior:
  • Without --output: fetched code is printed to stdout
  • --output path.boc: writes binary BoC
  • --output path.txt: writes base64 text
  • --disasm: always prints or writes TASM disassembly text

acton library info

Display stored metadata for a tracked library, including publication time, last top-up time, current balance, and estimated remaining storage runway. Synopsis
acton library info [NAME]
Options
FlagTypeDefaultDescription
NAMEstringpromptedLibrary name from libraries.toml or global.libraries.toml

acton library topup

Send additional TON to a library’s account to extend its storage lifetime. Acton updates last_topup_timestamp in the saved metadata after a successful top-up. Synopsis
acton library topup [LIBRARY_NAME] [OPTIONS]
Options
FlagTypeDefaultDescription
LIBRARY_NAMEstringpromptedLibrary name from metadata files
--durationstringpromptedAdditional storage duration, e.g. 1y, 100d
--amountstringExplicit TON amount (overrides duration-based calculation)
--walletstringpromptedWallet to pay the top-up transaction
-y, --yesflagSkip confirmation prompts
--tonconnectflagUse a TON Connect wallet
--tonconnect-portnumber52258Local port for the TON Connect approval page

libraries.toml structure

Saved library metadata lives in libraries.toml (project-local) or global.libraries.toml. A typical entry looks like this:
libraries.toml
[[libraries]]
name = "Math"
hash = "a1b2c3d4e5f6..."
code = "te6cckEBAQEAAgAAAEysuc0="
account = "EQA..."
duration = "365d"
network = "testnet"
publication_timestamp = 1720000000
last_topup_timestamp = 1720000000
code_size_bits = 1024
code_size_cells = 3

Resolution rules

  • Library metadata is merged from global.libraries.toml first, then local libraries.toml — local entries win on name collisions.
  • When saving metadata into a file that already contains the same library name, Acton appends -1, -2, etc. to avoid overwriting the existing record.

Amount estimation

For publish and topup, Acton estimates the required TON amount from the library’s code size and requested storage duration. Pass --amount to override this estimate completely.

TON Connect

Both publish and topup support --tonconnect for browser wallet approval. TON Connect is available only for mainnet and testnet — use configured Acton wallets for localnet and custom networks.

TonCenter API keys

Built-in mainnet/testnet requests read TONCENTER_MAINNET_API_KEY or TONCENTER_TESTNET_API_KEY. For custom:<name>, Acton reads <NORMALIZED_NAME>_API_KEY (uppercased, non-alphanumeric → _). Acton loads .env automatically.

Examples

acton library publish Math --duration 365d --wallet deployer --local

Exit status

  • 0 — the selected library subcommand completed successfully
  • 1 — contract or wallet resolution failed, chain access failed, metadata could not be written, or a publish/top-up transaction failed

See Also

Build docs developers (and LLMs) love