Skip to main content

Cadence

Contract Addresses

Addresses for the deployed smart contracts imported in the examples below.

NetworkTopShotTopShotMarketV3TopShotLockingMetadataViews
Testnet0x877931736ee77cff0x547f177b243b4d800x877931736ee77cff0x631e88ae7f1d7c20
Mainnet0x0b2a3299cc857e290xc1e4f4f4c42575100x0b2a3299cc857e290x1d7e57aa55817448

What is Cadence?

Cadence is a new smart contract programming language for use on the Flow Blockchain. Cadence introduces new features to smart contract programming that help developers ensure that their code is safe, secure, clear, and approachable. Some of these features are:

  • 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
  • The utilization of 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

Resource-oriented programming, and by extension Cadence, is the perfect programming environment for Non-Fungible Tokens (NFTs), because users are able to store their NFT objects directly in their accounts and transact peer-to-peer. Please see the blog post about resources to understand why they are perfect for digital assets like NBA Top Shot Moments.

We recommend that anyone who is reading this should have already completed the Cadence Tutorials, so they can build a basic understanding of the programming language.

Scripts

A script is a very simple transaction type in Cadence that can only read the state of an account or contract. It is useful for querying the metadata about an NFT, a collection or a set. The following guide provide example scripts for interacting with the blockchain for NBA Top Shot data. The scripts can also be found on GitHub.

Top Shot Examples