It does:
int clientSeed = rnd.Next();
var settings = new AutomatedBetsSettings
{
BasePayIn = baseBet,
GuessLow = guessLow,
GuessHigh = guessHigh,
MaxBets = (betCount > Session.MaxBetBatchSize) ? Session.MaxBetBatchSize : betCount,
ResetOnWin = resetOnWin,
ResetOnLose = resetOnLoss,
IncreaseOnWinPercent = increaseOnWin,
IncreaseOnLosePercent = increaseOnLoss,
MaxAllowedPayIn = maxBet,
ResetOnLoseMaxBet = resetOnMaxLoss,
StopOnLoseMaxBet = stopOnMaxLoss,
StopMaxBalance = stopMaxBalance,
ClientSeed = clientSeed,
Currency = Currency
};
PlaceAutomatedBetsResponse result = await DiceWebAPI.PlaceAutomatedBetsAsync(Session, settings);
for (int i = 0; i < result.BetCount; i++)
{
if (!VerifyBetResult(result.ServerSeed, clientSeed, i, result.Secrets[i], serverSeed.ServerSeedHash))
bRiggedBetFound = await LogRiggedBet(result.ServerSeed, clientSeed, result.BetIds[i], result.Secrets[i], serverSeed.ServerSeedHash);
}
long betResult, string serverSeedHash = null)
{
Func
.Range(0, s.Length / 2)
.Select(x => byte.Parse(s.Substring(x * 2, 2), NumberStyles.HexNumber))
.ToArray();
byte[] server = strtobytes(serverSeed);
byte[] client = BitConverter.GetBytes(clientSeed).Reverse().ToArray();
byte[] num = BitConverter.GetBytes(betNumber).Reverse().ToArray();
byte[] serverhash = serverSeedHash == null ? null : strtobytes(serverSeedHash);
byte[] data = server.Concat(client).Concat(num).ToArray();
using (SHA512 sha512 = new SHA512Managed())
{
if (serverhash != null)
using (SHA256 sha256 = new SHA256Managed())
if (!sha256.ComputeHash(server).SequenceEqual(serverhash))
return false;//throw new Exception("Server seed hash does not match server seed");
byte[] hash = sha512.ComputeHash(sha512.ComputeHash(data));
while (true)
{
for (int x = 0; x <= 61; x += 3)
{
long result = (hash[x] << 16) | (hash[x + 1] << 8) | hash[x + 2];
if (result < 16000000)
return result % 1000000 == betResult;
}
hash = sha512.ComputeHash(hash);
}
}
}
In short for non-programmers:
1. I get the server seed's hash
2. I generate a random number in clientSeed and put that into the class AutomatedBetsSettings
3. I place that automated bet and get back a class PlaceAutomatedBetsResponse. Inside this class is the server seed.
4. I verify every bet with VerifyBetResult(). If a rigged bet will be detected it will log all data to a file so we could proof they have manipulated.
For single bets the bot does the same procedure.
clientSeed = rnd.Next();
single = await DiceWebAPI.PlaceBetAsync(Session, betSize, guessLow, guessHigh, clientSeed, Currency);
if (!VerifyBetResult(single.ServerSeed, clientSeed, 0, single.Secret, serverSeed.ServerSeedHash))
bRiggedBetFound = await LogRiggedBet(single.ServerSeed, clientSeed, single.BetId, single.Secret, serverSeed.ServerSeedHash);
To be sure there is no information exchance between generating my clientSeed and DiceWebAPI.PlaceAutomatedBetsAsync() I've checked the source code of the DiceWebAPI library which is public on github: https://github.com/triple9dice/
Everything is as it should be.