This deep dive expands on the programmability concepts in "Money that rules." It covers CashScript โ the high-level language that makes BCH contracts readable and auditable. This is developer-focused content for those who want to build on BCH.
Writing raw BCH Script is possible, but CashScript makes it readable. Instead of managing stack manipulation and opcode ordering by hand, you write the rule in a clear, Solidity-inspired language. The compiler turns it into auditable bytecode.
A familiar shape
CashScript is a high-level language for BCH contracts. Its syntax is inspired by Solidity, but its execution model is different. A contract is instantiated with parameters, and its functions decide whether money can leave. There is no mutable contract storage. The state lives in the UTXOs the contract controls and in the tokens attached to them.
The compiler, cashc, turns a .cash file into an artifact. The
CashScript SDK uses that artifact to create a contract instance, build a funding transaction,
and construct the transaction that spends it. The developer writes the rule; the SDK handles
the wallet plumbing.
A simple contract might require a signature and a timelock. A more interesting one can read the spending transaction through introspection: check the recipient's locking bytecode, the output value, or the token category on an input or output. That is how escrows, vaults, and token-aware contracts are built.
The stack is hidden, the model is not
CashScript removes the stack work, but it keeps the model visible. You still decide which coins the contract controls, which transaction spends them, and what the outputs must look like. That clarity is what makes a contract easy to review and easy to trust.
That is why CashScript code tends to be short and explicit. A function is not a method on a persistent object. It is a check that runs when a specific set of coins is spent. If the check passes, the transaction is valid. If it fails, the transaction is rejected and the coins remain safely in the contract.
The language also makes review easier. A reviewer can read the conditions in source form instead of disassembling bytecode. For contracts that hold real money, readability is part of the design.
Tooling around the language
CashScript sits in an ecosystem of BCH developer tools. The compiler produces artifacts that the TypeScript SDK can consume. Bitauth IDE is useful for inspecting and debugging Script execution. Libauth provides low-level primitives for building transactions and verifying scripts. Wallets and applications can integrate the SDK without writing their own contract engine.
The 2025 and 2026 upgrades matter here. Bigger integers and reworked VM limits make more complex math practical. Bounded loops and reusable functions reduce bytecode duplication. Standard pay-to-script outputs reduce transaction sizes for vaults and multi-party contracts. The language can express more while staying focused on money.
What CashScript is good for
The sweet spot is money with conditions: escrow, inheritance, savings vaults, token sales, subscriptions, atomic swaps, and multi-party settlement. These are not hypothetical demos. They are the kind of rules that a business or a community actually needs, and they benefit from being enforced by the same chain that holds the money.
CashScript is built for money with conditions. If you need a payment to obey a rule without a middleman, it is exactly the right tool. The UTXO model keeps the contract small, verifiable, and cheap to settle.
The best way to learn it is to write a small contract, fund it on chipnet, and spend it. The first successful spend teaches more than a page of documentation. The second shows you how clean a well-written contract can be.
For more on the token layer that CashScript can build on, see Tokens on the cash layer โ coming soon as a deep dive.
We do not provide financial advice.