# Technical Description

# Randomness Beacon

True Casino implements the commit-and-reveal scheme adapted for use in a single transaction. This does not sacrifice security for either players or the casino but creates an exemplary user experience with a short waiting time for bet confirmation on the blockchain.

The scheme above allows the disclosure of a random number immediately after a transaction is confirmed. This comes with a minor drawback—the new user's bet must be processed in a smart contract, either in a separate call or with a following bet. Thus, fully transparent information regarding the user's bet does not appear immediately. However, a 5-second transaction confirmation time and minimal interaction with smart contracts via non-view functions bring substantial benefits.

# Pending Transactions Handling

At True Casino, we pay special attention to users' transaction handling. Nothing is more frustrating than an unexpected transaction confirmation or cancellation popup, which may give the user a sense of insecurity or, worse, suspicion of cheating by the casino.

Typically, on the Polygon network, transactions with the fee structure implemented in [] should be confirmed within 5 seconds.

However, when the network is busy or fees spike, it may take longer. In these exceptional circumstances, the user has several options:

  • Wait until the transaction is confirmed.
  • Speed up the transaction in their wallet.
  • Cancel the transaction.

The pending transaction tracking algorithms can be described as follows:

There are two separate processes tracking pending transactions: the main UI thread calling ethers.waitForTransaction and the WebSocket listener. The stalled waitForTransaction promise fails when the user changes the transaction in their wallet. The WebSocket catches all smart contract events and handles transaction modifications. Both processes complement each other.

Since True Casino does not monitor the mempool, if a user cancels a transaction in their wallet, they must notify the UI by clicking the canceled transaction confirmation dialog.

If the user closes the browser window during the pending transaction process, the transaction hash is saved in local storage and retrieved when the user returns.