# Understanding the Role of Acton in TON's Testnet and Mainnet Environments

> Acton is TON's all-in-one dev toolkit for smart contract development and deployment. It simplifies testnet and mainnet integration, handling RPC, addresses, and faucets automatically.

- Repository: [TON - The Open Network/acton](https://github.com/ton-blockchain/acton)
- Tags: deep-dive
- Published: 2026-05-14

---

**Acton serves as the all-in-one development toolkit that bridges local TON smart contract development with live network deployment, automatically handling RPC endpoint selection, address formatting, and testnet faucet integration for both testnet and mainnet environments.**

The role of Acton in TON's testnet or mainnet environments centers on streamlining the entire smart contract lifecycle from scaffolding to production deployment. As the official CLI toolkit maintained by `ton-blockchain/acton`, it abstracts the complexities of network interaction—managing everything from address encoding to transaction broadcasting—allowing developers to deploy and test contracts on either network using simple command flags.

## Network Abstraction and RPC Configuration

Acton handles network connectivity through a robust abstraction layer implemented in [`src/tonconnect.rs`](https://github.com/ton-blockchain/acton/blob/main/src/tonconnect.rs). When executing commands that require blockchain interaction, the toolkit automatically selects the appropriate TonCenter RPC endpoint based on the `--net` flag provided.

The system distinguishes between environments using two distinct API key variables:

- `TONCENTER_TESTNET_API_KEY` for testnet operations
- `TONCENTER_MAINNET_API_KEY` for mainnet operations

This abstraction ensures that developers never manually configure endpoints or worry about network-specific address formatting. The `Network` enum handles the underlying logic for determining whether to use **bounceable** (mainnet) or **non-bounceable** (testnet) address formats, which is critical for transaction success across different environments.

## Wallet Management and Funding Workflows

One of Acton's key roles involves managing wallet creation and funding differently across environments, as implemented in [`src/commands/wallet/mod.rs`](https://github.com/ton-blockchain/acton/blob/main/src/commands/wallet/mod.rs).

### Testnet Wallet Creation and Airdrop

For testnet development, Acton provides automated funding through the `perform_testnet_airdrop` function. When running `acton wallet new --net testnet --airdrop`, the toolkit:

1. Generates a wallet with testnet-specific address encoding via `format_testnet_wallet_address`
2. Automatically requests test TON from the testnet faucet using proof-of-work solving
3. Returns a funded wallet ready for contract deployment

### Mainnet Wallet Preparation

Mainnet operations require external funding. The command `acton wallet new --net mainnet` generates a mainnet-compatible address but deliberately omits faucet functionality. Developers must transfer real TON to this address before deployment, ensuring production-ready security practices.

## Deploying Contracts to Testnet vs Mainnet

Acton's script execution engine, documented in [`src/doc/man/acton-script.md`](https://github.com/ton-blockchain/acton/blob/main/src/doc/man/acton-script.md), provides unified deployment commands that adapt to the target environment through the `--net` flag.

### Local Emulation vs Network Broadcast

Without the `--net` flag, `acton script` runs transactions locally using the TON emulator—ideal for dry runs and debugging. Adding `--net testnet` or `--net mainnet` transforms the command into a live broadcast operation.

Example deployment workflow:

```bash

# Create and fund testnet wallet

acton wallet new --name deployer --net testnet --airdrop

# Deploy to testnet

acton script scripts/deploy.tolk --net testnet

# Deploy to mainnet (requires valid API key)

acton script scripts/deploy.tolk --net mainnet

```

The toolkit also supports **TON Connect** integration for user-approved transactions on either network:

```bash
acton script scripts/deploy.tolk --net testnet --tonconnect

```

## Verification and Network-Specific Operations

Contract verification against blockchain explorers uses the same network abstraction. The [`src/commands/verify/mod.rs`](https://github.com/ton-blockchain/acton/blob/main/src/commands/verify/mod.rs) file explicitly references `Network::Testnet` and `Network::Mainnet` variants when submitting verification requests to appropriate backend services, ensuring that verified source code matches the deployed bytecode on the correct network.

## Summary

- **Acton automates network selection** through the `Network` abstraction in [`src/tonconnect.rs`](https://github.com/ton-blockchain/acton/blob/main/src/tonconnect.rs), handling RPC endpoints and API keys for both testnet and mainnet.
- **Testnet wallets include automatic funding** via `perform_testnet_airdrop` in [`src/commands/wallet/mod.rs`](https://github.com/ton-blockchain/acton/blob/main/src/commands/wallet/mod.rs), while mainnet wallets require external TON transfers.
- **Unified deployment commands** use the `--net` flag to switch between local emulation, testnet broadcasting, and mainnet broadcasting without changing script logic.
- **Address formatting is environment-aware**, with testnet using non-bounceable formats and mainnet using bounceable formats automatically.

## Frequently Asked Questions

### How does Acton choose between testnet and mainnet RPC endpoints?

Acton selects endpoints based on the `--net` flag value passed to the command. The system loads environment variables `TONCENTER_TESTNET_API_KEY` or `TONCENTER_MAINNET_API_KEY` accordingly and configures the TonCenter RPC URL through the `Network` abstraction in [`src/tonconnect.rs`](https://github.com/ton-blockchain/acton/blob/main/src/tonconnect.rs). This happens automatically without requiring manual endpoint configuration.

### Can I use Acton to get free TON for mainnet deployment?

No, Acton only provides automated testnet funding through the `perform_testnet_airdrop` function. When creating mainnet wallets with `--net mainnet`, the CLI intentionally skips faucet requests. You must acquire real TON through exchanges or transfers to fund mainnet deployments, ensuring proper value backing for production contracts.

### What is the difference between running an Acton script with and without the --net flag?

Without `--net`, `acton script` executes transactions locally using the TON emulator, simulating contract behavior without blockchain interaction. Adding `--net testnet` or `--net mainnet` broadcasts real transactions to the respective live networks, consuming gas and permanently recording state changes on the blockchain.

### Does Acton handle address formatting differently for testnet and mainnet?

Yes, Acton automatically applies network-specific address formatting. Testnet addresses use non-bounceable formats via `format_testnet_wallet_address`, while mainnet addresses use bounceable formats. This distinction ensures that transactions route correctly and accounts handle inbound transfers appropriately based on the target network's conventions.