1. Home
  2. /
  3. Simplicity
  4. /
  5. Atomic Swap

Atomic Swap - Simplicity Typing CST Test

Loading…

Atomic Swap — Simplicity Code

Enables atomic swap between two parties using hash preimage.

contract atomicSwap {
	input: hash preimage, sig senderSig, sig receiverSig
	output: funds released if hash(preimage) == knownHash && verify(senderSig) && verify(receiverSig)
}

Simplicity Language Guide

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.

Primary Use Cases

  • ▸Formal-verifiable smart contracts
  • ▸Multi-signature wallets
  • ▸UTXO-based DeFi primitives
  • ▸Escrow and payment channels
  • ▸High-assurance blockchain applications

Notable Features

  • ▸Strong static typing prevents many runtime errors
  • ▸Composable functional expressions
  • ▸Designed for formal verification
  • ▸Low-level predictable execution
  • ▸Deterministic and sandboxed semantics

Origin & Creator

Simplicity was developed by Russell O’Connor and contributors from Blockstream around 2015-2017 to improve upon Bitcoin Script, with a focus on safer, verifiable smart contracts.

Industrial Note

Simplicity is primarily used in UTXO blockchain systems for secure, high-assurance smart contracts, including multi-signature wallets, DeFi primitives on Bitcoin sidechains, and formally verified financial applications.

More Simplicity Typing Exercises

Simplicity Minimal Contract ExampleSimplicity Basic EscrowSimplicity Time-Lock ContractSimplicity Multi-Signature WalletSimplicity Conditional PaymentSimplicity Escrow with TimeoutSimplicity Crowdfunding ContractSimplicity Token VestingSimplicity Payment Channel

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher