Getting Started

To integrate Randcast into your DApp:

  1. Create a Subscription

  2. Fund the Subscription

  3. Build and Deploy the Consumer Contract

  4. Add Consumer to your Subscription

  5. Request Randomness from the Consumer

  6. Process the Randomness Result in your Consumer Contract


  • 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.


  • Zero local development environment setup

  • Minimum command-line experience required

  • Intuitive to less experienced developers


  • Less flexible

  • Hard to debug for complex DApps

  • Less verbose output


  • More verbose output

  • More flexible

  • Easy to debug


  • Requires local development environment setup using Docker

  • Requires command-line experience

  • Requires basic Solidity development experience


  • Most verbose output

  • Most flexible

  • Full programmatic access, easy to automate


  • Requires local development environment setup

  • Requires advanced Solidity development experience

  • Requires experience in Foundry

Last updated