0.13.0 • Public • Published

Mina zkApp CLI

The Mina zkApp CLI allows you to scaffold, write, test, and deploy zkApps (zero knowledge apps) for Mina Protocol using recommended best practices.

Apps are written using o1js, a TypeScript framework for writing zero knowledge proof-based smart contracts. o1js is automatically included when you create a project using the Mina zkApp CLI.

Getting Started

Read through this README file and the Mina Protocol zkApp Developer docs.

Build foundational knowledge by completing the guided steps in the zkApp Developer Tutorials.

Get Involved

To learn about ways to participate and interact with community members, see the Mina Online Communities docs.

Contributions are always appreciated. See the zkApp CLI CONTRIBUTING guidelines.

Install the Mina zkApp CLI

To install the Mina zkApp CLI:

$ npm install -g zkapp-cli

To confirm successful installation:

$ zk --version

Update the Mina zkApp CLI

You are prompted to install the new version if you are running an earlier zkApp CLI minor version. For example, if you are running version 0.9.8, but the current version is 0.10.2, you are prompted to update.

You are not prompted to update if you are using an earlier patch version. For example, you are not notified to upgrade when you are running 0.10.1, and the current version is 0.10.2.

To update to the latest version of the Mina zkApp CLI:

$ npm update -g zkapp-cli


To use the zkApp CLI and o1js, your environment requires:

  • NodeJS v16 and later
  • NPM v8 and later
  • Git v2 and later

Use a package manager to install the required versions and upgrade older versions if needed. Package managers for the supported environments are:

  • MacOS Homebrew

  • Windows Chocolatey

  • Linux

    • apt, yum, and others

    On Linux, you might need to install a recent Node.js version by using NodeSource. Use deb or rpm as recommended by the Node.js project.

To verify your installed versions, use npm -v, node -v, and git -v.


To see all of the zkApp CLI commands:

zk --help

Create a project

zk project my-proj  # or path/to/my-proj

✔ Fetch project template
✔ Initialize Git repo
✔ NPM install
✔ Set project name
✔ Git init commit


Next steps:
  cd my-proj
  git remote add origin <your-repo-url>
  git push -u origin main

This command creates a directory containing a new project template, fully set up and ready for local development.

  • See the included README for usage instructions. All of the usual commands are available: npm run build, npm run test, npm run coverage, and so on.
  • A GitHub repo is automatically initialized in the project directory. For consistency and by convention, we use main as the default development branch.
  • A GitHub Actions CI workflow is also included. If you push your project to GitHub, GitHub Actions run your tests (named as *.test.js) automatically whenever you push a commit or open a pull request.
  • Code style consistency (using Prettier) and linting (using ES Lint) is automatically enforced using Git pre-commit hooks. This requires no configuration and occurs automatically when you commit a change, for example, git commit -m 'feat: add awesome feature'.

Create an example project

zk example <name>

where name is one of the names found in the zkApps examples directory.

All examples are based on the standard project template created by the zkApp CLI and contain only changes within the src directory, so feel free to use one of these examples as your project base.

When inside an example folder in your terminal, you can run the example:

npm run build && node ./build/src/index.js

Create a new file

zk file <name>  # or path/to/name

This command creates name.js and name.test.js.

For convenience, when you run this command in your project's root directory creates the files inside your project's src dir automatically, even if you don't specify src/ as part of your file path.

When you run this command when you are not in your project's root dir, files are created at the path you specify relative to your terminal's current working directory.

Show system info

zk system

This command outputs system info such as your NodeJS version, NPM version, zkapp-cli version, and so on. For easier troubleshooting, be sure to include this information if submitting a bug report for zkapp-cli. See the CONTRIBUTING guidelines.

Update your config.json

zk config

The auto-generated config.json file contains your deployment-related configurations.

Run the zk config command to add a new deployment configuration to this file.

Respond to the interactive command prompts to build or update a deploy alias.

A deploy alias consists of:

  • A self-describing name. This tutorial uses berkeley. The deploy alias name can be anything and does not have to match the network name.

  • The Mina GraphQL API URL that defines the network that receives your deploy transaction and broadcasts it to the appropriate Mina network (Testnet, Devnet, Mainnet, and so on)

  • The transaction fee (in MINA) to use when deploying

  • Two key pairs:

    • A key pair for the zkApp account. Public and private keys to use in your application are automatically generated in keys/berkeley.json.

    • A key pair to use as a fee payer account for updates and deployments. Public and private keys are stored on your local computer and can be used across multiple projects.

  • Fee payer account alias

    A fee payer account is required. If you don't have a fee payer account, you are prompted to select one of these options:

    • Recover a fee payer account from an existing base58 private key
    • Create a new fee payer key pair

Deploy your smart contract

zk deploy <alias>
// OR
zk deploy // shows a list of aliases in your project to choose from

Deployment is supported only to Berkeley Testnet. zkApp programmability is not yet available on the Mina Mainnet.

After you run zk config, the zk deploy command allows you to deploy a smart contract to a specified deploy alias.

Note: When you deploy to an alias for the first time, you are prompted to choose which smart contract you want to deploy from those that exist as named exports in your project. The name of the smart contract that you choose is remembered by being saved into your config.json for this alias. For safety, the next time you run zk deploy <alias> this same smart contract automatically deploys to this alias. See Tutorial 3: Deploy to a Live Network.



Package Sidebar


Weekly Downloads






Unpacked Size

4.39 MB

Total Files


Last publish


  • o1-labs