> For the complete documentation index, see [llms.txt](https://docs.chainparty.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chainparty.xyz/game-mechanism/smart-contract-randomness-mechanism.md).

# Smart Contract Randomness Mechanism

For detailed info, kindly visit our Contract Address: [0xAf0a930055aB797e8C4a361eC7c3e99AE56f081c](https://bscscan.com/address/0xAf0a930055aB797e8C4a361eC7c3e99AE56f081c)

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

Chain Party’s Smart Contract Randomness Mechanism: It works for the random number generation (for Winners & The Chosen One) in PvP Daily Missions.

1. Requesting Random Numbers:

* When a game round needs to end, the system requests a random number to decide Winners and The Chosen One. The game contract sends a signal to start this process.

2. Generating the Random Number:

* The system creates a random number by combining different things: information from the blockchain, private keys, and a few other factors. This number is then hashed and signed to prove it’s valid. By using blockchain data and cryptographic techniques, the system ensures that random numbers can't be predicted and manipulate in advance.

3. Confirming the Randomness:

* The system then sends this random number and a proof (to show the number is fair) back to the game.
* The smart contract checks if everything matches to confirm that the random number is correct and hasn’t been tampered with.

4. Using the Random Number:

* Once the random number is confirmed, the game uses it to determine the results of the round. For example, it might decide who the Winner or The Chosen One is based on this number.

5. Distributing Rewards:

* After the results are decided, the system distributes rewards to the players who participated. The rewards are calculated and sent based on the outcome, and players can claim their rewards.

In simple terms, the whole process ensures that the results of the game are fair, with random numbers that are impossible to predict or manipulate, making the game trustworthy for everyone.


---

# 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://docs.chainparty.xyz/game-mechanism/smart-contract-randomness-mechanism.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.
