What is Cadence

  • Updated

Cadence is a resource-oriented programming language designed for the Flow Blockchain. It introduces new features to smart contract programming that help developers ensure that their code is safe, secure, clear, and approachable. Cadence is used to write smart contracts that are stored on-chain in accounts on the Flow blockchain.

Key features of Cadence include:

  • Type safety and a strong static type system: This helps to prevent errors and enhances the security of the code.

  • Resource-oriented programming: This is a new paradigm that pairs linear types with object capabilities to create a secure and declarative model for digital ownership. It ensures that resources, which are used to represent scarce digital assets, can only exist in one location at a time, cannot be copied, and cannot be accidentally lost or deleted.

  • Built-in pre-conditions and post-conditions for functions and transactions: This helps to ensure that the code behaves as expected.

  • Capability-based security: This enforces that access to objects is restricted to only the owner of the object and those who have a valid reference to it. This is Cadence's main form of access control.

Cadence’s syntax is inspired by popular modern general-purpose programming languages like Swift, Kotlin, and Rust. Its use of resource types maps well to that of Move, the programming language being developed by the Diem team.

For more information, you can check out the Flow documentation on Cadence and the Cadence tutorials to build a basic understanding of the programming language.