Skip to content

Instantly share code, notes, and snippets.

@willie-pe237
Created July 9, 2025 00:18
Show Gist options
  • Save willie-pe237/62116100210d1d3b46752081baebbe1f to your computer and use it in GitHub Desktop.
Save willie-pe237/62116100210d1d3b46752081baebbe1f to your computer and use it in GitHub Desktop.
Crash Verifier
<body>
<div class="container pb-3 px-5">
<h1 class="text-center p-3 alert-info">
<a href="https://trustdice.win/crash" target="_blank" class="alert-link"> <u>TRUSTDICE.WIN</u></a> CRASH VERIFIER
</h1>
<div class="config">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><b>Game's Hash</b></span>
</div>
<input id="gameHash" type="text" spellcheck="false" class="form-control"
placeholder="Game's hash you want to validate">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><b>Game's Amount</b></span>
</div>
<input id="gameAmount" value="10" type="number" spellcheck="false" class="form-control"
placeholder="Amount of game to show from this hash">
</div>
<button type="button" class="btn btn-info btn-block btn-lg" onclick="verifyCrashPoint();">VERIFY CRASH POINT
</button>
</div>
<hr class="my-4">
<div class="result">
<table id="hashTable" class="table table-striped">
<thead>
<tr>
<th>Game's hash</th>
<th>Crash Point</th>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
</div>
</div>
</body>
// NOTE: For the 23th round crash game verification, please refer: https://codepen.io/trustdice/pen/qEEzpXL
// The provably fair detail refer https://help.trustdice.win/collections/1988793-crash-game
// The block chain record refer https://eosflare.io/tx/ebd7d0e635b740c5b7157d5a3ec57a404303fea24172db1290ad1e6d4268e33f
// Block #436496677 Hash value: https://eosflare.io/block/436496677
const salt = '1a046925873519331d2dcaf2812cb6783d4a9d2ebb61c5f0c2e363cece13accd';
let query = URI(document.location.search).search(true);
$("#gameHash").val(query.game_hash);
function verifyCrashPoint() {
let hash = $("#gameHash").val();
if (hash.length !== 64) {
alert("Please input valid game hash!");
return;
}
let lastHash = "";
let amount = $("#gameAmount").val();
let $tableBody = $("#tbody");
$tableBody.html("");
for (let i = 0; i < amount; i++) {
let gameHash = (lastHash !== "" ? genGameHash(lastHash) : hash);
let gameCrash = crashPointFromGameHash(gameHash);
let colorClass = gameCrash > 1.97 ? 'green' : (gameCrash < 1.97 ? 'red' : 'blue');
let newRow = "<tr><td>" + gameHash + "</td><td class='" + colorClass + "'>" + gameCrash + "</td></tr>";
$tableBody.append(newRow);
lastHash = gameHash;
}
}
function genGameHash(lastGameHash) {
return sha256(lastGameHash)
}
function crashPointFromGameHash(gameHash) {
let seed = gameHash;
let hash = sha256(seed + salt);
let h = parseInt(hash.slice(0, 13), 16);
let e = Math.pow(2, 52);
let result = Math.floor((96 * e) / (e - h));
if (result < 101) {
result = 0;
}
if (result > 10000000) {
result = 10000000
}
return (result / 100).toFixed(2);
}
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.19.1/URI.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-sha256/0.3.2/sha256.min.js"></script>
body {
background-color: #d1ecf1;
}
.config, .result {
padding: 20px 16px;
border-radius: 3px;
}
.config {
background: #90c2ea8c;
}
.config .input-group-text {
width: 150px;
}
.table thead th {
border-top: 1px solid rgba(0, 0, 0, 0.3);
border-bottom: 1px solid rgba(0, 0, 0, 0.3);
}
table {
border-collapse: collapse;
}
table, th, td {
border: 1px solid rgba(0, 0, 0, 0.3);
font-family: Consolas,"Courier New",Courier,FreeMono,monospace;
}
th, td {
padding: 5px;
}
th:first-child,
td:first-child {
min-width: 680px;
}
td:last-child{
font-weight: bold;
}
.red {
background: red;
}
.green {
background: green;
}
.blue {
background: blue;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment