Mainnet Deployment Guidelines
Note: Anyone can deploy and update contracts on mainnet. Smart contract reviews (to discover any issues that may affect your users) are still provided upon request. However, they are not mandatory.
- Testnet testing: Smart contracts include test coverage and follow any additional guidelines set out here: Smart Contract Testing Guidelines. Application live on testnet and handling real world traffic for an extended period of time as suggested here: Testnet Testing Guidelines
- Flow CLI: You have the CLI installed and ran
flow initin your project folder, generating a
- Mainnet account: You completed the mainnet account setup and have your key pair and mainnet address ready
First, you need to configure the
flow.json file to add your mainnet account details:
Next, you need to set the deployment target configuration for the mainnet:
Deploy a contract on mainnet using the CLI
With the configuration changes completed, run the Flow CLI deployment command:
_10> flow project deploy --network=mainnet_10_10Deploying 2 contracts for accounts: my-mainnet-account_10_10Foo -> 0xab7... (1e8fdb973...90b7ee38b8)_10_10Bar -> 0xab7... (6c243d09e...b878111098)_10_10_10✨ All contracts deployed successfully
Note: This command automatically deploys your project's contracts based on the configuration defined in your
flow.jsonfile. If you encounter any errors, review the configuration first.
Important: If you see
Error Code: 1103, your new account does not have enough funds to complete the transaction. Make sure you have enough FLOW (e.g. by sending some from your Blocto account).
Once all your contracts are deployed, you can visit flow-view-source or run the Flow CLI get account command to confirm the deployment.
Update/Re-deploy a contract on mainnet using the CLI
You can use the Flow CLI contract update command to re-deploy an updated version of your contract:
_23> flow accounts update-contract Foo ./Foo.cdc --signer=my-mainnet-account --network=mainnet_23_23Transaction ID: e0728170165ce...6956785be50_23Contract 'Foo' updated on the account 'ab7...'._23_23Address 0xab7..._23Balance 1000.00099677_23Keys 1_23_23Key 0 Public Key 39a097c...._23Weight 1000_23Signature Algorithm ECDSA_P256_23Hash Algorithm SHA3_256_23Revoked false_23Sequence Number 3_23Index 0_23_23Contracts Deployed: 2_23Contract: 'Foo'_23Contract: 'Bar'_23_23_23Contracts (hidden, use --include contracts)
You should follow the steps listed in the Alchemy repository to get your NFT discovered through the Alchemy API. Make sure you added files needed to support your NFT on mainnet specifically.
Risks for Early Adopters
In these early days of Flow, version updates to Cadence, Flow Node software, and the Flow SDKs will often contain important updates as well as breaking changes.
Breaking changes will be a fact of life for early adopters of Flow's development stack, and you may often need to manually re-deploy your application's contracts after updates.
A version compatibility table can be found here. This will help you navigate version compatibility between Emulator, SDK, and Network Node (flow-go) versions.
"Sporking" (soft forking) is the process of upgrading Flow network node software, and migrating the state from the previous version.
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.
"Real Value" on Mainnet
Unlike Flow Testnet, once your application is launched on Flow Mainnet, your users will be exchanging real value in the form of FLOW tokens (The Flow blockchain's native token) or other resources which have been made available. You or your user will also be responsible for paying transaction fees using FLOW tokens.
You can read about Transaction fees here: concepts/#fees