Cryptosat
WebsiteBlogSatellite Tracking
  • Cryptosat
    • 🛰️Satellite tracking
    • 📄SpaceTEE paper
    • Contribution to the Ethereum KZG Ceremony
      • Cryptosat KZG Operation Tracker
      • Crypto2 contribution output
      • Contribution verification
  • Cryptosim
    • Cryptosim
    • Asynchronous API
    • Use-case examples
    • Open-source contribution
  • 🗳️Private Voting
    • Private Voting on Snapshot X
    • Private Voting Contract
    • Browser Side Encryption
  • 🎲random-beacon
    • Verifiable Random Beacon
    • Using the random beacon on-chain
  • API documentation
    • Message Signing
    • Authentication
    • Randomness API
      • Tutorial
      • API reference
    • Queue API
      • API reference
        • Queue
          • Request
          • Requests
    • Public randomness SAPI
      • About
      • API reference
        • Public randomness
          • Result
    • FROST API
      • About
      • API reference
        • Frost
          • Partial sign
          • Private key
      • Specification
    • Satellite Public Keys
  • ⏳Time-based Primitives
    • ⌚Time-based primitives and delay-encryption
    • ⚛️Using Delay Encryption for Atomic Swaps
  • Flastsat Environment
    • Overview
    • Access and Control
    • Crypto Engine Specs
    • Power API
Powered by GitBook
On this page
  1. random-beacon

Using the random beacon on-chain

PreviousVerifiable Random BeaconNextMessage Signing

Last updated 2 years ago

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-

  1. Open

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

  3. Compile ClientContract.sol

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

Click on the requestRandomWord button to request Space Random Beacon.

🎲
ClientContract.sol
ClientContract.sol in Remix