Skip to content

perturbing/plutus-plonk-poc

Repository files navigation

plutonk

A plutus plonk verifier.

This repository will follow this repository (actually this particular fork). In light of this, this repository will only contain an onchain POC verifier (this is experimental work), no proofs are generated in this repository.

To run

This repository can be run via nix, to enter a dev shell use nix develop. In particular, these executables are of particular interest:

  1. nix run .#plutus-plonk:test:run-vector-test to check the implementations against the test vectors.
  2. nix run .#plutus-plonk:bench:run-bench to compile the fast implementation to UPLC (.flat) for further processing.
  3. nix run .#plutus-benchmark:exe:bench-exe to calculate the cpu/mem units of the tests in the plutus-benchmark package.

Benchmark of plonk

Run fast vanilla plonk verifier

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    -    3314  (20.2%)      3391083576  (33.9%)          226153   (1.6%) 

Benchmark of field implementation

These operations are over the scalar field of bls12-381 (255 bit prime field)

n scalars additions (size 31 bytes)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0      97   (0.6%)          897100   (0.0%)            4000   (0.0%) 
  400   16190  (98.8%)       570766300   (5.7%)         1326400   (9.5%) 
  800   32281 (197.0%)      1140635500  (11.4%)         2648800  (18.9%) 
  1200   48360 (295.2%)      1710504700  (17.1%)         3971200  (28.4%) 
  1600   64445 (393.3%)      2280373900  (22.8%)         5293600  (37.8%) 
  2000   80547 (491.6%)      2850243100  (28.5%)         6616000  (47.3%) 
  2400   96619 (589.7%)      3420112300  (34.2%)         7938400  (56.7%) 
  2800  112728 (688.0%)      3989981500  (39.9%)         9260800  (66.1%) 
  3200  128792 (786.1%)      4559850700  (45.6%)        10583200  (75.6%) 
  3600  144863 (884.2%)      5129719900  (51.3%)        11905600  (85.0%) 
  4000  160972 (982.5%)      5699589100  (57.0%)        13228000  (94.5%) 


n scalars multiplications (size 31 bytes)

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0      97   (0.6%)          897100   (0.0%)            4000   (0.0%) 
  400   16183  (98.8%)       553777719   (5.5%)         1328794   (9.5%) 
  800   32272 (197.0%)      1106696919  (11.1%)         2653594  (19.0%) 
  1200   48346 (295.1%)      1659616119  (16.6%)         3978394  (28.4%) 
  1600   64442 (393.3%)      2212535319  (22.1%)         5303194  (37.9%) 
  2000   80527 (491.5%)      2765454519  (27.7%)         6627994  (47.3%) 
  2400   96626 (589.8%)      3318373719  (33.2%)         7952794  (56.8%) 
  2800  112720 (688.0%)      3871292919  (38.7%)         9277594  (66.3%) 
  3200  128803 (786.2%)      4424212119  (44.2%)        10602394  (75.7%) 
  3600  144894 (884.4%)      4977131319  (49.8%)        11927194  (85.2%) 
  4000  160954 (982.4%)      5530050519  (55.3%)        13251994  (94.7%) 


n scalar exponentiation with exponent of size 32 bytes 

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     237   (1.4%)         1449100   (0.0%)            6400   (0.0%) 
    1     277   (1.7%)      1206603773  (12.1%)         2002151  (14.3%) 
    2     318   (1.9%)      2411758446  (24.1%)         3997902  (28.6%) 
    3     358   (2.2%)      3616913119  (36.2%)         5993653  (42.8%) 
    4     398   (2.4%)      4822067792  (48.2%)         7989404  (57.1%) 
    5     437   (2.7%)      6027222465  (60.3%)         9985155  (71.3%) 
    6     478   (2.9%)      7232377138  (72.3%)        11980906  (85.6%) 
    7     519   (3.2%)      8437531811  (84.4%)        13976657  (99.8%) 
    8     559   (3.4%)      9642686484  (96.4%)        15972408 (114.1%) 


scalar exponent for a^e if e = 2^n 

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     134   (0.8%)         1614552   (0.0%)            4604   (0.0%) 
    4     134   (0.8%)        10849754   (0.1%)           24649   (0.2%) 
    8     134   (0.8%)        20367710   (0.2%)           44695   (0.3%) 
   12     134   (0.8%)        30604618   (0.3%)           64767   (0.5%) 
   16     134   (0.8%)        40841526   (0.4%)           84839   (0.6%) 
   20     134   (0.8%)        51078434   (0.5%)          104911   (0.7%) 
   24     134   (0.8%)        61315342   (0.6%)          124983   (0.9%) 
   28     134   (0.8%)        71552250   (0.7%)          145055   (1.0%) 
   32     134   (0.8%)        81789158   (0.8%)          165127   (1.2%) 


n scalar inversion 

    n     Script size             CPU usage               Memory usage
  ----------------------------------------------------------------------
    0     233   (1.4%)         1587100   (0.0%)            7000   (0.0%) 
    1     274   (1.7%)      1210311776  (12.1%)         2007087  (14.3%) 
    2     314   (1.9%)      2419036452  (24.2%)         4007174  (28.6%) 
    3     354   (2.2%)      3627761128  (36.3%)         6007261  (42.9%) 
    4     394   (2.4%)      4836485804  (48.4%)         8007348  (57.2%) 
    5     435   (2.7%)      6045210480  (60.5%)        10007435  (71.5%) 
    6     475   (2.9%)      7253935156  (72.5%)        12007522  (85.8%) 
    7     515   (3.1%)      8462659832  (84.6%)        14007609 (100.1%) 
    8     554   (3.4%)      9671384508  (96.7%)        16007696 (114.3%) 

About

A POC repo for testing plonk in plutus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published