Hey everyone,
Today, I'm excited to share a new tool I've been working on, something a bit different from my usual Hive-specific scripts but definitely useful for a community I also love: tabletop roleplayers! Introducing the Ultimate Dice Roller, now live at:
https://dice.thecrazygm.com
We all love the feel of physical "click-clack math rocks," but when playing RPGs online (like over Discord, Roll20, etc.), we often rely on digital rollers. How do you really know they're fair and not just spitting out pre-determined numbers or being influenced in some way?
The goal of the Ultimate Dice Roller is to be provably fair. This means that every roll generates a cryptographic proof that can, in theory, be independently verified by anyone, assuring you that the outcome was truly based on the inputs and a transparent process.
The system uses a few key pieces of information to generate a roll:
Hereβs a simplified rundown of what happens when you roll:
client_seed
and a server_seed
. (Currently, for this proof-of-concept version, both of these are generated randomly for each interaction to demonstrate the mechanism).nonce
, are combined. Specifically, a message like client_seed:nonce
is created.server_seed
using a standard algorithm called HMAC-SHA256. This produces a unique, long hexadecimal string (the "proof").(number_from_hash % 20) + 1
for a d20).server_seed
it used, your client_seed
, the nonce
, the final proof
(hash), and of course, your dice results. With all these inputs, anyone can re-run the exact same calculation and verify that the dice results match the given proof.The provably_fair_roll
function in the backend takes these seeds and the nonce, creates the HMAC-SHA256 digest, and then deterministically derives the dice results from that digest.
Right now, as a proof of concept, the server_seed
and client_seed
are generated randomly by the application. The next big step to make this truly and transparently provably fair is to tie the seed generation to an external, unpredictable, and publicly verifiable source. My plan is to integrate this with the Hive blockchain by using hashes from the latest Hive blocks to generate the server_seed
(and potentially influence the client_seed
generation). This way, the "secret" server seed isn't just generated by my server but is derived from a public, immutable ledger.
I know, I know, it's not quite the same tactile joy as rolling your favorite set of magical lucky dice. But for online games, especially in Discord or other platforms where you need a quick, reliable, and trustworthy dice roll, I think this will be a great utility.
Here's a peek at the interface:
The tool features quick roll input (like 2d6+3
), dice cards for common types, and a roll history. And, of course, there's a page where you can take the details from any roll and verify the proof yourself .
Give it a whirl at https://dice.thecrazygm.com and let me know what you think! It's still a work in progress, especially with the Hive integration for seeds still to come, but the core provably fair mechanism is there to play with.
As always,
Michael Garcia a.k.a. TheCrazyGM
A long time ago, in STEEM days, @croupierbot basicly did what you are aiming for, but likely in a bit too slow way. In this post from 2017 outlines one of its previous use-cases.
The bot when invoked basicly anounced which not-yet-existing near-future block it was going to us for its randomness, then used the block signature in a repeatable way.
Working on a hash-based signatures project, I had been thinking of improving on this setup to allow for quicker access to randomness, and it is not that hard.
The trick is to:
Now after your seed is published, maybe something like 32 five-dice rolls would become verifyable.
Very cool tool, my friend, and I can see how this would be very useful for the RPG community. I love all your coding creativity. π π π β¨ π€
Appreciate this, just in time for playing some more games!
!PIMP
!PAKX
!PIZZA
View or trade
PAKX
tokens.Use !PAKX command if you hold enough balance to call for a @pakx vote on worthy posts! More details available on PAKX Blog.
$PIZZA slices delivered:
@ecoinstant(4/20) tipped @thecrazygm
Come get MOONed!
Congratulations @thecrazygm! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 32000 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP