Introduction

TCCL — The Coin Cloud Language — is the smart-contract language of The Coin. It reads like Python: blocks are indented, there are few keywords and a first contract fits in twenty lines. Underneath, it is strict: every value has a declared type, every step costs fuel, arithmetic is checked, and the same code produces exactly the same result on every node.

counter.tcclcontract Counter

state count: int

action increment(by: int):
    require by > 0, "by must be positive"
    count += by

view get() -> int:
    return count

Principles

  • Readable first. A contract is a single file anyone can review. There are no implicit conversions, no null, no floating point and no hidden control flow.
  • Safe by construction. Overflow, division by zero, running out of fuel and failed requirements stop the call and revert every change. Re-entrancy is impossible. These protections are part of the engine and cannot be turned off.
  • Honest about limits. Nothing on a public chain is secret or random by itself, and an interpreter is not native code. The documentation says so, and shows the patterns that work.
  • Compatible with history. The compiler is part of the consensus rules: a deployment carries source code and every node compiles it. Old language versions are frozen so that past blocks can always be replayed.

Language versions and where they run

VersionStatusWhat it adds
1Deployed on The Coin v0.2.0 (mainnet, testnet, regtest)Types, state, actions, views, events, fuel, TCN payments, storage deposits, ring signatures
2This release: compiler, CLI, simulator and playground. Not yet active on the networkRecords, enums with allowed transitions, roles and only, interfaces and calls between contracts, modules and the standard library, upgrade authority, mul_div/isqrt/pow, memory limits, re-priced copies

Every valid version 1 contract is also a valid version 2 contract and behaves the same way (see Versions). Until the network activates version 2, deploy to The Coin with tccl check --language 1. The activation plan is public: implant-the-coin-language.md.

Where to start

What is in this documentation

PageContents
Your first contractInstall, create, check, test, simulate and deploy
Language referenceSyntax, types, statements, records, enums, roles, interfaces, built-ins, limits
Modules and standard libraryModules versus deployed contracts, std.token, std.items, std.payments
Calling other contractsInterfaces, caller identity, transfers, return values, atomicity, re-entrancy
PermissionsRoles, only, grant, revoke and common patterns
UpgradesUpgrade authority, compatibility rules, upgrade(), making code final
SecurityDeterminism, failures and fees, limits, privacy, external data, randomness, checklist
Fuel, fees and depositsFuel schedule, fee formula, storage deposits, measurements
Error referenceEvery compile and runtime error with explanation and fix
Tested recipesComplete contracts with scenarios that run in CI
ToolsCLI, scenarios, playground, installers, deploying with the wallet
ArchitectureCompiler, program format, virtual machine, host interface, tests
VersionsLanguage and tool versions, compatibility policy, changes

TCCL is free software, dual-licensed MIT or Apache-2.0. Source: github.com/LucasBolla94/tccl.

Improve this page on GitHub