Updated Dice/Card Oracle

in Synergy Builders2 days ago (edited)

Hey everyone,

I'm back with another update, this time focusing on some performance issues with our Discord bot.

image.png

The ever-vigilant @ecoinstant pointed out that the bot wasn't responding to games like it used to. I immediately looked into it and found that the core problem was the API calls to the Hive nodes were sometimes not "quick enough." When the node response lagged, it caused the games to fail or time out, leading to a frustrating experience.

After spending a bit of time adjusting timeouts and tweaking error handling, which provided only marginal improvements, I decided it was time for a more fundamental change. I needed to change the oracle for the deterministic results.

The New Oracle: Faster, Simpler, Stronger

The solution involved a shift away from the previous, more complex method. The new system is far simpler: it now uses the getStatus API call on Hive-Engine nodes and relies on a single API call for its result.

This new approach made a world of difference. Since we are using the status of the Hive Engine side, which includes the last processed block, and the game roll itself is not a transaction, I don't need to include the previous block hash in the request.

However, to ensure truly unique and deterministic results, especially if multiple people roll at the exact same time, I still add a small salt value to the user's request. This ensures that even in simultaneous events, the final random seed remains distinct.

Here is a look at it in use:

Damn! That's an Amazing Poker Hand!

This makes the oracle faster, more reliable, and still entirely transparent and verifiable.

barkeep.png

ledger.png

seer.png

Come Join the Conversation!

Want to see the new oracle in action, suggest a feature, or just hang out?

As always,
Michael Garcia a.k.a. TheCrazyGM

Sort:  

I used to create all sorts of complex system interactions. Over time, I came to really appreciate simplicity, so that's my modus operandi now, to keep things as simple as possible. Nice job on getting your Discord bot working correctly again! 😁🙏💚✨🤙

I really appreciate this update! And its WAY faster now too!

!PAKX
!PIMP
!PIZZA

View or trade PAKX tokens.

@ecoinstant, PAKX has voted the post by @thecrazygm. (1/2 calls)

Use !PAKX command if you hold enough balance to call for a @pakx vote on worthy posts! More details available on PAKX Blog.

PIZZA!

$PIZZA slices delivered:
@ecoinstant(1/20) tipped @thecrazygm

Come get MOONed!