可驗證公平的輪盤賭
驗證您的上一次交易結果,自己運行下面的代碼
- 賬戶
- 下一個種子哈希
- 揭示的種子
- 旋轉結果
- 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