Skip to main content

Testnet Deployment Guidelines

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

Creating an Account

Anybody can use the Testnet Faucet to create and fund a Testnet account.

Generate a Key

To start, you'll need to generate an asymmetric cryptographic key pair (see Accounts & Keys for a list of supported algorithms).

For Testnet, you can generate a new key pair with the Flow CLI:


_10
> flow keys generate
_10
_10
🙏 If you want to create an account on testnet with the generated keys use this link:
_10
https://testnet-faucet.onflow.org/?key=2a56a2....
_10
_10
_10
🔴️ Store private key safely and don't share with anyone!
_10
Private Key 55e92c7083...
_10
Public Key 2a56a24a63...

Note: By default, this command generates an ECDSA key pair on the P-256 curve. Keep in mind, the CLI is intended for development purposes only and is not recommended for production use. Handling keys using a Key Management Service is the best practice.

Create Your Account

Once you've generated a key pair, you can either open the link from the CLI prompt or visit the Faucet yourself. If you visit the faucet yourself, make sure you enter the public key into the "Create Account" form at the top of the page.

Important: Flow isn't responsible for securing and storing the private keys for testnet accounts. You must store your private key in a safe place so that you can later use it to sign transactions that you submit to Testnet.

Need More FLOW?

Each account created through the Testnet Faucet comes with 1000 FLOW. However, you can always request a top up through the Faucet if needed.

Submit your testnet address through the "Funding an Account" form on the Faucet page.

Accessing Flow Testnet

Use the following address to programmatically connect to Flow Testnet:


_10
access.devnet.nodes.onflow.org:9000

Go SDK Example:


_10
import "github.com/onflow/flow-go-sdk/client"
_10
_10
func main() {
_10
flowAccessHost := "access.devnet.nodes.onflow.org:9000"
_10
flowClient, _ := client.New(flowAccessHost, grpc.WithInsecure())
_10
_10
// ...
_10
}

Creating Additional Accounts

It may be necessary to create additional accounts for testing purposes and you can do so using Flow CLI account create command.

First you need to initialize the configuration:


_10
> flow project init

Add the account created with the use of faucet above to the accounts property in configuration, like so:

flow.json

_10
{
_10
...
_10
"accounts": {
_10
"my-testnet-account": {
_10
"address": "ADDRESS_FROM_FAUCET",
_10
"key": "PRIVATE_KEY_GENERATED_IN_PREVIOUS_STEP"
_10
}
_10
}
_10
...
_10
}

After adding account to the configuration you can use that account to fund the creation of more accounts by using CLI account create command.


_15
> flow accounts create \
_15
--key a69c6986e846ba6d0....1397f5904cd319c3e01e96375d5777f1a47010 \
_15
--host access.devnet.nodes.onflow.org:9000 \
_15
--signer my-testnet-account
_15
_15
Address 0x01cf0e2f2f715450
_15
Balance 10000000
_15
Keys 1
_15
_15
Key 0 Public Key a69c6986e846ba6d0....1397f5904cd319c3e01e96375d5777f1a47010
_15
Weight 1000
_15
Signature Algorithm ECDSA_P256
_15
Hash Algorithm SHA3_256
_15
_15
Contracts Deployed: 0

Deploying a Contract

Using the account you created above, you can deploy additional contract accounts using the Flow CLI deploy command.

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

You can then specify your contracts you wish to deploy in the configuration like so:

flow.json

_13
{
_13
...
_13
"contracts": {
_13
"NonFungibleToken": "./cadence/contracts/NonFungibleToken.cdc",
_13
"KittyItems": "./cadence/contracts/KittyItems.cdc"
_13
},
_13
"deployments": {
_13
"testnet": {
_13
"my-testnet-account": ["KittyItems", "NonFungibleToken"]
_13
}
_13
},
_13
...
_13
}

Here's a sketch of the contract source files:


_10
pub contract NonFungibleToken {
_10
// ...
_10
}


_10
import NonFungibleToken from "./NonFungibleToken.cdc"
_10
_10
pub contract KittyItems {
_10
// ...
_10
}

You can now deploy all the contracts by running deploy command:


_10
flow project deploy

Please read more about deployment in the Flow CLI project deployment guide.

Making Use of Core Contracts

Flow Testnet comes with some useful contracts already deployed, called core contracts. There are reference pages with 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.

Redeploying Your Application

If you discover your application is broken after an update, use the latest emulator to test changes to your application. Once you are satisfied that you've patched any breaking changes, you'll need to redeploy your contracts to Testnet.

Note: Make sure to follow the steps listed in the Testnet Testing Guidelines

Making Your NFT Discoverable

Wallets like Blocto may use the Alchemy API to discover and display NFT collections on the Flow blockchain. In order to get your NFT listed on Alchemy, you should follow the steps listed in the Alchemy repository.

Risks for Early Adopters

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.

Note: In some instances, you might need to redeploy Your Application.

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.

"Real Value" on Testnet

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). Accounts using the testnet to exchange real value will be subject to removal.