Errors printout define moved to wallet.h
This commit is contained in:
@@ -16,30 +16,29 @@
|
||||
#include "CCdice.h"
|
||||
|
||||
extern std::string CCerror;
|
||||
#define ERR_RESULT(x) result.push_back(Pair("result", "error")) , result.push_back(Pair("error", x));
|
||||
|
||||
// timeout
|
||||
|
||||
/*
|
||||
in order to implement a dice game, we need a source of entropy, reasonably fast completion time and a way to manage the utxos.
|
||||
|
||||
|
||||
1. CC vout locks "house" funds with hash(entropy)
|
||||
2. bettor submits bet, with entropy, odds, houseid and sends combined amount into another CC vout.
|
||||
3. house account sends funds to winner/loser with proof of entropy
|
||||
4. if timeout, bettor gets refund
|
||||
|
||||
|
||||
2. and 3. can be done in mempool
|
||||
|
||||
|
||||
The house commits to an entropy value by including the hash of the entropy value in the 'E' transaction.
|
||||
|
||||
|
||||
To bet, one of these 'E' transactions is used as the first input and its hashed entropy is combined with the unhashed entropy attached to the bet 'B' transaction.
|
||||
|
||||
|
||||
The house node monitors the 'B' transactions and if it sees one of its own, it creates either a winner 'W' or loser 'L' transaction, with proof of hash of entropy.
|
||||
|
||||
|
||||
In the even the house node doesnt respond before timeoutblocks, then anybody (including bettor) can undo the bet with funds going back to the house and bettor
|
||||
|
||||
|
||||
In order for people to play dice, someone (anyone) needs to create a funded dice plan and addfunding with enough utxo to allow players to find one.
|
||||
|
||||
|
||||
createfunding:
|
||||
vins.*: normal inputs
|
||||
vout.0: CC vout for funding
|
||||
@@ -73,7 +72,7 @@ loser:
|
||||
vout.1: tag to owner address for entropy funds
|
||||
vout.2: change to fundingpk
|
||||
vout.n-1: opreturn 'L' sbits fundingtxid hentropy proof
|
||||
|
||||
|
||||
winner:
|
||||
same as loser, but vout.2 is winnings
|
||||
vout.3: change to fundingpk
|
||||
@@ -81,12 +80,12 @@ winner:
|
||||
|
||||
timeout:
|
||||
same as winner, just without hentropy or proof
|
||||
|
||||
|
||||
WARNING: there is an attack vector that precludes betting any large amounts, it goes as follows:
|
||||
1. do dicebet to get the house entropy revealed
|
||||
2. calculate bettor entropy that would win against the house entropy
|
||||
3. reorg the chain and make a big bet using the winning entropy calculated in 2.
|
||||
|
||||
|
||||
In order to mitigate this, the disclosure of the house entropy needs to be delayed beyond a reasonable reorg depth (notarization). It is recommended for production dice game with significant amounts of money to use such a delayed disclosure method.
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user