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

In this example, we use the example client contract that is available on our Github repository- ClientContract.sol

  1. Go to the compiler tab, as shown below:

  2. Compile ClientContract.sol

  3. Deploy your new contract that consumes our Random Beacon contract:

    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:

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

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

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

Last updated