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

option to autoReveal bets by external parrty #9

Open
szerintedmi opened this issue Jun 30, 2017 · 1 comment
Open

option to autoReveal bets by external parrty #9

szerintedmi opened this issue Jun 30, 2017 · 1 comment
Assignees

Comments

@szerintedmi
Copy link
Member

szerintedmi commented Jun 30, 2017

Users should have the option to ask for auto reveal their bets.
Should be set by default. Disable should be a non-emphasized option on UI for security conscious users who don't want to trust a 3rd party

How

  1. Encrypt bet + random salt on client side with Oraclize public key (using their API)
  2. Schedule a reveal callback with Oraclize in LupiManager to the bettingPeriodEnds time
  3. On __callback call Lupi.revealBetForAddress

Notes

  • Only will work with Oraclize when there is no ticketCountLimit set
  • how to handle costs? ie. callback cost is paid from contract balance
@szerintedmi
Copy link
Member Author

szerintedmi commented Jun 30, 2017

szerintedmi @szerintedmi 12:39
we store the bid encrypted with user’s secret key. at reveal user sends unencrypted bid and their secret key. we verify it against the stored one.

Marco Giglio @marcogiglio 12:39
ok I understood, I was thinking of something else. That's a bit inefficient.. you could store all the encrypted bids in a string, using strconcat and then make only one oraclize_query and receive only one callback with everything decrypted
you can used the nested datasource for that
and have many decrypt ds query nested inside

Marco Giglio @marcogiglio 12:46
and offcourse, that oraclize_query would be at the end of the bidding process
the only drawback would be that the last bidders will pay a bit more gas because of the cost of executing the function oraclize_query

Marco Giglio @marcogiglio 12:51
oraclize_query("nested", "[URL] ['json(https://api.random.org/json-rpc/1/invoke).result.random.data.0', '\\n{\"jsonrpc\":\"2.0\",\"method\":\"generateSignedIntegers\",\"params\":{\"apiKey\":${[decrypt] BIm/tGMbfbvgqpywDDC201Jxob7/6+sSkRBtfCXN94GO0C7uD4eQ+aF+9xNJOigntWu8QHXU6XovJqRMEGHhnEnoaVqVWSqH1U1UFyE6WySavcbOb/h8hOfXv+jYBRuhkQr+tHXYrt1wx0P0dRdeCxbLp1nDuq8=},\"n\":1,\"min\":1,\"max\":10000${[identity] \"}\"},\"id\":1${[identity] \"}\"}']", ORACLIZE_GAS_LIMIT + safeGas);
https://gist.github.com/marcogiglio/72beccc1a48ef944e8c8b8f8aa9b8cd0

an example of nested and decrypt usage

@szerintedmi szerintedmi self-assigned this Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant