Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Proof of Work #74

Open
tsunrise opened this issue Oct 7, 2021 · 4 comments · May be fixed by #75
Open

Add Proof of Work #74

tsunrise opened this issue Oct 7, 2021 · 4 comments · May be fixed by #75

Comments

@tsunrise
Copy link
Member

tsunrise commented Oct 7, 2021

Looks that arkworks does not have the implementation of proof of work (even the simplest one). We can probably add one here (use the one similar to libiop? )

We can use existing CRH trait to make it generic. Also, we will need to write the constraints. (For now all CRH has its constraints written, so we just need to wrap it.)

"one line algo"

For a message M and difficulty k, the prover will bruteforce a nonce N such that the last k bits of the output of H(M || N) are zero.

@Pratyush
Copy link
Member

Pratyush commented Oct 7, 2021

The constraints version is fairly easy, right? Just check the output of H(M||N) contains k trailing zeros.

@tsunrise
Copy link
Member Author

tsunrise commented Oct 7, 2021

The constraints version is fairly easy, right? Just check the output of H(M||N) contains k trailing zeros.

Yes, should be. Just some constraints for CRH + constraints to enforce k trailing zeros

@Pratyush
Copy link
Member

Pratyush commented Oct 7, 2021

@tsunrise, @alexchmit pointed out that for PoW it does not suffice to use a CRH. Rather we have to use something that is RO like. I think for this we would have to create a "Cryptographic Hash Function" primitive that achieves these properties. Then you can instantiate it with the existing Blake2s and Poseidon implementations. I imagine the interface is going to be fairly simple:

pub trait CryptoHash {
	type Parameters;
	type Input;
	type Output;
	fn setup(&mut rng) -> Self::Parameters;
	fn hash(params: &Self::Parameters, input: &Self::Input) -> Self::Output;
}

Similarly for the gadget version.

@tsunrise
Copy link
Member Author

tsunrise commented Oct 7, 2021

Got it, will send a PR here later. Thanks!

@tsunrise tsunrise linked a pull request Oct 8, 2021 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants