証明可能に公正なルーレット
最後の取引結果を確認し、以下のコードを自分で実行します
- アカウント
- 次のシードハッシュ
- 明らかにされたシード
- スピン結果
- 0
#!/usr/bin/env node
const crypto = require("crypto");
// calculate hash from seed
function hash() {
return crypto.createHash("sha256").update(
""
).digest("hex");
};
function calculateNumber () {
const hmac = crypto
.createHmac("sha512", "")
.update(
""
)
.digest("hex");
const first7 = hmac.substring(0, 7);
return Math.round(parseInt(first7, 16)
/ 33);
}
// caculateNumber() === 0