{"id":25955393,"url":"https://github.com/panagiotisdrakatos/vdf4j","last_synced_at":"2026-02-12T13:37:52.640Z","repository":{"id":280150566,"uuid":"941106774","full_name":"PanagiotisDrakatos/VDF4J","owner":"PanagiotisDrakatos","description":"An implementation of Verifiable Delay Functions in Java","archived":false,"fork":false,"pushed_at":"2025-03-03T16:00:05.000Z","size":9703,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-17T04:02:51.083Z","etag":null,"topics":["beacon","blockchain","cybersecurity","distrubuted-systems","ethical-hacking","java","randomness","security","vdf","vdfs","verifiable-delay-functions","web3"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PanagiotisDrakatos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-01T14:01:48.000Z","updated_at":"2025-03-07T16:37:01.000Z","dependencies_parsed_at":"2025-03-01T16:29:41.271Z","dependency_job_id":null,"html_url":"https://github.com/PanagiotisDrakatos/VDF4J","commit_stats":null,"previous_names":["panagiotisdrakatos/vdf4j"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PanagiotisDrakatos/VDF4J","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PanagiotisDrakatos%2FVDF4J","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PanagiotisDrakatos%2FVDF4J/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PanagiotisDrakatos%2FVDF4J/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PanagiotisDrakatos%2FVDF4J/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PanagiotisDrakatos","download_url":"https://codeload.github.com/PanagiotisDrakatos/VDF4J/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PanagiotisDrakatos%2FVDF4J/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269201172,"owners_count":24377450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beacon","blockchain","cybersecurity","distrubuted-systems","ethical-hacking","java","randomness","security","vdf","vdfs","verifiable-delay-functions","web3"],"created_at":"2025-03-04T16:19:15.861Z","updated_at":"2026-02-12T13:37:47.615Z","avatar_url":"https://github.com/PanagiotisDrakatos.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003csup\u003eSpecial thanks my followers for supporting me:\u003c/sup\u003e\n\n\u003cdiv\u003e\n\u003cimg src=\"./logo.png\" width=\"230\" alt=\"Warp\" /\u003e\n\u003c/div\u003e\n\u003cb\u003e\nVDF4J A Verifiable Delay Function (VDF) is a function that requires substantial time to evaluate \n(even with a polynomial number of parallel processors) but can be very quickly verified as correct. \nVDFs can be used to construct randomness beacons with multiple applications in a blockchain\nnetwork environment.\n\u003c/b\u003e\n\u003cdiv\u003e\n\u003csup\u003eVisit \u003cu\u003ewarp.dev\u003c/u\u003e to learn more.\u003c/sup\u003e\n\u003c/div\u003e\n\n\n\u003chr /\u003e\n\n# VDF4J\n\n\u003ca href=\"\"\u003e![build-status](https://ci.appveyor.com/api/projects/status/github/PanagiotisDrakatos/vdf4j?branch=master\u0026svg=true)\u003c/a\u003e\n\u003ca href=\"\"\u003e[![Scc Count Badge](https://sloc.xyz/github/PanagiotisDrakatos/VDF4J/?category=lines)](https://github.com/PanagiotisDrakatos/VDF4J/)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub Repo stars](https://img.shields.io/github/stars/PanagiotisDrakatos/VDF4J?style=flat\u0026logoColor=green)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub followers](https://img.shields.io/github/followers/PanagiotisDrakatos?style=flat\u0026logo=green)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub forks](https://img.shields.io/github/forks/PanagiotisDrakatos/VDF4J?style=flat\u0026logoColor=green)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub watchers](https://img.shields.io/github/watchers/PanagiotisDrakatos/VDF4J?style=flat\u0026logoColor=green)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub contributors](https://badgen.net/github/contributors/PanagiotisDrakatos/VDF4J/)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub branches](https://badgen.net/github/branches/PanagiotisDrakatos/VDF4J/)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub language count](https://img.shields.io/github/languages/count/PanagiotisDrakatos/VDF4J?style=flat\u0026logo=green)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub releases](https://badgen.net/github/releases/PanagiotisDrakatos/VDF4J/)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/PanagiotisDrakatos/VDF4J?style=flat)\u003c/a\u003e\n\u003ca href=\"\"\u003e[![GitHub pull requests](https://img.shields.io/github/issues-pr/PanagiotisDrakatos/VDF4J.svg)](https://github.com/PanagiotisDrakatos/VDF4J/pulls)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub commit](https://badgen.net/github/commits/PanagiotisDrakatos/VDF4J)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/PanagiotisDrakatos/VDF4J/total?style=flat\u0026logo=green)\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/PanagiotisDrakatos/VDF4J?style=flat)\u003c/a\u003e\n\u003ca href=\"\"\u003e[![GitHub code-size](https://img.shields.io/github/languages/code-size/PanagiotisDrakato/VDF4J.svg)]()\u003c/a\u003e\n\u003ca href=\"\"\u003e![GitHub repo size](https://img.shields.io/github/repo-size/PanagiotisDrakatos/VDF4J?style=flat\u0026logo=green)\u003c/a\u003e\n\u003ca href=\"\"\u003e[![License](https://img.shields.io/badge/license-Apache-green.svg)](https://github.com/PanagiotisDrakatos/VDF4J/blob/master/LICENSE)\u003c/a\u003e\n\n\u003c/div\u003e\n\n## Table of Contents\n\n1. [Introduction](#introduction)\n2. [What Is a Verifiable Delay Function (VDF)?](#what-is-a-verifiable-delay-function-vdf)\n3. [Getting started](#Getting-started)\n4. [Java Example Code](#java-example-code)\n5. [Project Goals](#project-goals)\n6. [Directory Structure](#directory-structure)\n7. [Build \u0026 Run Instructions](#build--run-instructions)\n8. [Building Native Library](#building-native-library)\n    - [Linux Concept](#linux-concept)\n    - [Windows Concept](#windows-concept)\n9. [How It Works](#how-it-works)\n    - [Core Concept](#core-concept)\n    - [Computation Delay](#computation-delay)\n    - [Proof Generation \u0026 Verification](#proof-generation--verification)\n10. [Limitations \u0026 Future Work](#limitations--future-work)\n11. .[Legal Warning](#legal-warning)\n12. [Support](#support)\n13. [Note](#note)\n14. [Contribute](#contribute)\n15. [Authors](#authors)\n16. [License](#license)\n\n---\n\n## Introduction\n\n**VDF4J** is a Java-based **Verifiable Delay Function** (VDF) implementation, developed primarily for **educational and\nresearch** purposes for Adrestus cryptocurrency project.\nPart of the code is forked from previous libraries that failed to provide consistent and robust functionality, resulting\nin memory leaks and significant issues on the JVM.\nVDFs require a predetermined amount of **sequential** time to compute yet are very fast to verify, making them\nattractive for use cases like **blockchain consensus**, **randomness beacons**, and **anti-front-running measures**.\n\n---\n\n## What Is a Verifiable Delay Function (VDF)?\n\nThis VDF implementation is written in Java. The GMP library is used for arithmetic and greatest common divisor (GCD)\ncalculations. We use class groups to implement the\napproaches described in the following papers:\n\n1. \u003ca href=\"https://eprint.iacr.org/2018/627.pdf\"\u003eSimple Verifiable Delay Functions\u003c/a\u003e Pietrzak, 2018.\n2. \u003ca href=\"https://eprint.iacr.org/2018/623.pdf\"\u003eSimple Efficient Verifiable Delay Functions\u003c/a\u003e Wesolowski, 2018.\n\nA Verifiable Delay Function (VDF) is a function that:\n\n1. **Takes a certain minimum amount of time to compute** (no matter how many parallel processors you have, it cannot be\n   computed faster than some specified minimum time).\n2. **Generates a proof** that the output is correct.\n3. **Allows very rapid verification** of that proof, much faster than the time taken to compute the original function.\n\nIn practice, VDFs use repeated or iterative\ncryptographic operations (often exponentiation in a\ngroup with specific properties). The verification step\nuses cryptographic checks that confirm the original\ncomputation was done correctly. By introducing a time delay during evaluation, VDFs prevent malicious actors from\ninfluencing output. The output cannot be differentiated from a random number until the final result is computed.\nSee https://eprint.iacr.org/2018/712.pdf for more details.\n\n---\n\n## Getting started\n\nThe latest release is: [0.1.1](https://central.sonatype.com/artifact/io.github.l16h7n1n6s/VDF4J).\n\nIt is available in Maven Central\nas: [com.security.VDF4J:VDF4J:0.1.1](https://central.sonatype.com/artifact/io.github.l16h7n1n6s/VDF4J):\n\nJDK [21](https://www.oracle.com/java/technologies/javase/jdk21-archive-downloads.html) is required to build and run this\nproject.\n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.l16h7n1n6s\u003c/groupId\u003e\n    \u003cartifactId\u003eVDF4J\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.1\u003c/version\u003e\n\u003c/dependency\u003e\n\n```\n\n## Java Example Code\n\n```java\npublic class ExamplesTest {\n    private static byte[] challenge;\n    private static long difficulty;\n    private static Random random;\n\n    @BeforeAll\n    public static void Setup() {\n        challenge = new byte[20];\n        difficulty = 100;\n        random = new Random();\n        random.setSeed(200);\n    }\n\n    @Test\n    public void test_vdf_Pietrzak() throws NoSuchAlgorithmException {\n        random.nextBytes(challenge);\n        VdfEngine vdf = new VdfEnginePietrzak(2048);\n        byte[] solution = vdf.solve(challenge, difficulty);\n        assertEquals(\"0035e80b6a54563d78c34e365fd17f83fdb8946793b8d3c9fcda2bc257f57e806f72a8faee112a8b07c8cb4afa0d83a7f4e3bc87c4b2a63718a096f4bea1dc9fbb419c58131dc828ea9485ba24e8ef2ca5e68541545b859a106fc3d5da04ed6ede2614d7a7722334531cb4a8b9d6c2d50c68674c5e47b5eea2d89a720250fdf1d400134de5d604874b3c524a9ed4dfa4b892d8065d76f11d1d902561c56bc0960ed2f698caae3ab4c53e14b0cef2018313c6f4325944c44bebb56eb546871979b3242a938c9f3038e2ac2d9026b2c84867df2b2034aea6b2eec10c36b98975473a847cb004fb29a80e66777ed1e0feef4739b25a28defb6e1f7fc3e1e0985b2c6ecd\", Hex.toHexString(solution));\n        assertTrue(vdf.verify(challenge, difficulty, solution));\n        vdf.cleanup();\n    }\n}\n```\n\n## Project Goals\n\n1. **Illustrate VDF Principles**: Help developers and researchers understand the *mechanics* behind a verifiable delay\n   function.\n2. **Educational Resource**: Provide a clear, well-structured Java codebase as a learning tool.\n3. **Modular Implementation**: Lay the groundwork so contributors can improve or adapt VDF logic for different use\n   cases (blockchains, cryptographic protocols, etc.).\n\n\u003e **Important**: This implementation is intended for demonstration. It may not have production-grade security\n\u003e optimizations.\n\n---\n\n## Directory Structure\n\n- **src/main/java/**  \n  Contains the core Java source code implementing the VDF logic:\n    - VDF function (sequential computation logic)\n    - Proof generation/verification modules\n    - Testing/demo classes\n\n- **pom.xml**  \n  The Maven configuration file that defines build dependencies and plugins.\n\n- **appveyor.yml**  \n  Potential integration/build instructions for *AppVeyor* continuous integration (not always used in Java projects, but\n  can be adapted).\n\n- **dependency-reduced-pom.xml**  \n  An auxiliary Maven file generated during shading/assembly processes.\n\n- **LICENSE**  \n  MIT License details.\n\n- **README.md**  \n  You’re reading it!\n\n---\n\n## Build \u0026 Run Instructions\n\n### Prerequisites\n\n- **Java 8** or higher\n- **Maven** (3.x or newer) or any other environment that can handle a Maven project\n\n### Step-by-Step\n\n1. **Clone the Repository:**\n   ```bash\n   git clone https://github.com/PanagiotisDrakatos/VDF4J.git\n   cd VDF4J\n   ```\n2. **Build via Maven:**\n   This will compile the project and run any included tests.\n   ```bash\n   mvn clean install\n   ```\n3. **Run Demo Example (If Provided):**\n    ```bash\n    mvn -Dtest=MyTest ExamplesTest test\n    ```\n\nReplace com.example.vdf.Main with the actual main class path from the repository.\nThis example shows how you might launch a test or demonstration of the VDF functionality.\n\n## Building Native Library\n\nBelow are instructions for building the libgmp library\nthat ships with this module\n\n### 1.0 Linux\n\nThere is an included Dockerfile that can be used to compile libgmp with\n\nFirst build the Docker image. Navigate to\nthe \u003ca href=\"https://github.com/PanagiotisDrakatos/VDF4J/tree/master/src/nativeCode\" title=\"nativeCode lifestyles\"\u003e\nnativeCode\u003c/a\u003e folder of the project and run the following command:\n\n    docker build -t jnagmp-linux-x86-64 -f linux-x86-64.dockerfile .\n\nNext run the Docker image which will execute the [Makefile](Makefile.libgmp) and output the compiled library in to\n_src/main/resources_\n\n    docker run -v \"$(pwd)/src/main/resources:/build/src/main/resources\" -t jnagmp-linux-x86-64\n\nAfter running the above command, the compiled library will be available in the resources folder.\n\n### 2.0 Windows\n\n#### 1 Option: Using cygwin\n\n### Prerequisites\n\n- **Operating System**: Windows 7 or later (32-bit or 64-bit).\n- **Internet Connection**: Required to download the installer and select packages.\n- **Administrative Privileges**: Recommended for easier installation and future package management.\n\n---\n\n### Download Cygwin\n\n1. **Navigate to the official [Cygwin website](https://cygwin.com/).**\n2. **Choose the appropriate installer**:\n    - `setup-x86_64.exe` for 64-bit Windows\n    - `setup-x86.exe` for 32-bit Windows\n\n\u003e **Tip**: If you’re unsure of your system architecture, press `Windows Key + Pause/Break` to open system properties and\n\u003e check your system type.\n\n---\n\n### Run the Installer\n\n1. **Double-click** the downloaded `setup-x86_64.exe` (or `setup-x86.exe` for 32-bit).\n2. If prompted by **User Account Control (UAC)**, click **Yes** to allow changes.\n3. **Choose “Install from Internet”** (typical usage) when asked “Choose a Download Source.”\n\n---\n\n### Select Packages to install from Cygwin\n\n1. **i686-w64-mingw32-gcc**: For 32-bit Windows applications. Not exist on packet manger run version command to check it\n   on\n   cygwin\n2. **x86_64-w64-mingw32-gcc**: For 64-bit Windows applications. Not exist on packet manger run version command to check\n   it on\n   cygwin\n\n3. **mingw64-i686-gcc-g++** - The GNU Compiler Collection (C++ compiler). For 32-bit Windows applications.\n4. **mingw64-x86_64-gcc-g++** - The GNU Compiler Collection (C++ compiler). For 64-bit Windows applications.\n\n5. install cygwin on setup make sure all this installed\n6. **gcc-core** - The GNU Compiler Collection (C compiler).\n7. **gcc-g++** - The GNU Compiler Collection (C compiler).\n8. **libgcc** - The GNU Compiler Collection (C compiler).\n9. **make** - The GNU version of the 'make' utility.\n10. **autoconf** - A tool for automatically configuring source code.\n11. **automake** - A tool for automatically generating Makefile.in files.\n12. **libtool** - A generic library support script.\n13. **m4** - A macro processing language.\n14. **curl** - A tool to transfer data from or to a server.\n\nAdd the following to your PATH environment variable\n\n    C:\\cygwin64\\bin\n\nMake sure you have the following run:\n\n    i686-w64-mingw32-gcc --version For 32-bit Windows applications\n    x86_64-w64-mingw32-gcc --version For 64-bit Windows applications\n\nNavigate to the directory where you want to install run commands\n\n    cd /cygdrive/c/Users/User/mypath...\n\nRuns the following command to compile the library\n\n     cd gmp-6.3.0\n\nRun the following command to compile the library\n\n    ./configure --disable-static --enable-shared --host=x86_64-w64-mingw32\n\nOr better run this command to compile the library from a ready to use Makefile fro windows\n\n     make -f WindowsMakefile.libgmp install\n\nThen run the following command to move the files into the resources folder that the program reads\n\n    mv libgmp-10.dll libgmp.dll\n\n## How It Works\n\n### Core Concept\n\n1. **Input / Setup:**\n\n    - A challenge input (typically an integer, group element, or random data) is prepared.\n    - System parameters (e.g., group modulus for repeated squaring, number of iterations, etc.)\n      are established.\n2. **Iterated Computation:**\n    - The VDF function in this repository likely uses an iterative exponentiation or repeated squaring\n      approach— repeated many times to enforce a real-world time delay.\n    - Due to the nature of exponentiation in large number fields, parallelization beyond a certain\n      point doesn’t help reduce the overall sequential time.\n3. **Output + Proof:**\n    - After the heavy sequential computation, the\n      function returns a result plus a cryptographic\n      proof of correctness (often involving repeated\n      squaring proofs or isogenies, depending on the chosen VDF approach).\n      Computation Delay\n\n### Computation Delay\n\n- The key to a VDF is that computing the output\n  from the input must take at least t steps\n  (each step depends on the previous step’s result).\n\n- Even with many parallel processors, you cannot skip or batch these steps because each iteration relies on the output\n  of the previous iteration.\n  Proof Generation \u0026 Verification\n\n### Computation Delay\n\n- **Proof**: Typically involves additional\n  math that allows an observer to quickly confirm\n  that you actually performed all t steps.\n- **Verification**: By using cryptographic\n  checks (like checking an exponent or some tricky\n  modular arithmetic property), the proof is\n  validated in log(t) or similarly small complexity.\n\n## Limitations \u0026 Future Work\n\n1. **Security Hardening:**\n   For real-world usage, consider larger parameters or proven secure group settings (e.g., class groups,\n   pairing-friendly curves, incremental exponentiation in large prime fields, etc.).\n2. **Performance Tuning:**\n   The Java code works for a demonstration; you may want advanced libraries or native bindings for enhanced big-integer\n   arithmetic.\n3. **Expand Proof Options:**\n   Different VDF constructions exist (e.g., Wesolowski’s proof, Pietrzak’s proof). This project could implement or\n   compare multiple proof schemes.\n4. **Benchmarking:**\n   Adding thorough benchmarks to measure performance under various iteration counts, machine architectures, or\n   concurrency scenarios would be beneficial.\n\n5. **Integration with Other Projects:**\n   Useful for demonstrating real ownership or usage in blockchains or distributed systems needing\n   delayed computations\n\n## Legal Warning\n\nWhile this may be helpful for some, there are significant risks. VDF4J may be used only for\nEducational Purposes. Do not use it for illegal purposes! You could go to jail if if you will use it for\nmalicious purposes.\n\n## Support\n\nFor support, email panagiotisdrakatos@gmail.com or join me Discord:panos5427.\nMeaning, if you liked using this app or it has helped you in any way,\nI'd like you send me an email about anything you'd want to say about this software.\nI'd really appreciate it!\n\n## Note\n\n- ⭐️ Give me a Star!! VDF4J is constantly updating, support us!\n- The analysis was done by me, without having obfuscated the source code (either with pyarmor etc),\n- I would not recommend using VDF4J + obfuscatebecause many times av trigger obfuscated codes as false positive\n  even if legitimate.\n\n## Contribute\n\n1. Fork it: git clone https://github.com/PanagiotisDrakatos/VDF4J.git\n2. Create your feature branch: ```git checkout -b my-new-feature```\n3. Commit your changes: ```git commit -am 'Add some feature'```\n4. Push to the branch: ```git push origin my-new-feature```\n5. Submit a pull request\n\n## Authors\n\n- [@panagiotisdrakatos](https://github.com/PanagiotisDrakatos)\n\n# License\n\nThis project is distributed under the MIT license version 2.0 (see the LICENSE file in the project root).\n\nBy submitting a pull request to this project, you agree to license your contribution under the MIT license version 2.0\nto this project.\n\n[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanagiotisdrakatos%2Fvdf4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanagiotisdrakatos%2Fvdf4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanagiotisdrakatos%2Fvdf4j/lists"}