Mina Protocol: Create a Simple zkApp with Mina Protocol and IPFS
Learn how to create a simple zkApp with Mina Protocol and IPFS.
Last updated
Was this helpful?
Learn how to create a simple zkApp with Mina Protocol and IPFS.
Last updated
Was this helpful?
Mina Protocol is a lightweight, compact blockchain protocol that uses a recursive composition of zk-SNARKs (Zero-Knowledge Succinct Non-Interactive Arguments of Knowledge) to enable participants to validate the entire chain's state in a single, small proof. This allows for extremely fast and efficient verification, which makes Mina Protocol highly scalable.
"zkApp" stands for Zero-Knowledge Application, which is a type of decentralized application that uses zero-knowledge proofs to enhance privacy and security.
Zero-knowledge proofs are a cryptographic technique that allows one party to prove to another party that a certain statement is true, without revealing any additional information beyond the fact that the statement is indeed true. This means that a zkApp can allow users to perform certain actions or transactions without revealing their underlying data or identity to the network.
Read below to learn how to create a simple zkApp with Mina Protocol and IPFS.
This tool is available on a Linux or macOS system.
Set up a credentials file for S3FS at ${HOME}/.passwd-s3fs
. You will need to save your Filebase Access and Secret keys to this file and give it owner permissions. You can do so with the following commands:
echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > ${HOME}/.passwd-s3fs
chmod 600 ${HOME}/.passwd-s3fs
You can mount a Filebase IPFS bucket with the command:
s3fs mybucket /path/to/mountpoint -o passwd_file=${HOME}/.passwd-s3fs -o url=https://s3.filebase.com
mybucket: name of your Filebase bucket
/path/to/mountpoint
Create a new folder for your project:
mkdir minaProtocolZKApp
npm install -g zkapp-cli
zk project zkapp
rm src/Add.ts
rm src/Add.test.ts
rm src/interact.ts
zk file src/Square
touch src/main.ts
src/index.ts
file, then insert the following content:npm run build
node build/src/main.js
src/Square.js
file and insert the following smart contract code:This is a simple smart contract that retrieves the current state of the network, which is then used to update the zkApp’s current state on-chain.
src/main.ts
file and insert the following code:npm run build && node build/src/main.js
...
SnarkyJS loaded
state after init: 3
Shutting down
src/main.js
code, add the following portion:npm run build && node build/src/main.js
...
SnarkyJS loaded
state after init: 3
state after txn1: 9
Shutting down
You’ve just created your first zkApp!
ACCESS_KEY_ID is your Filebase Access key, and SECRET_ACCESS_KEY is your Filebase Secret key. For more information on Filebase access keys, see .