> For the complete documentation index, see [llms.txt](https://docs.cryptosat.io/cryptosat/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cryptosat.io/cryptosat/random-beacon/using-the-random-beacon-on-chain.md).

# Using the random beacon on-chain

Follow this tutorial to learn how to write a smart contract that consumes randomness from Cryptosat's Random Beacon contract.

### Create and deploy Sample contract[​](broken://pages/d2GeunwLZeXqezJwUt7G) <a href="#create-and-deploy-contract" id="create-and-deploy-contract"></a>

In this example, we use the example client contract that is available on our Github repository- [ClientContract.sol](https://remix.ethereum.org/#url=https://raw.githubusercontent.com/cryptosat/randomness/main/contracts/ClientContract.sol)

1. Open [`ClientContract.sol` in Remix](https://remix.ethereum.org/#url=https://raw.githubusercontent.com/cryptosat/randomness/main/contracts/ClientContract.sol)
2. Go to the compiler tab, as shown below:<br>

   <div align="left"><figure><img src="/files/6CzeA7qwl1oWFpYPMqNY" alt=""><figcaption></figcaption></figure></div>
3. Compile `ClientContract.sol`
4. Deploy your new contract that consumes our Random Beacon contract:&#x20;
   1. Click the Deploy & run transactions tab
   2. In the Environment drop-down menu, choose "Injected Provider - MetaMask". Don't forget to approve in the pop-up.
   3. Next to the Deploy button, enter the address of the random beacon:

* Velas Mainnet: `0x8f5FE77380B83BaA7365ccc9956EB0594859F9E4`
* Velas Testnet: `0x4a301BBC5D999C2AAfa01E299C46C654dA6C0fF7`

In this example, we'll use the Testnet address:

![](/files/5qYnGjITai9Lf2xa4WFd)<br>

After you deploy your contract, you can interact with it.

Click on the `requestRandomWord` button to request Space Random Beacon.\
\
![](/files/8uaC2zk7TJTtwrfBA6xe)<br>

Your request has now been queued and will be submitted to the satellite. The request can take several hours to return to complete.&#x20;

Once the random number is generated, you can view it by clicking on the `random` button.

\
![](/files/QxMjZuGm6wvHjTc5EmBp)
