Learn Simplicity - 10 Code Examples & CST Typing Practice Test
Simplicity is a typed, functional smart contract language designed for blockchain applications, with a focus on formal verification, expressiveness, and secure, predictable execution, primarily targeting Bitcoin and similar blockchain platforms.
View all 10 Simplicity code examples →
Learn SIMPLICITY with Real Code Examples
Updated Nov 25, 2025
Code Sample Descriptions
Simplicity Minimal Contract Example
// Define a contract that locks funds until a condition is met
contract lockFunds {
input: signature sig, condition cond
output: funds released if cond(sig) == true
}
A minimal example illustrating a composable financial contract in Simplicity.
Simplicity Basic Escrow
contract escrow {
input: sig senderSig, sig recipientSig
output: funds released if verify(senderSig) && verify(recipientSig)
}
Funds are released to a recipient only if both parties sign.
Simplicity Time-Lock Contract
contract timelock {
input: currentBlockTime
output: funds released if currentBlockTime >= lockTime
}
Funds are locked until a specific block time is reached.
Simplicity Multi-Signature Wallet
contract multisig {
input: sigs[3]
output: funds released if count_valid(sigs) >= 2
}
Releases funds only if multiple signatures approve.
Simplicity Conditional Payment
contract conditionalPay {
input: sig payerSig, data d
output: funds released if validate(d) && verify(payerSig)
}
Transfers funds only if a condition on input data is satisfied.
Simplicity Atomic Swap
contract atomicSwap {
input: hash preimage, sig senderSig, sig receiverSig
output: funds released if hash(preimage) == knownHash && verify(senderSig) && verify(receiverSig)
}
Enables atomic swap between two parties using hash preimage.
Simplicity Escrow with Timeout
contract escrowTimeout {
input: sig senderSig, sig recipientSig, currentBlockTime
output: funds released to recipient if verify(recipientSig) || refunded to sender if currentBlockTime >= timeout
}
Funds can be claimed by recipient or refunded after timeout.
Simplicity Crowdfunding Contract
contract crowdfunding {
input: sig contributorSig, amount, totalRaised
output: release to owner if totalRaised >= goal else refundable to contributors
}
Funds are released to project owner only if funding goal is reached.
Simplicity Token Vesting
contract vesting {
input: currentBlockTime
output: release vestedAmount(currentBlockTime) to recipient
}
Vests tokens over time to a recipient.
Simplicity Payment Channel
contract paymentChannel {
input: sig senderSig, sig receiverSig, balanceUpdate
output: settle funds according to signed balanceUpdate
}
Enables off-chain microtransactions with on-chain settlement.
Frequently Asked Questions about Simplicity
What is Simplicity?
Simplicity is a typed, functional smart contract language designed for blockchain applications, with a focus on formal verification, expressiveness, and secure, predictable execution, primarily targeting Bitcoin and similar blockchain platforms.
What are the primary use cases for Simplicity?
Formal-verifiable smart contracts. Multi-signature wallets. UTXO-based DeFi primitives. Escrow and payment channels. High-assurance blockchain applications
What are the strengths of Simplicity?
High security due to formal verification. Predictable and auditable execution. Eliminates many common smart contract bugs. Composability allows building complex logic safely. Ideal for financial and payment contracts
What are the limitations of Simplicity?
Steep learning curve. Smaller ecosystem than Solidity or Move. Low-level: less developer-friendly. Limited tooling and IDE support. Primarily targets UTXO blockchains
How can I practice Simplicity typing speed?
CodeSpeedTest offers 10+ real Simplicity code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.