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

  1. Build and install the binary
    go install .
    
  2. 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:

  1. Clone the maya-cli repository
    git clone https://github.com/0xmayalabs/maya-cli.git
    
  2. Cd into the directory
    cd maya-cli
    
  3. 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
    
  4. 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:

  1. Clone the maya-cli repository
    git clone https://github.com/0xmayalabs/maya-cli.git
    
  2. Cd into the directory
    cd maya-cli
    
  3. 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
    
  4. 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:

  1. Clone the maya-cli repository
    git clone https://github.com/0xmayalabs/maya-cli.git
    
  2. Cd into the directory
    cd maya-cli
    
  3. 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
    
  4. 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:

  1. Clone the maya-cli repository
    git clone https://github.com/0xmayalabs/maya-cli.git
    
  2. Cd into the directory
    cd maya-cli
    
  3. 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
    
  4. 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:

  1. Clone the maya-cli repository
    git clone https://github.com/0xmayalabs/maya-cli.git
    
  2. Cd into the directory
    cd maya-cli
    
  3. 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
    
  4. 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:

  1. Clone the maya-cli repository
    git clone https://github.com/0xmayalabs/maya-cli.git
    
  2. Cd into the directory
    cd maya-cli
    
  3. 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
    
  4. 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:

  1. Clone the maya-cli repository
    git clone https://github.com/0xmayalabs/maya-cli.git
    
  2. Cd into the directory
    cd maya-cli
    
  3. 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
    
  4. 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 SizeFinal SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Verifying Key size (bytes)Backend
1000x100010x100.86043515.98471616410056groth16
1000x1000100x1000.80789519.217036164960456groth16
1000x1000250x2500.88617331.3158201646000456groth16
1000x1000500x5001.17680859.44470216424000456groth16
1000x1000750x7501.628575105.43200516454000456groth16
1000x100010x100.9210031.311369552536plonk
1000x1000100x1000.7371136.266179552536plonk
1000x1000250x2500.84697346.563869552536plonk
1000x1000500x5001.030190200.574828552536plonk
1000x1000750x7501.731226412.768052552536plonk

Rotate 90

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0004340.033605164groth16
100x1000.0281841.699871164groth16
250x2500.17122910.918394164groth16
500x5000.64775743.215272164groth16
750x7501.42175394.541931164groth16
10x100.0002470.200214552plonk
100x1000.0204755.128606552plonk
250x2500.13487645.082718552plonk
500x5000.558636196.608304552plonk
750x7501.592956421.920696552plonk

Rotate 180

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0003770.032683164groth16
100x1000.0252771.788267164groth16
250x2500.15346211.111391164groth16
500x5000.58002145.384939164groth16
750x7501.33127694.734796164groth16
10x100.0003380.199782552plonk
100x1000.0220965.186410552plonk
250x2500.13062245.474365552plonk
500x5000.513307194.285966552plonk
750x7501.142496425.788482552plonk

Rotate 270

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0004510.033596164groth16
100x1000.0252711.744991164groth16
250x2500.15159111.086174164groth16
500x5000.59460743.656017164groth16
750x7501.33482796.234792164groth16
10x100.0002540.205031552plonk
100x1000.0200225.238268552plonk
250x2500.13147745.467208552plonk
500x5000.511738194.538589552plonk
750x7501.168737409.672420552plonk

Flip vertical

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0004380.032108164groth16
100x1000.0252631.780565164groth16
250x2500.15173311.315902164groth16
500x5000.57756144.370405164groth16
750x7501.27139598.629211164groth16
10x100.0003370.212584552plonk
100x1000.0236975.108784552plonk
250x2500.12855046.555842552plonk
500x5000.516148196.040625552plonk
750x7501.302722423.434726552plonk

Flip horizontal

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0003390.032807164groth16
100x1000.0251651.779391164groth16
250x2500.15170511.252345164groth16
500x5000.57353944.454817164groth16
750x7501.28622697.416250164groth16
10x100.0003640.209765552plonk
100x1000.0248905.139028552plonk
250x2500.12958945.555273552plonk
500x5000.529516196.448008552plonk
750x7501.277747418.509681552plonk

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 SizeFinal SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
1000x100010x101.2221139.566709164groth16
1000x1000100x1001.33213411.867060164groth16
1000x1000250x2501.58684415.038775164groth16
1000x1000500x5002.09322826.272559164groth16
1000x1000750x7502.84283244.283597164groth16
1000x100010x101.2292121.795641552plonk
1000x1000100x1001.2619793.970322552plonk
1000x1000250x2501.45635121.611674552plonk
1000x1000500x5001.76120287.951785552plonk
1000x1000750x7502.346397179.595832552plonk

Rotate 90

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0004360.013531164groth16
100x1000.0355930.700729164groth16
250x2500.2405584.481683164groth16
500x5001.07791918.052938164groth16
750x7502.78953239.320327164groth16
10x100.0003990.034832552plonk
100x1000.0314102.310951552plonk
250x2500.23177420.129516552plonk
500x5001.04457086.554344552plonk
750x7502.096873179.017197552plonk

Rotate 180

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0004260.013532164groth16
100x1000.0332710.700266164groth16
250x2500.2139164.478740164groth16
500x5000.99164218.034648164groth16
750x7502.39254339.346977164groth16
10x100.0003880.034530552plonk
100x1000.0308592.302974552plonk
250x2500.19508820.065690552plonk
500x5000.95779786.525879552plonk
750x7501.890767178.841983552plonk

Rotate 270

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0004260.013532164groth16
100x1000.0355870.702060164groth16
250x2500.2359364.508860164groth16
500x5001.05889318.016902164groth16
750x7502.61486739.483353164groth16
10x100.0004220.034722552plonk
100x1000.0309402.327444552plonk
250x2500.25112120.095554552plonk
500x5000.98331386.533512552plonk
750x7502.001720178.963738552plonk

Flip vertical

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0004110.013794164groth16
100x1000.0335180.701648164groth16
250x2500.2146294.464821164groth16
500x5000.86258517.654768164groth16
750x7502.30137139.314094164groth16
10x100.0003830.034891552plonk
100x1000.0302712.311931552plonk
250x2500.24973620.098645552plonk
500x5000.94377486.534147552plonk
750x7501.861305179.153519552plonk

Flip horizontal

Original SizeCircuit compilation (s)Proving time (s)Proof size (bytes)Backend
10x100.0004310.013625164groth16
100x1000.0330550.700553164groth16
250x2500.2156154.455576164groth16
500x5000.86427917.795628164groth16
750x7502.40578638.962204164groth16
10x100.0003770.035574552plonk
100x1000.0304202.313200552plonk
250x2500.21376920.033936552plonk
500x5000.97758686.531969552plonk
750x7501.877458178.855830552plonk