ProvableHQ / welcome

👋 Welcome to Provable! Zero-Knowledge is Finally Here 🚀
https://provable.com
GNU General Public License v3.0
321 stars 217 forks source link

Clarify some details of view key generation. #199

Open acoglio opened 1 year ago

acoglio commented 1 year ago

In the description of view key generation, it is not clear to me what the following things are, exactly:

moAlobaidi commented 1 year ago

Hi @acoglio. Taking a look at this now-- would you be able to provide definitions of the referenced values and functions?

ghost commented 1 year ago

Hey @acoglio I also need some clarity on what these are. I'll follow-up with the protocol team e.g., @raychu86 and @howardwu and update this issue with their thoughts. It may take a few days, though.

ghost commented 1 year ago

From @raychu86:

Compute pk_sig := G^sk_sig.
Compute pr_sig := G^r_sig.
Compute sk_prf := HashToScalar(pk_sig || pr_sig).
Compute view_key := sk_sig + r_sig + sk_prf

The G^ and HashtoScalar here are done with public parameters, which is abbreviated pp .

In code its:

pub static ref GENERATOR_G: Vec<Group<Testnet3>> =
Testnet3::new_bases("AleoAccountEncryptionAndSignatureScheme0");
pub static ref POSEIDON_4: Poseidon4<Testnet3> = Poseidon4::
<Testnet3>::setup("AleoPoseidon4").expect("Failed to setup Poseidon4");

And then Address is derived from a view key like this: Compute address := G^view_key

cc @moAlobaidi @acoglio

acoglio commented 1 year ago

@moAlobaidi @aharshbe Thank you for helping to track this down. (And no, I don't know the definitions; I opened this issue both to get the doc improved and to understand the details myself.) I have some follow-up questions:

(As discussed at today's meeting, this level of detail may or may not be the goal for this developer documentation. The purpose of my questions is to get to an informal but precise specification, which would hypothetically suffice for a well-informed developer to implement account creation and other protocol calculations without looking at our Rust code.)