How to implement a decentralized counterparty for a bankroll without an owner

From Democratic Money wiki

Decentralized random number generation algorithms exist. They are P2P networks that allow anyone to supply a process to the network and join it, and the P2P network as a whole periodically produces random numbers that are accompanied by some sort of mathematical proof that they were indeed originated by that network.

Now, there must be a way to supply those random numbers to an immutable smart contract, in such a way that the contract can verify that the random numbers are indeed random and authentic because they come from that network.

If the random oracle algorithm is good, then we can be sure, somehow, that someone honest in the network is going to altruistically supply the result to the smart contract. That's easier if the transaction fees in the blockchain are very low.

Now, the contract has a bankroll, which it manages. The bankroll is actually owned by the smart contract. It's locked there forever. The only way to subtract from the bankroll is by playing a betting game against the contract and winning the bet.

The contract takes transfers from anyone. The transfer is an implicit bet: the transfer amount is the bet size and the sender's address or the transaction ID are used to determine what the bet is (e.g. whether either of those are an odd or even number). As long as the contract can cover the bet, it accepts the bet (block height/time, bet size, outcome being bet on), and records it for later.

When the contract receives a random number, it receives it at some block height/time T. What it does then is resolve ALL pending bets that are older than T-D, where D is some time delay. E.g. if the random number received is odd, then ALL bets older than T-D that bet on an "odd" outcome win, and ALL bets older than T-D that bet on an "even" outcome lose.

The interval "D" could be something like an hour. What D means is that once the random oracle decides on a random number, then there is an interval of time between that number being known and that number being included in a block and reaching the contract. During that interval, in theory, someone could place a bet, and then proceed to DDoS the oracle and/or the blockchain to delay the inclusion of the random oracle's result. If the attack delays the processing of the random oracle's result by more than D, then it is possible to cheat. But it is unlikely that such an attack would succeed if D is sufficiently large. The system is not intended for real-time betting and is more of a lottery.

Bettors can pay transaction fees to force the contract to withdraw their winnings (if they won), or some other process can pay the transaction fees on behalf of the winners and force the payouts to everyone. For example, when players send a bet, that transaction can also pay any pending winnings back to them, or add their pending winnings into the bet amount that's being sent.

The game the contract plays can be a non-profit 50/50 odds betting game with no "house edge." There's an edge for ruin, and there's an edge in transaction fees, but neither the player nor the bankroll itself has an edge over the other.

Since it is possible to buy large amounts of G$ right now from the GoodDollar reserve, it would be awesome if people donated their massive G$ hoards from early G$ reserve purchases to create the largest, most secure, unstoppable/uncensorable non-profit casino on Earth. Why would anyone play betting games anywhere else? Why enrich casino operators, when you can have 50/50 odds where you win no matter the result? Either you get extra G$, or you lock G$ away and reinforce this ultimate casino.

The casino contract would be on FUSE; everything would happen on FUSE (, where fees are nonexistent for users and the TPS is high.