Skip to main content

Deploying Contracts

In order to deploy your smart contracts to the mainnet, you need a funded account. If you want to get started on Testnet, look below for information on how to get started.


Make sure you handle your mainnet account keys appropriately. Using a Key Management Service is the best practice.

Creating an Account

There are two simple methods of creating an account on testnet. Interactive and Manual, both use the Flow CLI. On mainnet you will have to fund your newly created account, there is no faucet. Make sure to install the Flow CLI. Flow CLI has a interactive mode for generating keys.


Anyone can deploy and update contracts on mainnet. Audits are encouraged but not mandatory to deploying contracts to mainnet. Take every precauction to reduce issues and protect users.

Create and deploy a mainnet project

The tool of choice is Flow CLI, there are quickstarts and guides that use Flow CLI, Getting Started

  • It is highly encouraged to test your contracts, transactions and scripts on Testnet, have strong smart contract test coverage and follow any additional guidelines set out here: Smart Contract Testing Guidelines.
  • Follow the Flow CLI instructions to Create a Project. You have the Flow CLI installed and ran flow init or flow setup in your project folder and generating a flow.json file
  • Mainnet account: You completed the mainnet account setup, (see above) and have your key pair and mainnet address ready.
  • Deploy your project, notice that your account now has contracts deployed on mainnet.
  • Deploy a contract to mainnet. You can deploy contracts individually using the account-add-contract command.

All your contract deployment addresses are stored in flow.json. Mainnet, Testnet and local (emulator) are stored as well.

Deploy updated contracts on mainnet

Contracts can be updated and retain the contract address. You can use the Flow CLI contract update command to re-deploy an updated version of your contract:


If you see Error Code: 1103, your new account does not have enough funds to complete the transaction. Make sure you have enough FLOW and your account is set up correctly, check Flowdiver to verify.

Once all your contracts are deployed, you can visit flow-view-source or run the Flow CLI get account command to confirm the deployment.


Currently, historical event data is not migrated between sporks, so you'll need to design your application with this in mind. We recognize the usefulness of historical event data and plan on adding a means of accessing it in the near future. Past spork transactional data is available, See Previous Spork Access Node Info

More Information on Sporks


The Flow test network, known as Flow Testnet, exists to help developers test their software and smart contracts against a live network. It's also used as a means of releasing and testing new protocol and smart contract features before they are integrated into Flow's main network (Mainnet).

When the Flow protocol is updated or a new version of Cadence is released, those updates will always be made available on the Flow Emulator before they're integrated into Flow Testnet or Flow Mainnet.

Getting Started on Testnet

If you need to create a flow.json file to store information about accounts and contracts use the flow init command to create a project


To create accounts and generate keys, make sure to install Flow CLI. Flow CLI provides convenient functions to simplifies interacting with the blockchain.

Creating an Account

There is a simple Flow CLI command to run to create an account. flow accounts create command will create a new account and generate a key pair then add the account to your flow.json. The command will try and You can also use the Testnet Faucet to create and fund an account.

More information about Flow CLI and creating accounts.

Creating and deploying a Project

Flow CLI can be used to create a Cadence project and stay organized, Flow CLI: Create a project. This will make deployment much easiler and help with the iterative development process.

After you have a project created and want to deploy your Cadence; contracts, transactions and scripts. flow accounts add-contract <CONTRACT_PATH> --signer <ACCOUNT_NAME> --network testnet will deploy your contract to testnet. More information on how to use Flow CLI to deploy.

Make sure Flow project was initialized in the previous step and the flow.json is present.

Making Use of Core Contracts

Flow Testnet comes with some useful contracts already deployed, called core contracts. More information and import addresses for the core contracts.

Once your accounts are set up and you're ready to develop, you can look over some code examples from the Flow Go SDK.

Breaking Changes

The Flow blockchain is improved continuously and thus version updates to Cadence, Flow node software, and the Flow SDKs will contain important updates as well as breaking changes.

You should anticipate future updates and join the community (Forum or Discord) to stay tuned on important announcements. Notices and guidelines for changes will be provided as early as possible.

Testnet Sporking

"Sporking" (soft forking) is the process of upgrading the Flow network node software and migrating the chain state from one version to another.

Currently, historical event data is not migrated between sporks. You'll need to design your application with this in mind. We recognize the usefulness of historical event data and plan on adding a means of accessing it in the near future. Only one previous spork data is available through old Access Node.


Flow Testnet is explicitly for experimentation and testing and should not be used to exchange "real value" (e.g. developing a fiat money on/off-ramp for your testnet application).