Skip to main content
info

zkApp programmability is not yet available on the Mina Mainnet, but zkApps can now be deployed on Berkeley Testnet.

How to Deploy a zkApp

Before deploying, you must first define a few settings, such as which network you are deploying to.

Add a deploy alias to config.json

Create a deploy alias in the config.json file in your smart contract project.

First, change into the directory that contains your smart contract and then run the following command:

zk config

When prompted, specify a name (can be anything), the target network (testnet or mainnet), the URL to deploy to, fee (in MINA) to be used when sending your deploy transaction, and the fee payer account.

For more details, see Deploy alias in Tutorial 3: Deploy to a Live Network.

tip

If your project contains multiple smart contracts (for example, Foo and Bar) that you intend to deploy to the same network, a best practice is to follow a naming convention such as berkeley-foo and berkeley-bar when naming your deploy aliases. You can change these alias names at any time in config.json.

You see the following output:

$ zk config

Add a new network:
✔ Choose a name (can be anything): · berkeley
✔ Set URL to deploy to: · https://proxy.berkeley.minaexplorer.com/graphql
✔ Set transaction fee to use when deploying (in MINA): · 0.1
✔ Create key pair at keys/berkeley.json
✔ Add network to config.json

Success!

Next steps:

- If this is a testnet, request tMINA at:
https://faucet.minaprotocol.com/?address=<YOUR-ADDRESS>
- To deploy, run: `zk deploy berkeley`

Request funds from the faucet

To deploy your zkApp, you must have funds to pay for transaction fees.

To get funds on the Berkeley Testnet, use the URL that was shown from the zkApp CLI output. Visit https://faucet.minaprotocol.com/?address=<YOUR-ADDRESS> and click Request.

Before proceeding to the next step, wait a few minutes for the next block to include your transaction, so tMINA is available.

Deploy your smart contract

To deploy your smart contract to the network, run the following command:

zk deploy berkeley

When running the deploy command, the zkApp CLI computes a verification key for your zkApp CLI. Computing the verification key can take 1-2 minutes, so please be patient. The zkApp CLI shows the details of the transaction, such as the network name, the URL, and the smart contract to deploy.

Finally, enter yes or y when prompted to confirm and send the transaction.

You see the following output:

$ zk deploy berkeley
✔ Build project
✔ Generate build.json
✔ Choose smart contract
Only one smart contract exists in the project: Add
Your config.json was updated to always use this
smart contract when deploying to this network.
✔ Generate verification key (takes 1-2 min)
✔ Build transaction
✔ Confirm to send transaction
Are you sure you want to send (yes/no)? · y
✔ Send to network

Success! Deploy transaction sent.

Next step:
Your smart contract will be live (or updated)
as soon as the transaction is included in a block:
https://berkeley.minaexplorer.com/transaction/<txn-hash>

After a few minutes, the transaction is included in the next block. To see your changes, go to on berkeley.minaexplorer.com and search for the address that you used.

Next Steps

More local development and testing! Use Lightnet to test your zkApp locally on an accurate representation of the Mina blockchain. See Testing zkApps with Lightnet.

Now that you've learned how to deploy a smart contract, you can now learn how to write a UI for your zkApp.