- What: Cadence is the resource-oriented smart contract programming language used on the Flow network.
- Who it's for: developers building on Flow who want compile-time safety, resource semantics, and capability-based access control. Also: teams coming from Solidity who have been burned by reentrancy, unlimited approvals, or MEV.
- Why use it: Cadence prevents entire vulnerability classes at the compiler level. Assets are resources, not ledger entries. Reentrancy attacks are significantly mitigated by Cadence's resource ownership model. Approvals are scoped.
- Status: Cadence 1.0, current release v1.10.2. Live on Flow mainnet.
- License: Apache 2.0.
- Get started: Cadence Playground (browser) or cadence-lang.org for the language reference. Open-sourced since 2019.
Cadence is the native smart contract programming language of the Flow network. It is resource-oriented, capability-based, and designed by smart contract engineers to prevent the vulnerability classes that plague Solidity development.
Core design principles:
- Resource-oriented programming. Assets are first-class resources with move semantics that cannot be duplicated, implicitly destroyed, or accessed after being moved. The compiler enforces this, not developer discipline.
- Capability-based security. Fine-grained access control via entitlements. Functions are restricted to callers holding specific authorizations at compile time.
- Type safety. Strong static typing with type inference. No runtime type surprises.
- Upgradeable by default. Contracts are upgradeable with enforced backward compatibility. No proxy pattern needed.
- Reentrancy significantly mitigated. When a resource transfers, the caller's reference is invalidated at runtime, eliminating the most common reentrancy attack vectors.
- Type safety and a strong static type system
- Resource-oriented programming, a new paradigm that pairs linear types with object capabilities to create a secure and declarative model for digital ownership by ensuring that resources (and their associated 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
- Capability-based security, which enforces access control by requiring that access to objects is restricted to only the owner and those who have a valid reference to the object
- Entitlements for fine-grained access control on references
- Contract upgradability with enforced backward compatibility
Here is a minimal Cadence contract that declares a public hello() function. This is the same example used by the @onflow/cadence-parser package to demonstrate parsing:
access(all) contract HelloWorld {
access(all) fun hello() {
log("Hello, world!")
}
}For a full walkthrough of resources, capabilities, and transactions, see the Cadence tutorial on cadence-lang.org.
To get started writing Cadence, try the Cadence Playground (browser).
If you want to develop locally, use these tools:
- Flow CLI — the primary tool for building on Flow; includes the Flow emulator, a lightweight tool that emulates the behaviour of the real Flow network.
- VS Code Cadence extension — enables development, deployment, and interaction with Cadence contracts.
The canonical language reference is at cadence-lang.org. Additional developer guides, tutorials, and integration docs live on the Flow Developer Portal.
Development documentation specific to the Cadence implementation can be found in the /docs directory.
Cadence is the native smart contract programming language of the Flow network. It is resource-oriented, capability-based, and designed to prevent entire vulnerability classes at compile time rather than relying on developer discipline.
Cadence treats assets as first-class resources with move semantics enforced by the compiler. Resources cannot be duplicated, implicitly destroyed, or accessed after being moved. Reentrancy attacks are significantly mitigated by Cadence's resource ownership model because references are invalidated at runtime when a resource transfers. Access control is capability-based via entitlements rather than msg.sender checks.
Resource-oriented programming pairs linear types with object capabilities. A resource can only exist in one location at a time, cannot be copied, and cannot be accidentally lost or deleted. This models digital ownership declaratively and is enforced by the compiler.
Cadence 1.0 is the current major language version. It introduced entitlements for fine-grained access control on references, view functions, and a number of other language improvements. The latest release is v1.10.2.
No. Any Flow Access Node can accept Cadence transactions. For local development, use the Flow CLI and the bundled Flow emulator.
The Cadence implementation in this repository is designed as the runtime for the Flow network. The language and its interpreter are licensed under Apache 2.0, so forking and embedding are permitted, but the canonical execution environment is Flow.
Start with cadence-lang.org for the language reference, work through the Cadence tutorial, and try examples in the Cadence Playground (browser). The Flow Developer Portal covers end-to-end application development.
The language reference and specification materials live at cadence-lang.org and in the /docs directory of this repository.
See SECURITY.md for the responsible disclosure process. Do not open public issues for vulnerabilities.
If you would like to contribute to Cadence, have a look at the contributing guide.
You can also join the next Cadence Working Group meeting to participate in language design discussions.
Cadence is the native language of the Flow network, a Layer 1 blockchain built for consumer applications, AI Agents, and DeFi at scale. Flow powers NBA Top Shot, NFL All Day, Disney Pinnacle (built by Dapper Labs), and Ticketmaster NFT ticketing, all in live production.
- Language reference: cadence-lang.org
- Developer docs: developers.flow.com
- Community: Flow Discord · Flow Forum
- Governance: Flow Improvement Proposals
