Using plonky2 to prove the transformations over attested images
This project goal is to make image transformations authentication secure and practical. The main features that help achieve it are as follows:
- Using plonky2 and it's highly optimized Poseidon gates.
- Describing and implementing the algorithm of chunked proving.
- Swapping the hash algorithm from default SHA-256 to ZK-friendly one - Poseidon
The project is in development. Currently, it can prove and verify the crop operation of the arbitrary png images in fast time.
The benchmark of proving the Crop operation for various-sized images can be seen bellow.
Resolution | 256×256 | 700×700 | 1520×934 | 2048×1080 |
---|---|---|---|---|
File size | 256 KB | 1.86 MB | 5.41 МB | 8.43 МB |
Circuit build, seconds | 2 | 12 | 32 | 36 |
Prover time, seconds | 3 | 16 | 37 | 54 |
Verifier time, seconds | <0.1 | <0.1 | <0.1 | <0.2 |
RAM consumption | ~480 MB | ~5.1 GB | ~6.2 GB | ~9.3 GB |
Proof size | 130 KB | 132 KB | 133 КB | 135 KB |
cargo run --release -- prove -i <orig-img-path>
These will create the file metadata.json, which will contain the compressed proof in binary and some other data.
cargo run --release -- verify -e <edited-image-path> -m <metadata-path>
Feel free to reach out if you have any questions or want to contribute.