Bitcoin Forum
June 20, 2024, 02:12:29 AM *
News: Voting for pizza day contest
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3]  All
  Print  
Author Topic: Dice64 - Off Blockchain. Provably fair. Instantly verifiable. 0.9% Edge  (Read 2851 times)
dice64 (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 1


View Profile WWW
August 04, 2013, 03:38:00 PM
 #41

So we're back up, but with a new database. All remaining accounts showed a successful payout. If anyone didn't get their money back let me know, I have signed receipts to showing the total bets and all incoming and outgoing transactions/addresses.

Using 32-bit integers as a nonce, as that is the largest amount that can be supported natively in JavaScript.

I'll be doing a write up soon, showing how the receipts can provide proof of fairness and publishing some python which can connect to the api and verify the result locally.

Thanks



dice64 (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 1


View Profile WWW
August 04, 2013, 07:58:15 PM
 #42

Just to describe in greater detail how we prove our bets are truely verifiable, see the receipt JSON printed below.

Excess bets have been removed to improve readability and the JSON keys have been ordered in term of relevence.

After creating the account, before the player is allowed to place a bet, they must submit a signed patch statement to the service, to say they accept the following fields on the account, this must be signed with the Bitcoin address generated in the players browser;

   * userid
   * sign_address
   * deposit_address
   * return_address

This forms as a http post string, which is signed as printed below.

"PATCH /api/account\n\nuserid=1000&return_address=1FEi17iu84DmigLM9zeBfNVWzFyZYk3FGb&sign_address=1DQ6MQx5RNSk3T8evGygp95zT4jmBxXP3E&deposit_address=1KU8GojtQTkPvqWGbj9UHXrgx49h1mNXvP"

The service will then also sign this request if it is considered valid, so the player also has proof that the deposit_address belongs to Dice64, should there be and reason for a dispute.

Then for every bet you sign a request containing the following fields;
   
   * below
   * amount
   * nonce
   * secret_hash
   * multiplier

This will be a string similar to the following

"POST /api/account/bet\n\nbelow=32&amount=39000&nonce=2690345304&secret_hash=7f4ad5fb7eed63d2611b43319ec208e14395dcb71d02af678cd55c07a860a4ed&multiplier=1.980"

The service will check to ensure your signature is valid, before signing the request with the service address (1Dice64ckqzrBwEum3rDW1cKPodpvSKuEX) and returning the response.

This method ensures that we cannot at any point after the bet has been placed change any of the variables in the bet to alter the outcome. Both the player and the service have a copy of the deposit address and full list of bet requests signed by each other, as proof of anything that could have affected the players balance.


We have accountability toward every satoshi that you deposit, there is no possibility that your funds can just dissappear or be altered without us having a signed request by the player to place a bet with certain parameters which we cannot alter.

Please forward me any questions you may have.

See example of a receipt below:

Code:
{
"bet_list": [
{
"secret": "a8758b97ff72f0fcd7744ef8c9458b336f04e85d3b098388e95855a621beb918",
"secret_hash": "7f4ad5fb7eed63d2611b43319ec208e14395dcb71d02af678cd55c07a860a4ed",
"nonce": 2690345304,
"amount_placed": 39000,
"house_edge": "0.0100",
"multiplier": "1.980",

"combined_hash": "39c2176e9757844980ac26bacd90d2f5e0089b7996dfad5dc06fd91f0092820a",

"timestamp": 1375630684,
"below": 32,
"result": 10,
"won": true,

"bet_statement": "POST /api/account/bet\n\nbelow=32&amount=39000&nonce=2690345304&secret_hash=7f4ad5fb7eed63d2611b43319ec208e14395dcb71d02af678cd55c07a860a4ed&multiplier=1.980",
"bet_statement_player_sig": "HGx93DlUYwF85a2bcZWh++HuyZ+s4u70Z6lhXa3v00LpJwlh96/9fev98CcSj12dgDg57qm9sg3R/wFCeyN8Lvc=",
"bet_statement_service_sig": "HFqa7wUksX/NbEuq2AGmgRVK8TDxU5uBNynIC54Eyjwb9V26q7CW/8rbpRG1IYdZ6I0zNhZnlv9LAqD3vg8ySs4=",

"amount_won": 77220,
"profit": 38220,
"id": 1004,
"owner_id": 1000
}, ...
],

"nickname": "User 1000",
"active": false,
"expire_time": 1375630693,
"balance": 3921220,

"sign_address": "1DQ6MQx5RNSk3T8evGygp95zT4jmBxXP3E",
"deposit_address": "1KU8GojtQTkPvqWGbj9UHXrgx49h1mNXvP",
"return_address": "1FEi17iu84DmigLM9zeBfNVWzFyZYk3FGb",

"amount_placed": 156000,
"amount_won": 77220,

"profit": -78780,
"bets_placed": 4,
"bets_won": 1,

"patch_statement": "PATCH /api/account\n\nuserid=1000&return_address=1FEi17iu84DmigLM9zeBfNVWzFyZYk3FGb&sign_address=1DQ6MQx5RNSk3T8evGygp95zT4jmBxXP3E&deposit_address=1KU8GojtQTkPvqWGbj9UHXrgx49h1mNXvP",
"patch_statement_player_sig": "Gy/fpaYGDEaqaVxyUKc9y8X3I8x3cPBq9GOuGWe5c54Lhcp2pt/aHuatV38qo/48GslN/m3g9X1F2a5PYuteygc=",
"patch_statement_service_sig": "HASW/37Ez7qP6NuJqlWy8CVC2ExXr7UETCtnZg7J4zWLUtwSPdCLZJL+JIipfTJV1/KwEv5dXE/+8L0/R2xxpDw=",

"userid": 1000,
"msg": "Withdrawl Successful",
"withdrawal_txid": "e5185edad6bd33cad9086b189aaef71302eedf4a2d3114923071fac1c4bb45a2",
"withdrawal_hex": "0100000002283ea6a0994613f4c82e594790804d21fb9593d8175efef9fd3679e1e557f496000000006b483045022048c740665a821e0aabc95235dc173acbfa61e4be01c14ed5b20aa8a5c21ed3e5022100de086871fb9014e8d711df5cec3bf175a1744d2c3966f6196ff948c95ae2631b012103a7274aef7524908843c98cdff8208d25d2df3e22f6d5bb8c403b5f88c9ef6ea5ffffffffea2b965090e58496ab83ed17fe61f16b9db9c3af562b9e50c1d5fb2a80eac697000000006a47304402200b782a7a4249f52c9054c7f53c518bd5da702a1cbc9d66f4e8ddaa4ce2c872bc022041ce50f2584f3290161a41637db9be6f0ce046de3402fb216bd8713b779d00e0012103a7274aef7524908843c98cdff8208d25d2df3e22f6d5bb8c403b5f88c9ef6ea5ffffffff02bc330100000000001976a914847c7c6702c3e36f1823baf86231cfcb749f8a8d88ac34ae3b00000000001976a9149c29652d2f312210c0579faa868dc0c91202f37188ac00000000",

"deposit_list": [
{
"n": 0,
"value": 2000000,
"txid": "96f457e5e17936fdf9fe5e17d89395fb214d809047592ec8f4134699a0a63e28"
},
{
"n": 0,
"value": 2000000,
"txid": "97c6ea802afbd5c1509e2b56afc3b99d6bf161fe17ed83ab9684e59050962bea"
}
]
}
Insanity
Sr. Member
****
Offline Offline

Activity: 611
Merit: 250


casinosblockchain.io


View Profile
August 04, 2013, 09:51:56 PM
 #43

Just to describe in greater detail how we prove our bets are truely verifiable, see the receipt JSON printed below.

Excess bets have been removed to improve readability and the JSON keys have been ordered in term of relevence.

After creating the account, before the player is allowed to place a bet, they must submit a signed patch statement to the service, to say they accept the following fields on the account, this must be signed with the Bitcoin address generated in the players browser;

   * userid
   * sign_address
   * deposit_address
   * return_address

This forms as a http post string, which is signed as printed below.

"PATCH /api/account\n\nuserid=1000&return_address=1FEi17iu84DmigLM9zeBfNVWzFyZYk3FGb&sign_address=1DQ6MQx5RNSk3T8evGygp95zT4jmBxXP3E&deposit_address=1KU8GojtQTkPvqWGbj9UHXrgx49h1mNXvP"

The service will then also sign this request if it is considered valid, so the player also has proof that the deposit_address belongs to Dice64, should there be and reason for a dispute.

Then for every bet you sign a request containing the following fields;
   
   * below
   * amount
   * nonce
   * secret_hash
   * multiplier

This will be a string similar to the following

"POST /api/account/bet\n\nbelow=32&amount=39000&nonce=2690345304&secret_hash=7f4ad5fb7eed63d2611b43319ec208e14395dcb71d02af678cd55c07a860a4ed&multiplier=1.980"

The service will check to ensure your signature is valid, before signing the request with the service address (1Dice64ckqzrBwEum3rDW1cKPodpvSKuEX) and returning the response.

This method ensures that we cannot at any point after the bet has been placed change any of the variables in the bet to alter the outcome. Both the player and the service have a copy of the deposit address and full list of bet requests signed by each other, as proof of anything that could have affected the players balance.


We have accountability toward every satoshi that you deposit, there is no possibility that your funds can just dissappear or be altered without us having a signed request by the player to place a bet with certain parameters which we cannot alter.

Please forward me any questions you may have.

See example of a receipt below:

Code:
{
"bet_list": [
{
"secret": "a8758b97ff72f0fcd7744ef8c9458b336f04e85d3b098388e95855a621beb918",
"secret_hash": "7f4ad5fb7eed63d2611b43319ec208e14395dcb71d02af678cd55c07a860a4ed",
"nonce": 2690345304,
"amount_placed": 39000,
"house_edge": "0.0100",
"multiplier": "1.980",

"combined_hash": "39c2176e9757844980ac26bacd90d2f5e0089b7996dfad5dc06fd91f0092820a",

"timestamp": 1375630684,
"below": 32,
"result": 10,
"won": true,

"bet_statement": "POST /api/account/bet\n\nbelow=32&amount=39000&nonce=2690345304&secret_hash=7f4ad5fb7eed63d2611b43319ec208e14395dcb71d02af678cd55c07a860a4ed&multiplier=1.980",
"bet_statement_player_sig": "HGx93DlUYwF85a2bcZWh++HuyZ+s4u70Z6lhXa3v00LpJwlh96/9fev98CcSj12dgDg57qm9sg3R/wFCeyN8Lvc=",
"bet_statement_service_sig": "HFqa7wUksX/NbEuq2AGmgRVK8TDxU5uBNynIC54Eyjwb9V26q7CW/8rbpRG1IYdZ6I0zNhZnlv9LAqD3vg8ySs4=",

"amount_won": 77220,
"profit": 38220,
"id": 1004,
"owner_id": 1000
}, ...
],

"nickname": "User 1000",
"active": false,
"expire_time": 1375630693,
"balance": 3921220,

"sign_address": "1DQ6MQx5RNSk3T8evGygp95zT4jmBxXP3E",
"deposit_address": "1KU8GojtQTkPvqWGbj9UHXrgx49h1mNXvP",
"return_address": "1FEi17iu84DmigLM9zeBfNVWzFyZYk3FGb",

"amount_placed": 156000,
"amount_won": 77220,

"profit": -78780,
"bets_placed": 4,
"bets_won": 1,

"patch_statement": "PATCH /api/account\n\nuserid=1000&return_address=1FEi17iu84DmigLM9zeBfNVWzFyZYk3FGb&sign_address=1DQ6MQx5RNSk3T8evGygp95zT4jmBxXP3E&deposit_address=1KU8GojtQTkPvqWGbj9UHXrgx49h1mNXvP",
"patch_statement_player_sig": "Gy/fpaYGDEaqaVxyUKc9y8X3I8x3cPBq9GOuGWe5c54Lhcp2pt/aHuatV38qo/48GslN/m3g9X1F2a5PYuteygc=",
"patch_statement_service_sig": "HASW/37Ez7qP6NuJqlWy8CVC2ExXr7UETCtnZg7J4zWLUtwSPdCLZJL+JIipfTJV1/KwEv5dXE/+8L0/R2xxpDw=",

"userid": 1000,
"msg": "Withdrawl Successful",
"withdrawal_txid": "e5185edad6bd33cad9086b189aaef71302eedf4a2d3114923071fac1c4bb45a2",
"withdrawal_hex": "0100000002283ea6a0994613f4c82e594790804d21fb9593d8175efef9fd3679e1e557f496000000006b483045022048c740665a821e0aabc95235dc173acbfa61e4be01c14ed5b20aa8a5c21ed3e5022100de086871fb9014e8d711df5cec3bf175a1744d2c3966f6196ff948c95ae2631b012103a7274aef7524908843c98cdff8208d25d2df3e22f6d5bb8c403b5f88c9ef6ea5ffffffffea2b965090e58496ab83ed17fe61f16b9db9c3af562b9e50c1d5fb2a80eac697000000006a47304402200b782a7a4249f52c9054c7f53c518bd5da702a1cbc9d66f4e8ddaa4ce2c872bc022041ce50f2584f3290161a41637db9be6f0ce046de3402fb216bd8713b779d00e0012103a7274aef7524908843c98cdff8208d25d2df3e22f6d5bb8c403b5f88c9ef6ea5ffffffff02bc330100000000001976a914847c7c6702c3e36f1823baf86231cfcb749f8a8d88ac34ae3b00000000001976a9149c29652d2f312210c0579faa868dc0c91202f37188ac00000000",

"deposit_list": [
{
"n": 0,
"value": 2000000,
"txid": "96f457e5e17936fdf9fe5e17d89395fb214d809047592ec8f4134699a0a63e28"
},
{
"n": 0,
"value": 2000000,
"txid": "97c6ea802afbd5c1509e2b56afc3b99d6bf161fe17ed83ab9684e59050962bea"
}
]
}

Respectable. 

dice64 (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 1


View Profile WWW
August 04, 2013, 10:17:32 PM
 #44

Respectable. 

Not as respectable as you, Most Respected User 2013.
dice64 (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 1


View Profile WWW
August 05, 2013, 08:56:42 PM
 #45

Site is back up, maximum bets have been increased and house edge has now been set to 0.9% for all bets.
TheCape
Newbie
*
Offline Offline

Activity: 25
Merit: 0



View Profile
August 05, 2013, 09:32:44 PM
 #46

Checked it out, seems like a fun site.
dice64 (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 1


View Profile WWW
August 10, 2013, 11:58:58 PM
 #47

Updated python verification code. Increased maximum bets again.

https://gist.github.com/Dice64/6151316
Code:
import hashlib
import requests
 
# Doesn't currently do signature checking, we'll implement that in soon.
URL = "https://dice64.com"
 
 
def dsha256(input):
    return hashlib.sha256(hashlib.sha256(input.decode('hex')).digest()).hexdigest()
 
 
def verify_bet(id):
    r = requests.get(URL + '/api/bets/'+str(id))
 
    if r.status_code != 200:
        print "Couldn't find bet"
        exit()
 
    secret = r.json()['secret']
    secret_hash = r.json()['secret_hash']
    nonce = r.json()['nonce']
    combined_hash = r.json()['combined_hash']
    result = r.json()['result']
    # Calculated results
    combined = int(secret, base=16) + nonce
    combined_hex = hex(combined)[2:].strip("L")
 
    # Add preceeding zeros to make it 64 bytes in length
    while len(combined_hex) < 64:
        combined_hex = "0"+combined_hex
 
    # Print output
    print "\nSecret Hash - dsha256(secret)"
    print "Calculated:", dsha256(secret)
    print "Server val:", secret_hash
 
    print "\nCombined Hash - dsha256(secret + nonce)"
    print "Calculated:", dsha256(combined_hex)
    print "Server val:", combined_hash
 
    print "\nResult - dsha256(secret + nonce) mod 64"
    print "Calculated:", long(combined_hash, base=16) % 64
    print "Server val:", result
 
 
if __name__ == "__main__":
    import argparse
    parser = argparse.ArgumentParser()
    parser.add_argument('id', help='id of bet to check', type=int)
    args = parser.parse_args()
 
    verify_bet(args.id)
Pages: « 1 2 [3]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!