ton-tact

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Skill is based on Tact (TON) v1.6.13, generated 2026-02-25.
Tact is a statically typed smart contract language for the TON blockchain. Contracts use message-based communication (receive/send), structs and messages for data, and traits for reuse. This skill focuses on agent-oriented usage: type system, contracts and receivers, sending/receiving messages, cells and serialization, standard libraries, and security practices.
本Skill基于Tact (TON) v1.6.13版本生成,生成时间为2026-02-25。
Tact是TON区块链的静态类型智能合约语言。合约采用基于消息的通信(接收/发送),使用结构体和消息处理数据,通过Trait实现复用。本Skill聚焦于面向Agent的使用场景:类型系统、合约与接收器、消息收发、Cell与序列化、标准库及安全实践。

Core references

核心参考内容

TopicDescriptionReference
Type systemPrimitives, optionals, maps, structs, messages, contracts, traitscore-types
Contracts and traitsinit, parameters, receivers, getters, interfaces, BaseTraitcore-contracts
Structs and messagesDefinition, instantiation, toCell/fromCell, TL-B layoutcore-structs-messages
Receiving messagesreceive(), text/binary/slice receivers, order, external/bouncedcore-receive
Sending messagessend(), SendParameters, reply, forward, notify, cashback, deploy, emitcore-send
Cells, Builders, SlicesCell/Builder/Slice, beginCell, store/load, Struct/Message helperscore-cells
Message modeBase modes and optional flags (SendRemainingValue, SendIgnoreErrors, etc.)core-message-mode
Gas and feesgetStorageFee, getComputeFee, getForwardFee, setGasLimit, acceptMessagecore-gas
Context and statesender, context, myAddress, myBalance, now, inMsg, setData, commit, getConfigParam, nativeReservecore-context-state
AddressesnewAddress, contractAddress, forceBasechain, parseStdAddress, BasechainAddresscore-addresses
CryptographycheckSignature, sha256, keccak256, SignedBundlecore-crypto
StringsStringBuilder, beginString, beginComment, String extensions, Int toFloatStringcore-strings
Mathmin, max, abs, sign, sqrt, log, log2, pow, pow2, divc, muldivccore-math
Exit codesTVM/Tact exit codes, compute/action phases, developer range 256–65535core-exit-codes
Randomrandom, randomInt, getSeed, setSeed, nativeRandomize, nativeRandomizeLtcore-random
Debug and throwrequire, dump, throw, throwIf, throwUnlesscore-debug
Compile-timeaddress(), cell(), slice(), rawSlice(), ascii(), crc32(), ton()core-comptime
Message lifecycleReceive phase, compute phase, action phase (no revert)core-lifecycle
主题描述参考链接
类型系统基本类型、可选类型、映射、结构体、消息、合约、Traitcore-types
合约与Trait初始化、参数、接收器、获取器、接口、BaseTraitcore-contracts
结构体与消息定义、实例化、toCell/fromCell、TL-B布局core-structs-messages
接收消息receive()、文本/二进制/Slice接收器、执行顺序、外部/退回消息core-receive
发送消息send()、SendParameters、回复、转发、通知、现金返还、部署、触发core-send
Cell、Builder、SliceCell/Builder/Slice、beginCell、存储/加载、结构体/消息辅助方法core-cells
消息模式基础模式与可选标志(SendRemainingValue、SendIgnoreErrors等)core-message-mode
Gas与费用getStorageFee、getComputeFee、getForwardFee、setGasLimit、acceptMessagecore-gas
上下文与状态sender、context、myAddress、myBalance、now、inMsg、setData、commit、getConfigParam、nativeReservecore-context-state
地址newAddress、contractAddress、forceBasechain、parseStdAddress、BasechainAddresscore-addresses
密码学checkSignature、sha256、keccak256、SignedBundlecore-crypto
字符串StringBuilder、beginString、beginComment、字符串扩展、Int转FloatStringcore-strings
数学运算min、max、abs、sign、sqrt、log、log2、pow、pow2、divc、muldivccore-math
退出码TVM/Tact退出码、计算/执行阶段、开发者自定义范围256–65535core-exit-codes
随机数random、randomInt、getSeed、setSeed、nativeRandomize、nativeRandomizeLtcore-random
调试与抛出require、dump、throw、throwIf、throwUnlesscore-debug
编译期特性address()、cell()、slice()、rawSlice()、ascii()、crc32()、ton()core-comptime
消息生命周期接收阶段、计算阶段、执行阶段(不可回滚)core-lifecycle

Features

功能特性

TopicDescriptionReference
OptionalsT?, null, !!, constraints (no optional keys, no nested optionals)features-optionals
Mapsmap<K,V>, emptyMap(), get/set, allowed types, serializationfeatures-maps
initOf and deployinitOf, contractAddress, StateInit, send/deploy deploymentfeatures-initof-deploy
Standard libraries@stdlib/config, content, deploy, dns, ownable, stoppablefeatures-stdlib
Configurationtact.config.json — projects, options (debug, external, safety, mode)features-config
External messagesexternal(), acceptMessage, no sender/context, config externalfeatures-external
Constantsconst, virtual/abstract/override in traitsfeatures-constants
主题描述参考链接
可选类型T?、null、!!、约束条件(无可选键、无嵌套可选类型)features-optionals
映射map<K,V>、emptyMap()、获取/设置、允许的类型、序列化features-maps
initOf与部署initOf、contractAddress、StateInit、发送/部署操作features-initof-deploy
标准库@stdlib/config、content、deploy、dns、ownable、stoppablefeatures-stdlib
配置tact.config.json — 项目、选项(debug、external、safety、mode)features-config
外部消息external()、acceptMessage、无发送者/上下文、配置外部消息features-external
常量const、Trait中的virtual/abstract/overridefeatures-constants

Best practices

最佳实践

TopicDescriptionReference
SecuritySensitive data, signed ints, exit codes, random, auth, replay, bounce, excess gasbest-practices-security
GasContract params, binary receivers, message/cashback/deploy, sender(), throwUnless, SignedBundlebest-practices-gas
主题描述参考链接
安全敏感数据、有符号整数、退出码、随机数、身份验证、重放攻击、退回消息、多余Gasbest-practices-security
Gas优化合约参数、二进制接收器、消息/现金返还/部署、sender()、throwUnless、SignedBundlebest-practices-gas

Advanced

进阶内容

TopicDescriptionReference
Bounced messagesbounced<T>, 224-bit limit, fallback Slice receiver, unrecognized bouncesadvanced-bounced
主题描述参考链接
退回消息bounced<T>、224位限制、回退Slice接收器、无法识别的退回消息advanced-bounced