python_scripts
directory:
enter_race.py
— generates 50 random 3-character predictions for each of the players, starts a race, and enrols the four players in the racecompute_stats_and_submit_winner.py
— does the winner calculation and submits the winnerenterRace
function at a specified block number. This commitment not only signifies the start of a new race but also allows for a transparent view of the number of participants, the stakes involved in terms of total $RON, and the kickoff block.
When entering, players also submit their wager—the entry fee in $RON with up to 50 three-character predictions of the block hashes that will appear over the race duration.
As the race progresses, players’ positions are determined by how accurately their predictions match the actual block hashes within the race’s 50-block duration. A correct prediction, matching a segment of a block’s hash, propels a player forward in the race. Conversely, incorrect guesses leave a player lagging.
At the race’s conclusion, the game tallies each participant’s successful predictions against the block hashes that appeared during the race. The player whose predictions align most closely with the actual block hashes wins. In the event of a tie, the game honors the principle of “first come, first served”—the player who first submitted their predictions is declared the winner, rewarding promptness and deterring mimicry (but not front-running — more on that later).
compute_stats_and_submit_winner.py
script runs and checks whether the latest race is completed