Project Fairdice
[Home] [Docs] [Users] [Gaming] [Crypto] [Devel] [Download] [Help]

Fairdice Protocol v0.3 : Game Specific : Client-Server

[Definition]
GAME_MESSAGE = "G " GAME_STR " | P " PROTOCOL_STR
GAME_STR = GAME_ID
; this identifies the particular game instance being played
PROTOCOL_STR = GAME_INIT | GAME_RAND | GAME_GENR | GAME_VERI
; these stages must be played in order, each sequence happening once.
See also basic definitions.
Stage Initiator Description
GAME_INIT Client Initialise the game.
GAME_RAND Client The client decides to play and provides their random input
GAME_GENR Server Once the server has everyone's input, generate the output
GAME_VERI Server Once the server announces the output, verify it is fair

Definitions

[Definition]
MODULO = 1*200(HEX)
; The number of faces on the die. The number of events between which we are selecting.
SHAREDTEXT = HOST_ID " ^ " GAME_ID " ^ " TIMESTAMP " ^ " PADDING " ^ "
PADDING = *(HEX)
; The length of the PADDING is selected to make the length of the SHAREDTEXT up to 250 characters long.
USERTEXT = 250(HEX)
PLAINTEXT = SHAREDTEXT USERTEXT
DIGEST = <the tiger hash of PLAINTEXT, displayed as a HEX string>
INPUT = <USERTEXT modulo MODULO displayed in HEX>
OUTPUT = <the sum of the INPUTs from the host and players, modulo MODULO>
[Example]
MODULO = "6"
SHAREDTEXT = "Richard.Com ^ testgame3 ^ 2004-08-16 15:36:36 ^ 1B3011378D 689FDC04C2C42806C7324E462FF9ED64BC9D55782C112DF20EA47B31C359 AE3AECDD9598D966DAD54DA5ABB1BE010D36AC090259B4E3BC5CA86A194F 8FD1D931C7999E3EAD90A1911054E4C5D7D07837DDFD033F6726B3D5B5C6 7DE3F96D8 ^ "
USERTEXT 1 = "5217E55D13401F7CB3C644B5ECBA87880E14D70E1A83A92F4059828AD67 6024EE4FA8BB429805A4B2C981A6D66E1BA9C93C2D4C3D93A5E01ED459A4 B604CD71375A00F7A6473594731207AF9412C199E7C18F6BDB1E7A9EACCB 8395B45D7735C15A9EEB4D990538FD3A2CF4CD223495BABF1FC5C5D26062 D46E8E65282"
USERTEXT 2 = "79FA03B7AB26EDE078CA59FCB7FC3D9D5B80EBEED6F0DCBDE4B5AF6CB0B E85A0ECB422E78FA5D94D27E88D0B8B532D6EA23088B7C612FBF0E2ED47A 6B8920C3AA263D52D76E6C6B21AD017A407D6B5080324BA0E26826194540 E0423ADA4B2C2CD47ECAD87826AE6AD984FA8A1E4AC1094BA20B8E27422E 5F671D3868D"
PLAINTEXT 1 = "Richard.Com ^ testgame3 ^ 2004-08-16 15:36:36 ^ 1B3011378D6 89FDC04C2C42806C7324E462FF9ED64BC9D55782C112DF20EA47B31C359A E3AECDD9598D966DAD54DA5ABB1BE010D36AC090259B4E3BC5CA86A194F8 FD1D931C7999E3EAD90A1911054E4C5D7D07837DDFD033F6726B3D5B5C67 DE3F96D8 ^ 5217E55D13401F7CB3C644B5ECBA87880E14D70E1A83A92F4 059828AD676024EE4FA8BB429805A4B2C981A6D66E1BA9C93C2D4C3D93A5 E01ED459A4B604CD71375A00F7A6473594731207AF9412C199E7C18F6BDB 1E7A9EACCB8395B45D7735C15A9EEB4D990538FD3A2CF4CD223495BABF1F C5C5D26062D46E8E65282"
PLAINTEXT 2 = "Richard.Com ^ testgame3 ^ 2004-08-16 15:36:36 ^ 1B3011378D6 89FDC04C2C42806C7324E462FF9ED64BC9D55782C112DF20EA47B31C359A E3AECDD9598D966DAD54DA5ABB1BE010D36AC090259B4E3BC5CA86A194F8 FD1D931C7999E3EAD90A1911054E4C5D7D07837DDFD033F6726B3D5B5C67 DE3F96D8 ^ 79FA03B7AB26EDE078CA59FCB7FC3D9D5B80EBEED6F0DCBDE 4B5AF6CB0BE85A0ECB422E78FA5D94D27E88D0B8B532D6EA23088B7C612F BF0E2ED47A6B8920C3AA263D52D76E6C6B21AD017A407D6B5080324BA0E2 6826194540E0423ADA4B2C2CD47ECAD87826AE6AD984FA8A1E4AC1094BA2 0B8E27422E5F671D3868D"
DIGEST 1 = "06F5E826BE31B56979D88786FE26E7BD5F77497880136916"
DIGEST 2 = "BD0C27F25CA874E52C40BE3D0C0602208F845F9A3E18C4F2"
INPUT 1 = "2"
INPUT 2 = "1"
OUTPUT = "3"
(So in this case, the die rolled a "3")
(You can use the
Gnu Multiple Precision Website to verify the calculations.)

Stage : Initialisation

[Definition]
GAME_INIT = INIT_REQUEST | INIT_RESPONSE | INIT_SEED | INIT_MODULO
INIT_REQUEST = "join request"
INIT_RESPONSE = "join respond " JOIN_ANSWER
INIT_SEED = "seed " SHAREDTEXT
INIT_MODULO = "modulo " MODULO
JOIN_ANSWER = "yes" | "no HOST_UNAVAILABLE" | "no GAME_UNAVAILABLE" | ("no HOST_MESSAGE " DISPLAY_STR ) | ("SERVER_MESSAGE " DISPLAY_STR )

[Sequence]
There are two valid sequences.
  1. client to server : INIT_REQUEST
  2. server to client : INIT_RESPONSE (negative)
or
  1. client to server : INIT_REQUEST
  2. server to client : INIT_RESPONSE (positive)
  3. server to client : INIT_SEED
  4. server to client : INIT_MODULO

Stage : Randomisation

[Definition]
GAME_RAND = RAND_REVEAL | RAND_ID
RAND_REVEAL = "digest reveal " DIGEST
RAND_ID = "id " PLAYER_ID

[Sequence]
There is one valid sequences.
  1. client to server : RAND_REVEAL
  2. server to client : RAND_ID

Stage : Generation

[Definition]
GAME_GENR = GENR_SIZE | GENR_REQUEST | GENR_RESPOND | GENR_REVEAL
GENR_SIZE = "size " GAME_SIZE
GENR_REQUEST = "digest request " PLAYER_RANGE
GENR_RESPOND = "digest respond " PLAYER_ID " " DIGEST
GENR_REVEAL = "usertext reveal " USERTEXT
PLAYER_RANGE = INT_RANGE

[Sequence]
There is one general sequences.
  1. server to client : GENR_SIZE
  2. client to server : GENR_REQUEST
  3. server to client : GENR_RESPOND
  4. client to server : GENR_REVEAL
however steps 2 and 3 may happen several times until the client is satisfied that it has all the digests it wants.

[Example]
Let's assume we are player 1 in a 4 player game (remember that means there are 5 participants, because the host is participant 0).

For brevity I am truncating the digests.
GENR_SIZE = "P size 4"
GENR_REQUEST = "P digest request 0,2-3"
GENR_RESPONSE = "P digest respond 0 DEADBEEF1234..."
GENR_RESPONSE = "P digest respond 2 DEADBEEF4567..."
GENR_RESPONSE = "P digest respond 3 DEADBEEF7890..."
GENR_REQUEST = "P digest request 4"
GENR_RESPONSE = "P digest respond 0 DECAFBAD6667..."
; ok, we now have them all
GENR_REVEAL = "P usertext reveal 83E7728F3747..."

Stage : Verification

[Definition]
GAME_VERI = VERI_OUTCOME | VERI_REQUEST | VERI_RESPOND | VERI_FINISH | VERI_CLOSING | VERI_CLOSED
VERI_OUTCOME = "outcome " OUTCOME
VERI_REQUEST = "usertext request " PLAYER_RANGE
VERI_RESPOND = "usertext respond " PLAYER_ID " " USERTEXT
VERI_FINISH = "finish " ( "fair" | ("fail " DISPLAY_STR) | ("fraud " DISPLAY_STR) )
VERI_CLOSING = "closing"
VERI_CLOSED = "closed"

[Sequence]
There is one general sequence.
  1. server to client : VERI_OUTCOME
  2. client to server : VERI_REQUEST
  3. server to client : VERI_RESPOND
  4. client to server : VERI_FINISH
  5. client to server : VERI_CLOSING
  6. server to client : VERI_CLOSED
however be aware:

Either side can send VERI_CLOSING at any stage of a game. If it is sent before stage VERI, it cancels the game, triggering a VERI_FINISH (fail) being sent to everyone.

As with stage GENR, steps 2 and 3 can be repeated until the client is happy it has all the usertexts and is able to calculate for itself the outcome, to compare with the one the server told it.

If a usertext it gets told in this stage does not match a digest from that player it was told in the previous stage, it calls "fraud".


(
TOP)(UP)