Introduction
The Maya CLI is a 100% open source, contributor-friendly command line tool written in go to generate and verify zero-knowledge proof of image transformations.
Install
To run the commands, you can either use docker or build from source.
Docker
Install docker and run these commands using docker.
Build from source
- Build and install the binary
go install .
- Test if it is installed properly
maya-cli --help
Run maya
You can run maya commands easily using docker.
Maya CLI provides commands for both proving
an image transformation and verifying
it.
You can also look at the available transformations for proving
by running:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest prove --help
Similarly, to look at the available transformations for verifying
, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest verify --help
Crop
To run sample code for crop transformation, follow these steps:
- Clone the maya-cli repository
git clone https://github.com/0xmayalabs/maya-cli.git
- Cd into the directory
cd maya-cli
- To prove that an image is cropped correctly, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest prove crop \ --original-image=./sample/original.png \ --final-image=./sample/cropped.png \ --height-start-new=0 \ --width-start-new=0 \ --proof-dir=proofs
- To verify that an image is cropped correctly, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest verify crop \ --final-image=./sample/cropped.png \ --proof-dir=proofs
Please note that the repository contains sample images that you can use to get started quickly,
but you don't need to clone the repository to run the prove
or verify
commands.
Rotate 90
To run sample code for rotate 90 transformation, follow these steps:
- Clone the maya-cli repository
git clone https://github.com/0xmayalabs/maya-cli.git
- Cd into the directory
cd maya-cli
- To prove that an image is rotated correctly, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest prove rotate90 \ --original-image=./sample/original.png \ --final-image=./sample/rotate90.png \ --proof-dir=proofs
- To verify that an image is cropped correctly, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest verify rotate90 \
--final-image=./sample/rotated90.png \
--proof-dir=proofs
Please note that the repository contains sample images that you can use to get started quickly,
but you don't need to clone the repository to run the prove
or verify
commands.
Rotate 180
To run sample code for rotate 180 transformation, follow these steps:
- Clone the maya-cli repository
git clone https://github.com/0xmayalabs/maya-cli.git
- Cd into the directory
cd maya-cli
- To prove that an image is rotated correctly, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest prove rotate180 \ --original-image=./sample/original.png \ --final-image=./sample/rotate180.png \ --proof-dir=proofs
- To verify that an image is cropped correctly, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest verify rotate180 \
--final-image=./sample/rotated180.png \
--proof-dir=proofs
Please note that the repository contains sample images that you can use to get started quickly,
but you don't need to clone the repository to run the prove
or verify
commands.
Rotate 270
To run sample code for rotate 270 transformation, follow these steps:
- Clone the maya-cli repository
git clone https://github.com/0xmayalabs/maya-cli.git
- Cd into the directory
cd maya-cli
- To prove that an image is rotated correctly, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest prove rotate270 \ --original-image=./sample/original.png \ --final-image=./sample/rotate270.png \ --proof-dir=proofs
- To verify that an image is cropped correctly, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest verify rotate270 \
--final-image=./sample/rotate270.png \
--proof-dir=proofs
Please note that the repository contains sample images that you can use to get started quickly,
but you don't need to clone the repository to run the prove
or verify
commands.
Flip vertical
To run sample code for flip vertical transformation, follow these steps:
- Clone the maya-cli repository
git clone https://github.com/0xmayalabs/maya-cli.git
- Cd into the directory
cd maya-cli
- To prove that an image is correctly flipped vertically, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest prove flip-vertical \ --original-image=./sample/original.png \ --final-image=./sample/flipped_vertical.png \ --proof-dir=proofs
- To verify that an image is correctly flipped vertically, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest verify flip-vertical \ --final-image=./sample/flipped_vertical.png \ --proof-dir=proofs
Please note that the repository contains sample images that you can use to get started quickly,
but you don't need to clone the repository to run the prove
or verify
commands.
Flip Horizontal
To run sample code for flip horizontal transformation, follow these steps:
- Clone the maya-cli repository
git clone https://github.com/0xmayalabs/maya-cli.git
- Cd into the directory
cd maya-cli
- To prove that an image is correctly flipped horizontally, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest prove flip-horizontal \ --original-image=./sample/original.png \ --final-image=./sample/flipped_horizontal.png \ --proof-dir=proofs
- To verify that an image is correctly flipped horizontally, run:
docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest verify flip-horizontal \ --final-image=./sample/flipped_horizontal.png \ --proof-dir=proofs
Please note that the repository contains sample images that you can use to get started quickly,
but you don't need to clone the repository to run the prove
or verify
commands.
Brighten
To run sample code for crop transformation, follow these steps:
- Clone the maya-cli repository
git clone https://github.com/0xmayalabs/maya-cli.git
- Cd into the directory
cd maya-cli
- To prove that an image is correctly brightened by a brightness factor
factor
, run:docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest prove brighten \ --original-image=./sample/original.png \ --final-image=./sample/brightened.png \ --brightening-factor=2 \ --proof-dir=proofs
- To verify that an image is correctly brightened by a brightness factor
factor
, run:docker run --rm -v "$(pwd):/opt/maya" 0xmayalabs/maya-cli:latest verify brighten \ --final-image=./sample/brightened.png \ --proof-dir=proofs
Please note that the repository contains sample images that you can use to get started quickly,
but you don't need to clone the repository to run the prove
or verify
commands.
Performance
We evaluate the efficiency and performance of generating zero-knowledge (ZK) proofs for image transformations through the development of custom ZK circuits.
These circuits are developed using gnark, an open-source framework to design ZK circuits. Our objective is to benchmark the performance of our custom circuits against general purpose zkVMs such as RiscZero and SP1.
It's important to note that during this performance evaluation, the original image remains private, and only the transformed image is revealed.
Macbook Pro
The performance is measured on Macbook Pro M1, 10 cores of CPU & 16GB RAM.
Crop
Original Size | Final Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Verifying Key size (bytes) | Backend |
---|---|---|---|---|---|---|
1000x1000 | 10x10 | 0.860435 | 15.984716 | 164 | 10056 | groth16 |
1000x1000 | 100x100 | 0.807895 | 19.217036 | 164 | 960456 | groth16 |
1000x1000 | 250x250 | 0.886173 | 31.315820 | 164 | 6000456 | groth16 |
1000x1000 | 500x500 | 1.176808 | 59.444702 | 164 | 24000456 | groth16 |
1000x1000 | 750x750 | 1.628575 | 105.432005 | 164 | 54000456 | groth16 |
1000x1000 | 10x10 | 0.921003 | 1.311369 | 552 | 536 | plonk |
1000x1000 | 100x100 | 0.737113 | 6.266179 | 552 | 536 | plonk |
1000x1000 | 250x250 | 0.846973 | 46.563869 | 552 | 536 | plonk |
1000x1000 | 500x500 | 1.030190 | 200.574828 | 552 | 536 | plonk |
1000x1000 | 750x750 | 1.731226 | 412.768052 | 552 | 536 | plonk |
Rotate 90
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000434 | 0.033605 | 164 | groth16 |
100x100 | 0.028184 | 1.699871 | 164 | groth16 |
250x250 | 0.171229 | 10.918394 | 164 | groth16 |
500x500 | 0.647757 | 43.215272 | 164 | groth16 |
750x750 | 1.421753 | 94.541931 | 164 | groth16 |
10x10 | 0.000247 | 0.200214 | 552 | plonk |
100x100 | 0.020475 | 5.128606 | 552 | plonk |
250x250 | 0.134876 | 45.082718 | 552 | plonk |
500x500 | 0.558636 | 196.608304 | 552 | plonk |
750x750 | 1.592956 | 421.920696 | 552 | plonk |
Rotate 180
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000377 | 0.032683 | 164 | groth16 |
100x100 | 0.025277 | 1.788267 | 164 | groth16 |
250x250 | 0.153462 | 11.111391 | 164 | groth16 |
500x500 | 0.580021 | 45.384939 | 164 | groth16 |
750x750 | 1.331276 | 94.734796 | 164 | groth16 |
10x10 | 0.000338 | 0.199782 | 552 | plonk |
100x100 | 0.022096 | 5.186410 | 552 | plonk |
250x250 | 0.130622 | 45.474365 | 552 | plonk |
500x500 | 0.513307 | 194.285966 | 552 | plonk |
750x750 | 1.142496 | 425.788482 | 552 | plonk |
Rotate 270
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000451 | 0.033596 | 164 | groth16 |
100x100 | 0.025271 | 1.744991 | 164 | groth16 |
250x250 | 0.151591 | 11.086174 | 164 | groth16 |
500x500 | 0.594607 | 43.656017 | 164 | groth16 |
750x750 | 1.334827 | 96.234792 | 164 | groth16 |
10x10 | 0.000254 | 0.205031 | 552 | plonk |
100x100 | 0.020022 | 5.238268 | 552 | plonk |
250x250 | 0.131477 | 45.467208 | 552 | plonk |
500x500 | 0.511738 | 194.538589 | 552 | plonk |
750x750 | 1.168737 | 409.672420 | 552 | plonk |
Flip vertical
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000438 | 0.032108 | 164 | groth16 |
100x100 | 0.025263 | 1.780565 | 164 | groth16 |
250x250 | 0.151733 | 11.315902 | 164 | groth16 |
500x500 | 0.577561 | 44.370405 | 164 | groth16 |
750x750 | 1.271395 | 98.629211 | 164 | groth16 |
10x10 | 0.000337 | 0.212584 | 552 | plonk |
100x100 | 0.023697 | 5.108784 | 552 | plonk |
250x250 | 0.128550 | 46.555842 | 552 | plonk |
500x500 | 0.516148 | 196.040625 | 552 | plonk |
750x750 | 1.302722 | 423.434726 | 552 | plonk |
Flip horizontal
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000339 | 0.032807 | 164 | groth16 |
100x100 | 0.025165 | 1.779391 | 164 | groth16 |
250x250 | 0.151705 | 11.252345 | 164 | groth16 |
500x500 | 0.573539 | 44.454817 | 164 | groth16 |
750x750 | 1.286226 | 97.416250 | 164 | groth16 |
10x10 | 0.000364 | 0.209765 | 552 | plonk |
100x100 | 0.024890 | 5.139028 | 552 | plonk |
250x250 | 0.129589 | 45.555273 | 552 | plonk |
500x500 | 0.529516 | 196.448008 | 552 | plonk |
750x750 | 1.277747 | 418.509681 | 552 | plonk |
AWS EC2 R6i.8xlarge
The performance is measured on AWS EC2 R6i.8xlarge instance, with 32 cores of CPU and 256 GB RAM.
Crop
Original Size | Final Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|---|
1000x1000 | 10x10 | 1.222113 | 9.566709 | 164 | groth16 |
1000x1000 | 100x100 | 1.332134 | 11.867060 | 164 | groth16 |
1000x1000 | 250x250 | 1.586844 | 15.038775 | 164 | groth16 |
1000x1000 | 500x500 | 2.093228 | 26.272559 | 164 | groth16 |
1000x1000 | 750x750 | 2.842832 | 44.283597 | 164 | groth16 |
1000x1000 | 10x10 | 1.229212 | 1.795641 | 552 | plonk |
1000x1000 | 100x100 | 1.261979 | 3.970322 | 552 | plonk |
1000x1000 | 250x250 | 1.456351 | 21.611674 | 552 | plonk |
1000x1000 | 500x500 | 1.761202 | 87.951785 | 552 | plonk |
1000x1000 | 750x750 | 2.346397 | 179.595832 | 552 | plonk |
Rotate 90
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000436 | 0.013531 | 164 | groth16 |
100x100 | 0.035593 | 0.700729 | 164 | groth16 |
250x250 | 0.240558 | 4.481683 | 164 | groth16 |
500x500 | 1.077919 | 18.052938 | 164 | groth16 |
750x750 | 2.789532 | 39.320327 | 164 | groth16 |
10x10 | 0.000399 | 0.034832 | 552 | plonk |
100x100 | 0.031410 | 2.310951 | 552 | plonk |
250x250 | 0.231774 | 20.129516 | 552 | plonk |
500x500 | 1.044570 | 86.554344 | 552 | plonk |
750x750 | 2.096873 | 179.017197 | 552 | plonk |
Rotate 180
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000426 | 0.013532 | 164 | groth16 |
100x100 | 0.033271 | 0.700266 | 164 | groth16 |
250x250 | 0.213916 | 4.478740 | 164 | groth16 |
500x500 | 0.991642 | 18.034648 | 164 | groth16 |
750x750 | 2.392543 | 39.346977 | 164 | groth16 |
10x10 | 0.000388 | 0.034530 | 552 | plonk |
100x100 | 0.030859 | 2.302974 | 552 | plonk |
250x250 | 0.195088 | 20.065690 | 552 | plonk |
500x500 | 0.957797 | 86.525879 | 552 | plonk |
750x750 | 1.890767 | 178.841983 | 552 | plonk |
Rotate 270
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000426 | 0.013532 | 164 | groth16 |
100x100 | 0.035587 | 0.702060 | 164 | groth16 |
250x250 | 0.235936 | 4.508860 | 164 | groth16 |
500x500 | 1.058893 | 18.016902 | 164 | groth16 |
750x750 | 2.614867 | 39.483353 | 164 | groth16 |
10x10 | 0.000422 | 0.034722 | 552 | plonk |
100x100 | 0.030940 | 2.327444 | 552 | plonk |
250x250 | 0.251121 | 20.095554 | 552 | plonk |
500x500 | 0.983313 | 86.533512 | 552 | plonk |
750x750 | 2.001720 | 178.963738 | 552 | plonk |
Flip vertical
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000411 | 0.013794 | 164 | groth16 |
100x100 | 0.033518 | 0.701648 | 164 | groth16 |
250x250 | 0.214629 | 4.464821 | 164 | groth16 |
500x500 | 0.862585 | 17.654768 | 164 | groth16 |
750x750 | 2.301371 | 39.314094 | 164 | groth16 |
10x10 | 0.000383 | 0.034891 | 552 | plonk |
100x100 | 0.030271 | 2.311931 | 552 | plonk |
250x250 | 0.249736 | 20.098645 | 552 | plonk |
500x500 | 0.943774 | 86.534147 | 552 | plonk |
750x750 | 1.861305 | 179.153519 | 552 | plonk |
Flip horizontal
Original Size | Circuit compilation (s) | Proving time (s) | Proof size (bytes) | Backend |
---|---|---|---|---|
10x10 | 0.000431 | 0.013625 | 164 | groth16 |
100x100 | 0.033055 | 0.700553 | 164 | groth16 |
250x250 | 0.215615 | 4.455576 | 164 | groth16 |
500x500 | 0.864279 | 17.795628 | 164 | groth16 |
750x750 | 2.405786 | 38.962204 | 164 | groth16 |
10x10 | 0.000377 | 0.035574 | 552 | plonk |
100x100 | 0.030420 | 2.313200 | 552 | plonk |
250x250 | 0.213769 | 20.033936 | 552 | plonk |
500x500 | 0.977586 | 86.531969 | 552 | plonk |
750x750 | 1.877458 | 178.855830 | 552 | plonk |