Post
Topic
Board Gambling discussion
Re: bustabit.com - New seeding event
by
leomedina
on 29/02/2024, 05:16:24 UTC
Yeah, thanks, I probably missed it. It just looks like it needs lot of modules/dependencies for a "webrunning", which I don't need, so I'm transferring the code to the Node.JS format (I hope I'm close now, otherwise I'll think about re-writing the code into Python, someday Smiley ).

Just a question to a second part of code (generating vxSignature) :

Code:
import { bls12_381 as bls } from "@noble/curves/bls12-381";
import { concatBytes, utf8ToBytes } from "@noble/hashes/utils";

const VX_PUBKEY = "b40c94495f6e6e73619aeb54ec2fc84c5333f7a88ace82923946fc5b6c8635b08f9130888dd96e1749a1d5aab00020e4";

function validateSignature(
  gameSalt: string, // the hash of block 831500
  prevGameHash: Uint8Array,
  vxSignature: Uint8Array
) {
  const message = concatBytes(prevGameHash, utf8ToBytes(gameSalt));
  return bls.verify(vxSignature, message, VX_PUBKEY);
}

What is input for the validateSignature function, are they the results from the previous hash ? So, if I'm finding e.g. vxSignature for game #10002813, do I have to find and input here prevGameHash of game #10002812, and the vxSignature of this game as well?

Yeah, that's correct. We concatenate the previous game hash with our game salt, and ask Vx to sign the message. Vx gives us as a signature (which reveals the previous game to Vx) and then what that function does is to verify that the signature is authentic. By the way, there is also a crash demo here, in case you haven't seen it.