TON DocsTON Docs
OnboardingNodesApplicationsAPIsContractsSmart contractsTolkTolk languageTVMTON Virtual MachineFoundationsBlockchain foundations

WalletTg: Telegram wallet contract

WalletTg is the TON wallet contract used by the Telegram's native Gram wallet.

Features

Shared implementation

Each account stores immutable trampoline code. The trampoline loads the shared implementation from configuration parameter -123, while each account keeps its own balance and storage.

WalletTg accounts keep trampoline code and local storage while executing shared implementation code from configuration parameter minus 123.

Validators approve configuration changes through voting. An update changes the implementation used by every WalletTg account on that network. Wallet owners cannot change the implementation or opt out of updates.

The brief contract reference documents storage and upgrade migration behavior.

Address anchor and signing key

The contract address is derived from the original StateInit, which includes the trampoline code and anchor public key.

Initially, the anchor is also the signing key. Rotation replaces the current on-chain signing key but leaves the original StateInit and address unchanged.

Composing a new StateInit with the replacement key derives a different address.

After rotation, only the current signing key authorizes requests; the anchor cannot restore signing access. The key-management reference explains the two-key mnemonic and rotation.

Backup and self-custody

Telegram's encrypted backup and phrase updates are app features, separate from contract storage.

Comparison with V5

WalletTg and wallet V5 use different signed-request encodings. That is, the layout and composition of their messages differ. Refer to the WalletTg message reference and the V5 reference for details.

Compare wallet capabilities in the table.

On this page