# Remix

### Deploy Consumer Contract Example

1. Open [`Remix`](https://remix.ethereum.org/) and clone the following repo: <https://github.com/ARPA-Network/Randcast-User-Contract>

<img src="https://4225144415-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAMqVaf96VXudHYNn7sZ%2Fuploads%2F5grhJGVjd7nhJwXGKEK0%2Fimage.png?alt=media&#x26;token=46a6cfb3-69af-41fc-919c-48272bc13187" alt="" data-size="original">

2. Open one of the examples (We will use the roll dice example here):  `contracts/user/examples/RollDiceExample.sol`&#x20;
3. Click `Compile`.
4. Click `Deploy & run transactions` on the left sidebar, connect wallet and select `Injected Provider` as environment. You'll see the connected account if it's all set up.

![](https://4225144415-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAMqVaf96VXudHYNn7sZ%2Fuploads%2Fx7xsfsAN1PvLkyvVElSq%2Fimage.png?alt=media\&token=1e5fc756-1980-4241-a4ab-deaf97d749ac)

5. Pass in the [`Adapter` address](https://docs.arpanetwork.io/randcast/supported-networks-and-parameters), click `Deploy`, and approve the transaction in your wallet (Metamask). Note: Next time you open [`Remix`](https://remix.ethereum.org/), you can enable the deployed contract by compiling, passing the contract address then clicking `At Address`.
6. After the contract deployment has completed,  you will see the `ROLLDICEEXAMPLE` in the below `Deployed Contracts` section.&#x20;
7. Copy the address of deployed consumer contract and bind it to your subscription via the subscription portal.

<figure><img src="https://4225144415-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAMqVaf96VXudHYNn7sZ%2Fuploads%2FzQnKg8Qtq162ZyfRD6zA%2Fimage.png?alt=media&#x26;token=bbd283cd-7816-412f-bc57-7ab8600efc04" alt=""><figcaption></figcaption></figure>

### Request Randomness to Roll Dice

1. Make sure you have created an active subscription with enough funds and the consumer contract has been added to the subscription. (see [Subscription Management Portal - Consumers](https://docs.arpanetwork.io/randcast/getting-started/subscription-management-portal#consumers))
2. Click `ROLLDICEEXAMPLE` to expand the available functions.

![](https://4225144415-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAMqVaf96VXudHYNn7sZ%2Fuploads%2FVPfB4Q1aiCdjTnvEtGee%2Fimage.png?alt=media\&token=322206d6-b54c-4ba6-9b46-d762703b982b)

3. Specify "bunch" (the number of dice you want to roll) and then click `rollDice.`

***Note**: A `Gas estimation failed` notification will pop up when the ETH balance in your wallet is too low to send the transaction, or if the consumer contract is not bound to any subscription.*

![](https://4225144415-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAMqVaf96VXudHYNn7sZ%2Fuploads%2F9aSatG7fqFrZhRM7tqOq%2Fimage.png?alt=media\&token=bc6c54f3-b078-4377-9473-ee56a13b008c)

4. Call `lengthOfDiceResults()` to see whether the output is the same as the `bunch` value you passed. Call `diceResults` with the index up to the `bunch` to check the output of each dice cast.

Congratulations on successfully requesting randomness from Randcast! Randcast provides a set of tools to help you write your custom consumer contract and manage your subscription. Please continue reading to learn more.
