Giter VIP home page Giter VIP logo

drillx's Introduction

Drillx

Drillx is a proof-of-work algorithm for smart contract based cryptocurrency mining.

Summary

Drillx builds upon Equix, the CPU-friendly client puzzle designed to protect Tor from DOS attacks. Equix itself is a variation of Equihash, an asymmetric proof-of-work function with cheap verifications. Drillx adds a Keccak hashing step on top of Equix to guarantee a difficulty distribution of p(Z) = 2^-Z where Z is the number of leading zeros on the hash. A challenge C is assumed to be a securely generated 256-bit hash, seeded by a recent Solana blockhash. Miners compete to find a 64-bit nonce N that produces a hash of their target difficulty. Solutions must be presented in the form (E, N) where E = Equix(C, N). The difficulty is calculated from Keccak(E', N) where E' is the Equix proof, sorted lexographically to prevent malleability. Since E can be efficiently verified on-chain and Keccak is available as a Solana syscall, Drillx solutions can easily fit into a single Solana transaction.

Usage

Miners can iterate through nonces to find a hash that satisfies their target difficulty.

use drillx::{equix::SolverMemory, Solution};

fn main() {
    let challenge = [255; 32]; // Should be provided by a program
    let target = 8;
    let mut memory = SolverMemory::new();
    for nonce in 0..u64::MAX {
        let hx = drillx::hash_with_memory(&mut memory, &challenge, &nonce.to_le_bytes());
        if hx.difficuty() >= target {
            println!("Solution: {:?}", Solution::new(hx.d, nonce));
            return
        }
    }
}

Smart contracts can verify the solution and use the difficulty to issue token rewards.

use drillx::Solution;

fn verify(solution: Solution) {
    let challenge = [255; 32]; // Fetch from state
    let target = 8;
    assert!(solution.is_valid(&challenge));
    assert!(solution.to_hash().difficulty() >= target);
}

drillx's People

Contributors

hardhatchad avatar shekohex avatar mrmizz avatar simonlucalandi avatar benjasol avatar

Stargazers

Elias Judin avatar Anders Murphy avatar  avatar Hoanh An avatar wisfern avatar yqq avatar  avatar Panda avatar Nick B avatar Aliaksei avatar Javed Khan avatar  avatar Wu Xiaobo avatar Shulanaf avatar 0xrinegade avatar 骆明 avatar  avatar 0xandee avatar bing avatar zer0cool  avatar nico avatar 开来超 avatar David Kilcy avatar Andres Guerrero avatar 0xStone avatar Neverth Li avatar 4 avatar  avatar chanta avatar Andy Bao avatar Chiko avatar 🐙 avatar  avatar Asta(아스타) avatar  avatar dean avatar Tea Larson-Hetrick avatar brijeshagal avatar  avatar bt3gl avatar  avatar Nick Wan avatar ZhangLiaoXiaoqin avatar 锄禾 avatar Gauthier Leonard avatar  avatar pelavo avatar Sundeep Charan Ramkumar avatar Arihant Bansal avatar  avatar Moomoolo avatar 0x5459 avatar Sileo avatar wenlin42 avatar Stone Gao avatar Hardik sharma avatar mooryoung avatar  avatar Bob Niu avatar p.a.a.a.db.c.c.c avatar  avatar T avatar karl avatar Shun Kakinoki avatar Prasetyo Iman Nugroho avatar Shingai Thornton avatar amilz avatar  avatar Datt Goswami avatar David Leng avatar Val Allen Samonte avatar mmc avatar Mahmoud avatar  avatar feitian124 avatar seandong avatar sfter avatar Bruno Sanguinetti avatar Liangwei Li avatar Pratik Saria avatar NodeCattel avatar Brandt Cormorant avatar  avatar DearAndreLi avatar Mxsyx avatar  avatar  avatar Tony H Dillion avatar Robin J avatar  avatar  avatar Akio Nishimura avatar Et cetera avatar Owen avatar  avatar  avatar Zhe avatar Victor De Lomas avatar

Watchers

 avatar bing avatar 0xStone avatar  avatar  avatar  avatar  avatar

drillx's Issues

Feedback on DrillX

@HardhatChad I admire the design goal of thwarting ASICs so we can have PoW without obscene energy consumption. However, if that's the objective, then I would strongly advise against taking the "random operations all over the place" approach of RandomX. The only tool you need is an excessive memory footprint with random access patterns. It's OK if the instructions are easy to implement in an ASIC. What matters is how many transistors I need to construct that ASIC. It seems like you have about a MB of state? That can be tiled many times over in a commodity ASIC (or GPU for that matter), affording parallelism. What if you required a GB of state but you had a really simple hash algorithm that was much easier to scrutinize in a security audit? Or better yet, what if the state size were programmable, so for instance it could scale with Moore's Law, whether programatically or manually?

Why do I care? Because I think the long term value of Ore is to show the world that we don't need national energy budgets to secure financial transactions, even if one refuses to consider PoS. Ore doesn't necessarily need to be recognized as money in order to do so. Its value is substantial even as a gamified demonstration of this concept, and as such is worth the effort.

I'd be happy to write you the sort of hash I've described above, using well-characterized oscillators and a scalable footprint, but if you really want to go the RandomX route, then there are some potential problems with the code that need review.

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.