Verifiable deterministic randomness from a Bitcoin (BSV) block hash โ the base primitive the rest of the kit builds on.
import { seed } from "@metanet-games/chainseed";
// blockHash: a BSV block hash (lowercase hex, as explorers show it)
const s = seed(blockHash);
s.unit("loot:sword"); // float in [0,1)
s.int("spawn:3", 6); // integer 0..5
s.pick("weather", ["rain","fog","sun"]);
s.chance("crit", 0.1); // true 10% of the time
Anywhere your game needs a random number players must be able to trust, seed it from a block hash instead of Math.random. Everyone with that block computes the same value, and nobody โ not even you โ can grind it. Draw as many independent values as you like from one block by passing different path strings.
Part of chainkit โ verifiable building blocks for BSV games. Verify don't trust.
๐งฉ github.com/metanet-games/chainkit ยท ๐น๏ธ the games ยท metanet.games