Giter VIP home page Giter VIP logo

evmvdf's Introduction

Delay Function Verification Smart Contract

This is a PoC level code. Do not use it.

VDFVerify.sol smart contract verifies Wesolowski VDF in 2048 bit RSA setting.

Hash to Prime

We used the hash to prime variant defined in section 7 of BBF19 where prover picks a nonce from small set and appends it to the transcript until they hit a prime number as hash result. Prover sends the nonce along with the proof to the verifier so that verifier performs single primality test.

Cost in Berlin EVM

operation cost in gas
verify VDF 173062
verify VDF with base and calldata 207827
modexp (2048,256,2048) 87012
modexp (256,256,256) 1666
mul2048 13519
miller rabin 15 30994

References

evmvdf's People

Contributors

kilic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

alfredolopez80

evmvdf's Issues

Is it possible to use EIP-192 precompile?

Is it possible to use EIP-192 precompiled smart contract to make verification even cheaper? https://github.com/ethereum/EIPs/blob/master/EIPS/eip-198.md

Rationale

This allows for efficient RSA verification inside of the EVM, as well as other forms of number theory-based cryptography. Note that adding precompiles for addition and subtraction is not required, as the in-EVM algorithm is efficient enough, and multiplication can be done through this precompile via a * b = ((a + b)**2 - (a - b)**2) / 4.

The bit-based exponent calculation is done specifically to fairly charge for the often-used exponents of 2 (for multiplication) and 3 and 65537 (for RSA verification).

Verification test fails if t is set greater than 7

If I modify t in the vdf.test.ts verification test and set it above 7 the test will fail (if set to 7 the test still passes).
The same behaviour seems to be present in the verify function of vdf.ts as well as the smart contract.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.