How Actually Fair Works
There are three parties:
- Player (the person gambling)
- GS (Short for Game Server, i.e. the casino)
- Vx (Short for Verified-By, the service that is run by Actually Fair to verify games)
Here's the standard flow. Note this entire sequence diagram is scoped per player. In other words the game server will be doing this for multiple players.
sequenceDiagram
actor Player
participant GS as Game Server
participant VX as Verified By
Note over GS: The game server needs a secret for game generation
GS->>GS: GS_SEED := random_256_bits()
Note over GS: Makes a commitment to it
GS->>GS: GS_COMMITMENT := sha256(GS_SEED)
Note over GS, VX: The game server sends its commitment
GS->>VX: vx.make_commitment(GS_COMMITMENT)
Note over VX: VX records this, and returns a public key (using BLS)
VX-->>GS: VX_PUBKEY
Note over GS, Player: The player is given what it needs to verify games<br>(in the future)
GS->>Player: GS_COMMITMENT, VX_PUBKEY
Note over Player: The player can record this, and picks their own<br>PLAYER_SEED to influence games
Player->>GS: PLAYER_SEED
GS->>GS: NONCE := 0
loop Each Bet
Note over Player: The player makes a wager
Player->>GS: WAGER
Note over GS: The Game Server calculates its unpredictable contribution to the game result
GS->>GS: GS_CONTRIBUTION := HMAC.SHA256(GS_SEED, PLAYER_SEED || ':' || NONCE)
Note over GS,VX: The game server requests the final piece of information<br> needed to construct a bet outcome
GS->>VX: vx.make_message(GS_COMMITMENT, GS_CONTRIBUTION, WAGER)
Note over VX: VX records the details of this wager
VX->>VX: VX_SIGNATURE := bls.sign(GS_CONTRIBUTION, VX_PRIVATE_KEY)
VX-->>GS: VX_SIGNATURE
Note over GS: Should make sure VX is not cheating
GS->>GS: bls.verify(VX_SIGNATURE, GS_CONTRIBUTION, VX_PUBKEY)
Note over GS,VX: Can derive wager results from<br> VX_SIGNATURE, Wager
GS-->>Player: Wager Result
GS->>GS: NONCE := NONCE + 1
end
Player->>GS: Please reveal your secret
Note over GS: The Game Server must be careful to never use this seed again
GS-->>Player: GS_SEED
Note over Player: Player can now verify all games
Note over GS, VX: VX would also like to know the GS_SEED<br>so it can also a player-oriented verification
GS->>VX: vx.make_reveal(GS_SEED)