ARPA Network
Search
K
Comment on page

Getting Started

Step-by-step Randcast Tutorial

To integrate Randcast into your DApp:

  1. 1.
    Create a Subscription
  2. 2.
    Fund the Subscription
  3. 3.
    Build and Deploy the Consumer Contract
  4. 4.
    Add Consumer to your Subscription
  5. 5.
    Request Randomness from the Consumer
  6. 6.
    Process the Randomness Result in your Consumer Contract
Note:
  • Randcast requests are paid via Subscription; you should fund your Subscription in advance to avoid service interruptions.
  • A Consumer Contract is part of your DApp and is used to request and "consume" the randomness from Randcast; any subsequent logic on how to utilize the randomness result can be defined in the callback function within your Consumer Contract.
  • Randcast SDK provides a base implementation of the Consumer Contract, which you can extend to implement your custom logic, like in this simple example.

In this tutorial, we will demonstrate three ways to integrate Randcast into your DApp.
Pros:
  • Zero local development environment setup
  • Minimum command-line experience required
  • Intuitive to less experienced developers
Cons:
  • Less flexible
  • Hard to debug for complex DApps
  • Less verbose output

Pros:
  • More verbose output
  • More flexible
  • Easy to debug
Cons:
  • Requires local development environment setup using Docker
  • Requires command-line experience
  • Requires basic Solidity development experience

Pros:
  • Most verbose output
  • Most flexible
  • Full programmatic access, easy to automate
Cons:
  • Requires local development environment setup
  • Requires advanced Solidity development experience
  • Requires experience in Foundry
Last modified 1mo ago