> For the complete documentation index, see [llms.txt](https://fr0.gitbook.io/dragonraceai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fr0.gitbook.io/dragonraceai/about-us/provably-fair-pf-system.md).

# Provably Fair (PF) System

**Overview**

DragonRaceAI employs an advanced Provably Fair (PF) algorithm to guarantee the complete randomness and fairness of the dragon variety selection, race track generation, and race outcomes. This algorithm allows players to independently verify the fairness of race results, ensuring that no external factors can influence the integrity of the competition.

**Technical Implementation**

Our PF system ensures game fairness through the following steps:

* **Random Number Generation:** Utilizing data from the Bitcoin blockchain as a random seed ensures that the generated random numbers are uncontrollable by any party and fully verifiable.
* **Seed Encryption:** Before the game starts, the seed used is encrypted and the result is made public, ensuring the seed is not tampered with during the game process.
* **Result Verification:** After the race concludes, we disclose the seed and encryption algorithm used, allowing anyone to verify the fairness of the race results.

**Advantages**

* **Transparency:** All players can verify race results through the Bitcoin blockchain, ensuring the game's transparency and credibility.
* **Security:** By leveraging blockchain technology, any form of manipulation and fraud is prevented, ensuring the fairness of the competition.
* **Fairness:** Guarantees that all players in DragonRaceAI have equal opportunities to compete fairly.

**Conclusion**

Implementing a Provably Fair system on the Bitcoin blockchain, DragonRaceAI provides a completely transparent, immutable, and absolutely fair competition environment. We proudly claim that our PF system is one of the most advanced and transparent in the market, ensuring the fairness and randomness of every dragon race. This innovative fairness verification mechanism not only boosts players' trust but also sets a new benchmark for the future of blockchain gaming.\ <br>

<figure><img src="/files/bDRKPv9VUIPVJwW6FdrJ" alt=""><figcaption></figcaption></figure>

```
mapping(uint256 => string) public indexToName;
event BoxResult(string);

function getBox() external returns (bytes32) {
	indexToName[0] = "SpeedUp";
	indexToName[1] = "SlowDown";
	indexToName[2] = "FlyUp";
	indexToName[3] = "FlyDown";
	bytes memory params;
	return _requestRandomness(RequestType.Randomness, params);
}

function _fulfillRandomness(bytes32 requestId, uint256 randomness) internal override {
	uint256 winnerIndex = RandcastSDK.roll(randomness, 4);
	emit WinnerResult(indexToName[winnerIndex]);
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://fr0.gitbook.io/dragonraceai/about-us/provably-fair-pf-system.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
