Where to Find the Core Source Code for Acton: Repository Structure and Key Modules
The core source code for Acton is located entirely within the src/ folder of the ton-blockchain/acton repository, with src/lib.rs serving as the main entry point that re-exports all primary modules for both CLI operations and library functionality.
Acton is a Rust-based toolchain for TON blockchain development, maintained in the ton-blockchain/acton repository. Understanding the core source code layout is essential for developers contributing to the project or extending its capabilities through the public API exposed in src/lib.rs.
Core Directory Layout
All implementation logic resides under the src/ directory at the repository root. This folder contains the library root (src/lib.rs) and fifteen specialized modules that handle everything from CLI parsing to blockchain interaction.
The src/lib.rs file serves as the public API surface, re-exporting every core module using explicit pub mod declarations:
// src/lib.rs
pub mod build_info;
pub mod commands;
pub mod context;
pub mod crash;
pub mod external_send;
pub mod ffi;
pub mod file_build_cache;
pub mod formatter;
pub mod http;
pub mod paths;
pub mod retrace;
pub mod stdlib;
pub mod tonconnect;
pub mod wallets;
Module Architecture
The core source code is organized into logical units that separate concerns between blockchain interaction, development tooling, and runtime support.
Entry Point and Public API
The src/lib.rs file defines the crate's public interface. It aggregates functionality from all sub-modules, making them available to both the Acton CLI binary and external Rust consumers importing the library.
CLI Commands Implementation
The src/commands/ directory contains the implementation for every CLI sub-command, including acton build, acton test, acton wallet, and acton script. Each command maps to a specific module within this directory, handling argument parsing and orchestrating calls to underlying library functions.
Wallet Management
src/wallets.rs provides wallet creation, key generation, and signing utilities. This module supports multiple wallet versions (V5R1, etc.) and abstracts the complexity of TON address generation and cryptographic operations.
Blockchain Integration
Two modules handle external communication:
src/external_send.rs: Utilities for sending external messages to the TON blockchain.src/tonconnect.rs: Integration with the TON Connect protocol for wallet connectivity.
Build System and Caching
src/file_build_cache.rs manages incremental build artifacts, storing cached compilation results and file hashes to optimize rebuild times. src/context.rs provides the runtime ProjectContext that tracks project layout and configuration from acton.toml.
FFI and Runtime Bindings
The src/ffi/ directory contains Foreign Function Interface wrappers that bridge Rust to the TON Virtual Machine. These low-level bindings enable execution of Tolk bytecode and support the test runner infrastructure.
Supporting Infrastructure
Additional critical modules include:
src/formatter.rs: Pretty-printing of logs, traces, and execution reports.src/http.rs: Minimal HTTP client for network interactions with TON Center and other endpoints.src/paths.rs: File-system path utilities for locating project files and configuration.src/retrace.rs: Stack-trace reconstruction for contract execution failures.src/crash.rs: Error handling and back-trace reporting.src/stdlib.rs: Built-in standard library definitions for Tolk scripts.src/build_info.rs: Compile-time metadata including version and git hashes.
Practical Code Examples
Developers can interact with Acton's core source code programmatically through the public API exposed in src/lib.rs.
Creating a Wallet Programmatically
Import the wallets module to generate and manage TON wallets:
use acton::wallets::{WalletBuilder, WalletKind};
fn main() -> anyhow::Result<()> {
// Build a V5 wallet with a generated key pair
let wallet = WalletBuilder::new()
.kind(WalletKind::V5R1) // select the version
.local() // local (non-hardware) wallet
.generate()?; // generate keys
println!("Address: {}", wallet.address);
Ok(())
}
Source: src/wallets.rs
Executing Tolk Scripts
Access the commands module to run deployment scripts within the project context:
use acton::commands::script::run_script;
use acton::context::ProjectContext;
fn main() -> anyhow::Result<()> {
let ctx = ProjectContext::load_from_cwd()?; // locate acton.toml
run_script(&ctx, "scripts/deploy.tolk", None)?; // execute the script
Ok(())
}
Source: src/commands/script/mod.rs
Accessing Build Cache
Interact with the incremental build system through the file_build_cache module:
use acton::file_build_cache::BuildCache;
fn main() -> anyhow::Result<()> {
let cache = BuildCache::load()?; // reads .acton/cache
println!("Cached artifacts: {}", cache.entries().len());
Ok(())
}
Source: src/file_build_cache.rs
Summary
- The core source code for Acton is contained entirely within the
src/directory of the ton-blockchain/acton repository. src/lib.rsserves as the central hub, re-exporting all fifteen core modules that power both CLI and library functionality.- Key modules include
src/commands/for CLI logic,src/wallets.rsfor cryptographic operations, andsrc/ffi/for VM bindings. - Practical integration is available through Rust's module system, allowing direct use of
acton::wallets,acton::context, and other public modules. - Build and deployment logic resides in
src/file_build_cache.rsandsrc/context.rs, managing project state and incremental compilation.
Frequently Asked Questions
Where is the main entry point for Acton's core library?
The main entry point is src/lib.rs, which re-exports all public modules including wallets, commands, context, and ffi. This file serves as the library root, exposing the complete API surface for both internal CLI usage and external Rust consumers who import the crate as a dependency.
Which module handles CLI commands in Acton?
The src/commands/ directory contains the implementation for all CLI sub-commands such as acton build, acton test, and acton wallet. Each sub-command maps to a specific file or subdirectory within src/commands/, handling argument parsing and orchestrating the underlying business logic.
How does Acton manage wallet functionality?
Wallet operations are centralized in src/wallets.rs, which provides the WalletBuilder API for creating local wallets, generating key pairs, and managing addresses. This module supports multiple wallet versions (such as V5R1) and abstracts TON-specific cryptographic operations for seamless integration with the broader toolchain.
What module provides TON Connect integration?
The src/tonconnect.rs file implements the TON Connect protocol integration, enabling Acton to interact with external wallet applications for transaction signing and user authentication. This module bridges the CLI tool with browser-based and mobile TON wallets following the TON Connect standard.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →