w3f / General-Grants-Program

Web3 Foundation General Grants Program
Apache License 2.0
603 stars 505 forks source link

RFP for frontrunning protection parachain #434

Closed mmagician closed 3 years ago

mmagician commented 3 years ago

Implement a frontrunning protection parachain by utilising commit-reveal

burdges commented 3 years ago

Isn't this more a pallet than a parachain?

There exist an commit-reveal design that works in sassafras and aura together with some messaging protocol, especially a mixnet, but requires zero amortized storage space:

  1. User sends 32 byte commitment to upcoming block producer.
  2. Block producer builds a Merkle tree of all received commitments and includes only the Merkle root. We include this commitment root in some easily referenceable place, like maybe an MMR.
  3. After block production, or maybe after finality, the block producer sends the user back their Merkle copath proving their commitment, so the users can prove commitments using the current MMR state or whatever.
  4. We never charge a fee for commits and do not pay block producers for including commitments since doing so represents negligible work and no space, but of course they drop excessive commits randomly. Reveals could pay them by convention if the parachain chooses this route, but maybe unnecessary.

As a rule, mempools should be replaced by users sending tx to specific collators, which becomes possible with sassafras and aura.

burdges commented 3 years ago

Actually my free commits idea has a problem that collators can simply commit to a wide range of options for free. We could explore off-chain solutions that prevent this free commits spam without charging fees probably, not sure how much design and development work avoiding one round of fees warrants.