edicted Blog Banner

edicted

Deterministic Simulation

image.png

Hive needs a 'state' lottery.

What better way to prove our sovereignty than by creating a system that completely undermines the established status quo? All lotteries exploit the players and mathematically syphon money from the masses and funnel it into the hands of centralized agents.

This ends up being extremely hypocritical because the complexity of offering a game such as a lottery ends up being exceedingly simple. Notice how games of higher complexity are completely free. No one would play chess or checkers online if there was a cost. Poker should be free-to-play as well, but it never is. Why? Because money is changing hands. Whenever money is changing hands humans can't help but take a cut of the flow for themselves.

Hive is in a unique position in this regard.

I mean just look at most of the other blockchains out there. A fee is charged to post an operation on Bitcoin or Ethereum. Seeing as most of crypto is EVM chain based implies that fees are pretty much inescapable at the moment. Luckily our network allows users to yield farm that bandwidth as a derivative asset rather than charging the primary token. This is how we maintain 'free' transactions.


image.png

We can see here that the odds of winning the Powerball are one in almost three hundred million. With only eight billion people in the world that means if everyone played once... only 27 winners would exist on the average... out of the entire world. Luckily there are many more winners than that because people just keep buying tickets: especially when the jackpots are near all time highs.

Or perhaps "luck" has nothing to do with it.

Personally I've never played the lottery because I know exactly how bad the odds are. Still this doesn't seem to stop others from hoping to 'make it big' and escape the drudgery of their nine to five job. Statistics really should be a heavily required mathematics in school, as the real-world applications are far more numerous than any of the other mathematical disciplines.

And yet stats seems to be an outlier that many never even get exposed to. The conspiracy theorist inside me says this is because if everyone had a better understanding of statistics they'd know just how badly the current establishment exploits them. Can't have that.

Marbles on Stream

My original idea to create a lottery on Hive started out as a very basic concept. Bitcoin hashes would be used to seed the random numbers. This way the randomness of the game would be secure and completely unhackable (as long as the jackpot stays low enough so that Bitcoin miners don't throw block-rewards away in order to game the system).

However, a backend dice-roll is boring.

I can appreciate that players like to have a visual representation of the gambling experience. Something like Plinko would do quite nicely. Then I remembered Marbles on Stream which was viral on Twitch.TV for a hot minute. I couldn't help but wonder how obsessed people would be over a marble simulation like that which actually paid out real cash prizes (in the form of crypto) to the winners in a provably fair way. Truly the establishment is on borrowed time and crypto can do things that they just can't. It's only a matter of infrastructure.

Algodoo

The other day I was doing research on this idea once again and I came across this program called Algodoo. Rather than a 3D-simulation like Marbles on Stream it's a 2D physics engine that can do a lot of different things. Something like this would be perfect for the application in question.

Unfortunately then I realized that the devil is in the details.

There's certainly no reason to reinvent the wheel, but what if the wheel doesn't exist? There are tons of marble simulators and other physics engines online to draw from and copy, but how many of those are actually deterministic?

Deterministic?

In order for something like this to be decentralized everyone has to be able to run the simulation independently and everyone needs to get the same answer to come to consensus. It's an extension of crypto itself. Crypto accomplishes this, among other tactics, through the process of serialization. All the data is organized into a very particular order and format so no matter what operating system or hardware one is running: all machines will come to the same answer.

https://www.reddit.com/r/Algodoo/comments/kgh17h/why_does_the_angle_property_constantly_change/ https://www.reddit.com/r/Unity3D/comments/ivg2ye/how_would_you_go_about_creating_a_deterministic/

Further research on this topic in places like Reddit and Stackoverflow show that deterministic simulators are actually quite rare. Most will cite the unpredictability of floating-point logic as the cause but there are many other reasons for this as well. Not only can determinism make a simulation clunky and slow, it can also make it less random and less likely to create a Chaos-Theory effect, which is exactly the point of most simulations.

100% determinism means you can't use any nonfixed deltatime for calculation. You'll need a simulation backend that runs in discrete steps. This means you can't use Unity's physics solvers or animation system in any way that will affect the simulation since a lot of unity's systems inherently rely on the deltatime, and the physics system uses randomness to maintain stability (if I remember right). Your sim needs to be 100% a blackbox, meaning that animation & physics (plus other systems) must only receive simulation state but never ever feed back into it.

It's said floating point precision can also cause issues but this is only true if your simulation runs across multiple processors that don't use the same floating point architecture (for example multiplayer) but it's rare that this is the case - most modern processors use ‎IEEE 754 As long as your packets (in multiplayer) are guaranteed to arrive in order, you should be ok

float random = not_so_random

It's also important to note here that randomness doesn't truly exist in computers. Most random numbers are generated using algorithms that hash together multiple variables including time. Therefore the outputs appear random but can be reverse engineered if a hacker knows exactly how the algo works. Adding a financial incentive to crack the code guarantees this will happen eventually.

R-N Jesus be praised.

My COBO hardware wallet (that I never use) creates random numbers using a clever process that feeds imperfections of the physical device into the RNG process. Slight variances in voltage and whatever else are fed into the algorithm. A hacker would never be able to figure out exactly how much charge your battery has or things like that, so this ends up being a 'true random' solution that can't be reverse engineered. However this isn't super impressive because hardware wallets aren't supposed to connect directly to the Internet anyway (especially air-gapped ones).

diamond-eye-sauron-2.png

A final note on "Gambling"

Gambling has three prongs on a legal level

  1. Consideration (pay-to-play)
  2. Chance (games of skill aren't gambling)
  3. Prize (usually money)

Sweepstakes

A Sweepstake is when a company runs a lottery such as this but they eliminate the consideration variable of the equation. If players are allowed to play for free: then legally it is not gambling. The idea being that the marketing and promotion of the sweepstakes is more than worth the cost of it. Essentially it's an advertising model.

There's also a case to be made that it's not gambling if a centralized agent doesn't scoop money for themselves (this is how cardrooms in Oregon work) or games of skill (like poker) are not gambling. However it's much harder to argue these points to the regulators and the battles are constant.

I'm fairly certain that if something got built on Hive that didn't generate a profit but simply allowed users to gamble for free we'd get a lot of publicity out of that. Sure, plenty of gambling apps have been built here and elsewhere. I've yet to see one that was both compelling on the frontend and rake-free. Perhaps the incentives to build such a product simply do not exist.

Conclusion

We are living in an absurd digital world that hasn't caught up to speed yet. Over and over again, the same tactics of raking money into a centralized agents pockets occur. We call this 'value capture' in the corporation game. It is a necessary mechanic of legacy capitalism and current business models, but crypto will eventually break away from such things. It's not so different from what WEB2 did to WEB1. People like free service. The only question becomes: How does the value get captured if the service is free?


Return from Deterministic Simulation to edicted's Web3 Blog

Deterministic Simulation was published on and last updated on 06 Sep 2023.