# Cadence > Cadence is a resource-oriented programming language for smart contracts on the Flow blockchain. Cadence 1.0 introduces capability-based access control, strict resource ownership, and entitlements — making smart contracts safer to audit and harder to misuse than account-based languages. Resources can only exist in one place at a time and must be explicitly moved, preventing common bugs like double-spending. Cadence transactions are written in the language itself, allowing multiple calls to multiple functions across multiple contracts in a single atomic, user-signed operation. This file is an llms.txt index for cadence-lang.org following the llmstxt.org standard. Supplementary resources: - Cadence source repository: https://github.com/onflow/cadence - Flow Playground (browser-based Cadence IDE): https://play.flow.com/ - Flow developer documentation (companion llms.txt): https://developers.flow.com/llms.txt ## Table of Contents - [Access Control](https://cadence-lang.org/docs/language/access-control.md): Access control allows making certain parts of a program accessible/visible and making other parts inaccessible/invisible. - [Capabilities](https://cadence-lang.org/docs/language/accounts/capabilities.md): Accounts have capabilities associated with them. - [Contracts](https://cadence-lang.org/docs/language/accounts/contracts.md): Accounts store contracts. A contract can also just be an [interface](../interfaces.mdx). - [Inbox](https://cadence-lang.org/docs/language/accounts/inbox.md): Accounts have an inbox, which allows making [capabilities] available to specific accounts. The inbox provides a convenient way to _bootstrap_ capab... - [Accounts](https://cadence-lang.org/docs/language/accounts/index.md): The type `Account` provides access to accounts. Accounts are only accessed through [references], which might be [authorized]. - [Keys](https://cadence-lang.org/docs/language/accounts/keys.md): Accounts have keys associated with them. When a key is added to an account, the key can be used to sign a [transaction], which in turn gets access ... - [Paths](https://cadence-lang.org/docs/language/accounts/paths.md): Account storage stores objects under paths. Paths consist of a domain and an identifier. - [Storage](https://cadence-lang.org/docs/language/accounts/storage.md): Accounts allow storing storable objects, such as resources and structures. - [Attachments](https://cadence-lang.org/docs/language/attachments.md): Attachments are a feature of Cadence designed to allow developers to extend a struct or resource type (even one that they did not create) with new ... - [Built-in Functions](https://cadence-lang.org/docs/language/built-in-functions.md): The following describes Cadence's built in functions. Examples are also provided. - [Capabilities](https://cadence-lang.org/docs/language/capabilities.md): Cadence supports [capability-based security] through the [object-capability model]. - [Constants and Variable Declarations](https://cadence-lang.org/docs/language/constants-and-variables.md): Constants and variables are declarations that bind a value and [type] to an identifier. Constants are initialized with a value and cannot be reassi... - [Contract Updatability](https://cadence-lang.org/docs/language/contract-updatability.md): A [contract] is a collection of data (its state) and code (its functions) that lives in the contract storage area of an account. When a contract is... - [Contracts](https://cadence-lang.org/docs/language/contracts.md): A contract is a collection of type definitions, data (its state), and code (its functions) that is stored in the contract storage area of an account. - [Control Flow](https://cadence-lang.org/docs/language/control-flow.md): Control flow statements control the flow of execution in a function. - [Core Events](https://cadence-lang.org/docs/language/core-events.md): Core events are events emitted directly from the Flow Virtual Machine (FVM). The events have the same name on all networks and do not follow the st... - [Crypto](https://cadence-lang.org/docs/language/crypto.md): This article provides an overview of the cryptographic primitives and operations available in Cadence. - [Enumerations](https://cadence-lang.org/docs/language/enumerations.md): Enumerations are sets of symbolic names bound to unique, constant values, which can be compared by identity. - [Environment Information](https://cadence-lang.org/docs/language/environment-information.md): To get the addresses of the signers of a transaction, use the `address` field of each signing `Account` that is passed to the transaction's `prepar... - [Events](https://cadence-lang.org/docs/language/events.md): Events are special values that can be emitted during the execution of a program. - [Functions](https://cadence-lang.org/docs/language/functions.md): Functions are sequences of statements that perform a specific task. Functions have parameters (inputs) and an optional return value (output). Funct... - [Imports](https://cadence-lang.org/docs/language/imports.md): Programs can import declarations (types, functions, variables, and so on) from other programs. - [The Cadence Programming Language](https://cadence-lang.org/docs/language/index.md): The Cadence Programming Language is a new high-level programming language intended for smart contract development. - [Interfaces](https://cadence-lang.org/docs/language/interfaces.md): An interface is an abstract type that specifies the behavior of types that **implement** the interface. Interfaces declare the required functions a... - [Arithmetic and Logical Operators](https://cadence-lang.org/docs/language/operators/arithmetic-logical-operators.md): The unary pefix operator `-` negates an integer: - [Assignment, Move, Force-Assignment, and Swapping Operators](https://cadence-lang.org/docs/language/operators/assign-move-force-swap.md): The binary assignment operator `=` can be used to assign a new value to a variable. It is only allowed in a statement and is not allowed in express... - [Bitwise and Ternary Conditional Operators](https://cadence-lang.org/docs/language/operators/bitwise-ternary-operators.md): Bitwise operators enable the manipulation of individual bits of unsigned and signed integers. They're often used in low-level programming. - [Casting Operators](https://cadence-lang.org/docs/language/operators/casting-operators.md): The static casting operator `as` can be used to statically type cast a value to a type. - [Comparison Operators](https://cadence-lang.org/docs/language/operators/comparison-operators.md): Comparison operators work with boolean and integer values. - [Operators](https://cadence-lang.org/docs/language/operators/index.md): Operators are special symbols that perform a computation for one or more values. They are either unary, binary, or ternary: - [Optional Operators](https://cadence-lang.org/docs/language/operators/optional-operators.md): The nil-coalescing operator `??` returns the value inside an optional if it contains a value, or returns an alternative value if the optional has n... - [Prescedence and Associativity](https://cadence-lang.org/docs/language/operators/prescedence-associativity.md): Operators have the following precedences, from highest to lowest: - [Pre- and Post-Conditions](https://cadence-lang.org/docs/language/pre-and-post-conditions.md): Pre-conditions and post-conditions are a unique and powerful feature of Cadence that allow you to specify conditions for execution that must be met... - [References](https://cadence-lang.org/docs/language/references.md): It is possible to create references to objects (i.e., resources or structures). A reference can be used to access fields and call functions on the ... - [Resources](https://cadence-lang.org/docs/language/resources.md): Enables resource-oriented programming on Flow - [Scope](https://cadence-lang.org/docs/language/scope.md): Every function and block (`{` ... `}`) introduces a new scope for declarations. Each function and block can refer to declarations in its scope or a... - [Syntax and Glossary](https://cadence-lang.org/docs/language/syntax.md): This comprehensive glossary provides detailed explanations and code examples for the most important syntax, symbols, operators, keywords, functions... - [Transactions](https://cadence-lang.org/docs/language/transactions.md): Transactions are objects that are signed with keys of one or more [accounts] and are sent to the chain to interact with it and perform state changes. - [Composite Types](https://cadence-lang.org/docs/language/types-and-type-system/composite-types.md): Composite types allow composing simpler types into more complex types. For example, they allow the composition of multiple values into one. Composi... - [Types and Type System](https://cadence-lang.org/docs/language/types-and-type-system/index.md): See the following articles to learn more about types and Cadence's type system: - [Intersection Types](https://cadence-lang.org/docs/language/types-and-type-system/intersection-types.md): Interface types cannot be used in type annotations directly; instead, they must be used as part of intersection types. An intersection type represe... - [Run-time Types](https://cadence-lang.org/docs/language/types-and-type-system/run-time-types.md): Types can be represented at run-time. To create a type value, use the constructor function `Type()`, which accepts the static type as a type arg... - [Type Annotations](https://cadence-lang.org/docs/language/types-and-type-system/type-annotations.md): When declaring a constant or variable, an optional _type annotation_ can be provided, to make it explicit what type the declaration has. - [Type Hierarchy](https://cadence-lang.org/docs/language/types-and-type-system/type-hierarchy.md): ![Cadence type hierarchy](type-hierarchy.png) - [Type Inference](https://cadence-lang.org/docs/language/types-and-type-system/type-inference.md): If a variable or constant declaration is not annotated explicitly with a type, the declaration's type is inferred from the initial value. - [Type Safety](https://cadence-lang.org/docs/language/types-and-type-system/type-safety.md): The Cadence programming language is a _type-safe_ language. - [Addresses and Address Functions](https://cadence-lang.org/docs/language/values-and-types/addresses-functions.md): The type `Address` represents an address. Addresses are unsigned integers with a size of 64 bits (8 bytes). Hexadecimal integer literals can be use... - [AnyStruct, AnyResource, Optionals, and Never](https://cadence-lang.org/docs/language/values-and-types/anystruct-anyresource-opts-never.md): `AnyStruct` is the top type of all non-resource types (i.e., all non-resource types are a subtype of it). - [Arrays](https://cadence-lang.org/docs/language/values-and-types/arrays.md): Arrays consist of the following: - [Booleans, Numeric Literals, and Integers](https://cadence-lang.org/docs/language/values-and-types/booleans-numlits-ints.md): The two boolean values `true` and `false` have the type `Bool`. - [Dictionaries](https://cadence-lang.org/docs/language/values-and-types/dictionaries.md): Dictionaries are mutable, unordered collections of key-value associations. Dictionaries may contain a key only once and may contain a value multipl... - [Fixed-Point Numbers and Functions](https://cadence-lang.org/docs/language/values-and-types/fixed-point-nums-ints.md): :::warning[🚧 Status] - [InclusiveRange](https://cadence-lang.org/docs/language/values-and-types/inclusive-range.md): An `InclusiveRange` value represents a range of numerical values between two integers, with the start and end numbers included in the r... - [Values and Types](https://cadence-lang.org/docs/language/values-and-types/index.md): Values are handled in the following way: - [Minimum and Maximum Values, Saturation Arithmetic, and Floating-Point Numbers](https://cadence-lang.org/docs/language/values-and-types/min-max-saturation-floating-pt-nums.md): The minimum and maximum values for all integer and fixed-point number types are available through the fields `min` and `max`. - [Strings and Characters](https://cadence-lang.org/docs/language/values-and-types/strings-and-characters.md): Strings and characters are used as follows: - [First Steps](https://cadence-lang.org/docs/tutorial/first-steps.md):
- [Hello World](https://cadence-lang.org/docs/tutorial/hello-world.md): A smart contract tutorial for Cadence. - [Resources and the Move (<-) Operator](https://cadence-lang.org/docs/tutorial/resources.md): An introduction to resources, capabilities, and account storage in Cadence - [Capabilities and Entitlements](https://cadence-lang.org/docs/tutorial/capabilities.md): An introduction to capabilities, entitlements, and how they interact with resources in Cadence - [Basic NFT](https://cadence-lang.org/docs/tutorial/non-fungible-tokens-1.md): An introduction to a simplified version of NFTs on Cadence. - [Intermediate NFTs](https://cadence-lang.org/docs/tutorial/non-fungible-tokens-2.md): Learn how to manage collections of NFTs in Cadence - [Fungible Tokens](https://cadence-lang.org/docs/tutorial/fungible-tokens.md): An introduction to Fungible Tokens in Cadence - [Marketplace Setup](https://cadence-lang.org/docs/tutorial/marketplace-setup.md): In the [Marketplace Tutorial], we're going to create a marketplace that uses both the fungible and non-fungible token (NFT) contracts that we have ... - [Marketplace](https://cadence-lang.org/docs/tutorial/marketplace-compose.md): Build a composable NFT marketplace on Flow using Cadence, integrating fungible and non-fungible tokens, capabilities, and events. - [Voting Contract](https://cadence-lang.org/docs/tutorial/voting.md): In this tutorial, we're going to deploy a contract that allows users to vote on multiple proposals that a voting administrator controls. - [Cadence Design Patterns](https://cadence-lang.org/docs/design-patterns.md): This is a selection of software design patterns developed by core Flow developers - [Cadence Anti-Patterns](https://cadence-lang.org/docs/anti-patterns.md): This is an opinionated list of issues that can be improved if they are found in Cadence code intended for production. - [Contract Upgrades with Incompatible Changes](https://cadence-lang.org/docs/contract-upgrades.md): The following explains what to do when facing an incompatible upgrade for a contract. - [Cadence Security Best Practices](https://cadence-lang.org/docs/security-best-practices.md): This is an opinionated list of best practices that Cadence developers should follow to write more secure Cadence code. - [Cadence Guide for Solidity Developers](https://cadence-lang.org/docs/solidity-to-cadence.md): Cadence introduces a different way to approach smart contract development, which may feel unfamiliar to Solidity developers. There are fundamental ... - [Cadence Testing Framework](https://cadence-lang.org/docs/testing-framework.md): The Cadence testing framework provides a convenient way to write tests for Cadence programs in Cadence. This functionality is provided by the built... - [Measuring Time In Cadence](https://cadence-lang.org/docs/measuring-time.md): Both the [block height and the block timestamp] are accessible from within Cadence code. - [Flow Smart Contract Project Development Standards](https://cadence-lang.org/docs/project-development-tips.md): Learn how to effectively organize and manage a Cadence project - [JSON-Cadence Data Interchange Format](https://cadence-lang.org/docs/json-cadence-spec.md): > Version 0.3.1 - [Protocol Smart Contracts 1.0 Changes Guide](https://cadence-lang.org/docs/cadence-migration-guide/core-contracts-guide.md): :::important - [Fungible Token Cadence 1.0 Migration Guide](https://cadence-lang.org/docs/cadence-migration-guide/ft-guide.md): :::important - [Cadence 1.0 Improvements & New Features](https://cadence-lang.org/docs/cadence-migration-guide/improvements.md): Cadence 1.0 was released in October of 2024. This page provides a historical reference of changes. - [Cadence 1.0 Migration Guide](https://cadence-lang.org/docs/cadence-migration-guide/index.md): On September 4th, 2024, the Flow Mainnet upgraded to Cadence 1.0. - [Non-Fungible Token Cadence 1.0 Migration Guide](https://cadence-lang.org/docs/cadence-migration-guide/nft-guide.md): :::important - [Why Use Cadence?](https://cadence-lang.org/docs/why.md): Cadence provides security and safety guarantees that greatly simplify the development of secure smart contracts. As smart contracts often deal with... - [Introduction to Cadence](https://cadence-lang.org/docs/index.md): In a blockchain environment like Flow, programs that are stored and executed onchain are referred to as smart contracts. A smart contract programma...