It was the Bitcointalk forum that inspired us to create Bitcointalksearch.org - Bitcointalk is an excellent site that should be the default page for anybody dealing in cryptocurrency, since it is a virtual gold-mine of data. However, our experience and user feedback led us create our site; Bitcointalk's search is slow, and difficult to get the results you need, because you need to log in first to find anything useful - furthermore, there are rate limiters for their search functionality.
The aim of our project is to create a faster website that yields more results and faster without having to create an account and eliminate the need to log in - your personal data, therefore, will never be in jeopardy since we are not asking for any of your data and you don't need to provide them to use our site with all of its capabilities.
We created this website with the sole purpose of users being able to search quickly and efficiently in the field of cryptocurrency so they will have access to the latest and most accurate information and thereby assisting the crypto-community at large.
import { sha256 } from "@noble/hashes/sha256";
import { bytesToHex, hexToBytes } from "@noble/hashes/utils";
const terminatinghash = hexToBytes("575faa089b45aea15ac51fa35d9e2cb085510b286c6b27ac5fa93235cdc30e6c");
function verifyInChain(hash: Uint8Array) {
for (let gameId = 1; gameId < 10e6; gameId++) {
hash = sha256(hash);
if (hash === terminatinghash) {
console.log("Hash is in the chain. It is game: ", gameId);
return;
}
}
console.error("hash is not in the chain");
}
verifyInChain(
hexToBytes("85afc58736609dfe6f093ff15ba25ea6b48e39e01706780a20ebb04c83df5058")
);
// Note:
// casinoBankroll - the casino's bankroll
// playerBetting - the sum of money still in a game
// multiplier - at what multiplier the game is currently at (use the crash point for the final house edge)
function houseEdge(casinoBankroll, playerBetting, multiplier) {
return expectedValue(casinoBankroll, playerBetting, multiplier) / playerBetting;
}
// From the casino's perspective, tells us how much money we will win or lose in the long run
function expectedValue(casinoBankroll, playerBetting, multiplier) {
const winProbability = winProbabilityFromRisk(casinoBankroll, playerBetting, multiplier);
const potentialProfit = winProbability * playerBetting;
const howMuchToPay = playerBetting * (multiplier - 1);
const potentialLoss = howMuchToPay * (1 - winProbability);
return potentialProfit - potentialLoss;
}
// Returns the casino's probability (from 0 to 1) if players were betting at a given multiplier
function winProbabilityFromRisk(casinoBankroll, playerBetting, multiplier) {
const potentialPlayerWin = (multiplier - 1) * playerBetting;
return (potentialPlayerWin * (casinoBankroll + 2 * playerBetting)) / (casinoBankroll * (potentialPlayerWin + playerBetting));
}
import { concatBytes, utf8ToBytes} from "@noble/hashes/utils";
// Concatenate the previous game hash bytes with the client seed bytes
const message = concatBytes(prevGameHash, utf8ToBytes(clientSeed));
// Ask ProvablyHonest to sign the message using the public key
// (VX_PUBKEY: 8be5ac83c91b3648d7b2c01d555dfbf60a0547c40524f495b656b6cfa9b69d5faf0967835257b30ac75fd80876c29c64)
const vxSignature = await vx.make_message(commitment, message, gameId, wager);
import { bls12_381 as bls } from "@noble/curves/bls12-381";
// Note: the VX_PUBKEY is what is returned when the game server commits to Vx
const verified = bls.verify(vxSignature, message, VX_PUBKEY);
if (!verified) {
throw new Error("Vx gave us something that didn't verify");
}
const crypto = require("crypto");
// The pure probability of the casino winning, before taking into account any edge
function scaledOutcome(gameHash, vxSignature) {
const nBits = 52; // number of most significant bits to use
// 1. HMAC_SHA256(key=vxSignature, message=gameHash)
const hmac = crypto.createHmac("sha256", vxSignature);
hmac.update(gameHash);
seed = hmac.digest("hex");
// 2. r = 52 most significant bits
seed = seed.slice(0, nBits/4);
const r = parseInt(seed, 16);
// 3. X = r / 2^52
return r / Math.pow(2, nBits); // uniformly distributed in [0; 1)
}
function gameResult(gameHash, vxSignature, houseEdge) {
const X = scaledOutcome(gameHash, vxSignature);
const result = (1 - houseEdge) / (1 - X);
return Math.max(1, Math.floor(result * 100) / 100);
}