You need to use the previous hash. So, if prevGameHash is the hash of game #10002812, you have to validate the signature of game #10002813, and so on. I didn't try to run your code, but you probably want to use hexToBytes instead of Uint8Array(Buffer.from(foo)) where you declare prevGameHash and vxSignature.
Yep, you're right,
hexToBytes did the trick, thanks a lot! And a last question (I promise it'll be really last one :-) ) : How could I deduct vxSignature for the next (in the reverse manner) hash/game ?
return bls.verify(vxSignature, message, VX_PUBKEY); just gives me back
true/false like a validation, whether the current signature is correct (or not).
In any case many thanks again, Leo, for your co-operation, I really appreciate it!
No problem at all! Happy to help. Well, it's Vx that gives us that signature, so you need to communicate with its API. For example, in the same verifier, we call
getVxSignature (line 12 in
https://stackblitz.com/edit/bustabit-verifier?file=src%2Futils%2Fvx.ts), validate it, and then finally use it to generate the game's result.
Ah, I thought this in the meantime (and yes, this make a sense, actually). Anyway, is there API for bustabit.com as well? If I'd get VxSignature from Vx, I can get the game result for specific game directly (provided that I trust the result even without verification via vxSignature, of course :-) ).