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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Random number generator primitives for Leo #2387

Open
matthewdgreen opened this issue May 18, 2023 · 1 comment
Open

[Feature] Random number generator primitives for Leo #2387

matthewdgreen opened this issue May 18, 2023 · 1 comment
Labels
feature A new feature.

Comments

@matthewdgreen
Copy link

馃殌 Feature

Right now there is no feature for generating random elements during program execution (by a prover) in Leo.

Motivation

The ability to generate random elements would be useful for different applications in Leo. However, the challenge here is that there are different kinds of randomness with different qualities, and these shouldn't be mixed up.

  1. Generating random elements (field elements, strings, numbers, groups) by the prover. This randomness is very useful for things like generating ciphertexts in Leo code. However the randomness cannot be trusted by any other user, since prover-generated randomness can be arbitrarily biased.
  2. Generating unpredictable elements based on chain randomness. This could simply be Poseidon(block hash). This randomness is "public" and cannot be hidden. Moreover it can't be fully trusted by all parties, but should be slightly resistant to bias.
  3. Secure randomness interactively generated with other parties (using commit/reveal coin flipping.) This requires pieces outside of Leo/SnarkVM/Aleo and isn't directly relevant. I'm just listing it here to be thorough.

It would be very useful if Leo could provide a command to generate (at least) the randomness listed in #1 above, so that it's easy to generate ciphertexts. Maybe this should be strongly labeled so that developers will understand the limitations of it.

Implementation

The proposal is to provide a generateProverRandom() method to generate random elements of various types. This randomness would be chosen during program execution, and could then be used during execution of the Aleo program.

@matthewdgreen matthewdgreen added the feature A new feature. label May 18, 2023
@joengelh
Copy link

joengelh commented Sep 6, 2023

Yes i agree, that would be immensely useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature.
Projects
None yet
Development

No branches or pull requests

2 participants