1

So I just started learning and trying to code this project and learn through the process and I might have landed in a bit of a complex situation. The idea is about "blind lowest bid wins" the product of the day (which is going to be a NFT). Each day the auction starts at 12 AM (or when a function for simplicity since we don't want to involve Oracles).

I was thinking of a mapping with key as bids and then values as address and bool indicating if it's unique. But with 2 decimal points for every number it runs to millions of values. What is the best and efficient way to store these, find the address with lowest unique bid as well as the bid value for the day, flush out and start fresh at 11.59PM the next day.

tl;dr: store all bids and addresses and find the lowest unique bid (while hiding the value of the bids), announce winner and flush out the values when the next day's auction begins. What's the best way to store this using Mapping and array?

3
  • The bigger issue seems to be that you want to store the bids but somehow keep them secret. It seems to me this would require a commit/reveal scheme, with the reveal step happening the next day.
    – user19510
    Feb 28 '18 at 23:01
  • During the reveal phase, you'll have an incentive problem: why should someone reveal a losing bid? So if someone reveals a low bid of 0, even if there are duplicates, the people who can prove they submitted the same bid have no incentive to do so. (They'll lose anyway and have to pay for gas just to prove the other 0 isn't a winner.)
    – user19510
    Feb 28 '18 at 23:03
  • A deposit that's forfeited if someone doesn't reveal their bid can address the incentive problem.
    – user19510
    Feb 28 '18 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.