← Theory library
Clarity theory
Stacks' decidable, non-Turing-complete contract language.
Easy
- 1. Introduction to ClarityA decidable language for Stacks.
- 2. LISP SyntaxUnderstanding parentheses and prefix notation.
- 3. Decidability and SafetyThe core safety philosophy of Clarity.
- 4. Clarity PrincipalsAddresses and identities in Clarity.
- 5. Booleans and LogicTrue, false, and logical operators.
- 6. Integers: uint and intUnsigned and signed 128-bit integers.
- 7. Strings and BuffersHandling text and raw data.
- 8. Optionals (some, none)Handling values that might not exist.
- 9. Response Types (ok, err)Standardizing success and failure.
- 10. ListsOrdered collections of a single type.
- 11. TuplesKey-value records.
- 12. Constants (define-constant)Immutable values defined at deployment.
- 13. Data Variables (define-data-var)Mutable single values in storage.
- 14. Maps (define-map)Key-value storage for multiple entries.
- 15. Public Functions (define-public)Functions callable by users and other contracts.
- 16. Read-only Functions (define-read-only)Querying state without changing it.
- 17. Private Functions (define-private)Internal helper functions.
- 18. Assertions (asserts!)Guarding against invalid states.
- 19. Conditional: ifBranching logic.
- 20. Sequential Logic: beginExecuting multiple expressions in order.
Medium
- 21. Unwrap! and Unwrap-panicUnpacking Optionals and Responses.
- 22. Block InformationAccessing chain metadata.
- 23. Contract Identity: as-contractExecuting as the contract principal.
- 24. Calling Other Contractscontract-call! and cross-contract interaction.
- 25. Post-conditionsClient-side protection for assets.
- 26. Introduction to TraitsDefining interfaces in Clarity.
- 27. Implementing TraitsConforming to a defined interface.
- 28. Using Traits: use-traitImporting trait definitions.
- 29. STX TransfersSending the native Stacks token.
- 30. Fungible Tokens (FTs)Defining custom tokens.
- 31. Non-Fungible Tokens (NFTs)Unique digital assets.
- 32. Map OperationsAdvanced map usage.
- 33. List Map, Filter, and FoldFunctional programming in Clarity.
- 34. Bitwise OperationsManipulating bits.
- 35. Hash Functionssha256 and keccak256.
- 36. Signature VerificationChecking ECDSA signatures.
- 37. Time-bound ActionsUsing block height for logic.
Hard
- 38. Advanced Maps: Nested DataComplex data structures in maps.
- 39. Dynamic Contract InteractionPassing contracts as arguments.
- 40. Trait VersioningUpdating interfaces.
- 41. Cost AnalysisUnderstanding the cost function.
- 42. Static Analysis in ClarityTooling and verification.
- 43. Stacks Naming Service (BNS)Identity on Stacks.
- 44. Stacking and PoXProof of Transfer mechanism.
- 45. Security: Integer OverflowsHow Clarity handles math errors.
- 46. Security: Access ControlProperly protecting sensitive functions.
- 47. Multi-signature PatternsCoordinating multiple signers.
- 48. Governance PatternsDAO structures on Stacks.
- 49. Proxy Patterns and UpgradabilityManaging immutable code.
- 50. The Future of ClaritySubnets and Clarity 2.0.