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

implement PrimeHash game for plasma prime #39

Open
snjax opened this issue Nov 4, 2018 · 0 comments
Open

implement PrimeHash game for plasma prime #39

snjax opened this issue Nov 4, 2018 · 0 comments

Comments

@snjax
Copy link
Contributor

snjax commented Nov 4, 2018

PrimeHash game for Plasma Prime

We need to use the mapping between integers and prime numbers for some cases in Plasma Prime:

  • calculating $H_{prime}$ for Wesolowski proof
  • calculating prime numbers for each coin

Also, it will be useful if we can use it without any precomputations in lazy mode.
I propose to use something like truebit protocol for deterministic mapping any uint256 number (excluding 0 and 1) to a prime number.

Let's determine
$ Prime(I) := \max(n: 1 < n \leq I; n \in P) $.

We do not use any better computable subsets in the set of prime numbers, because it brings us additional work in the contract, as you can see below. $Prime(I)$ is not complicated to compute offchain for any 256bit I (not only PC but also cell phones are OK).

We can enumerate all plasma dust coins as $Prime(I*offset)$ and use not only $2^{40}$, but also $2^{50}$ or more dust coins and do not need to store the data anywhere.

Also we can use $PrimeHash(x) := Prime(keccak256(x))$ for $H_{prime}$ calculation.

For onchain cases let's use the game:

prime game

The game is simply generalizable for calculation with multiple prime numbers (it is enough to challenge one value to reject the calculation).

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

No branches or pull requests

1 participant