Have you seen the new verifier I wrote? It runs in the browser and already does what you're asking for (uses a vxSignature to calculate game results). Take a look at
this file to see how you could do it.
Thanks, that TypeScript looks great! Just tell me, please, (from) where should I import
./constants,
./utils/math and
./utils/vx ? Thanks!
You could just copy those from the verifier, they are all there. Just make sure you import the right dependencies and it should work.
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

).
Just a question to a second part of code (generating
vxSignature) :
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?