Switchboard Documentation
  • Switchboard On Demand
  • Understanding Switchboard
    • Introduction
      • Why Switchboard Oracles?
      • Vision & mission
      • Brief History and Key Achievements to Date
      • Switchboard’s Architecture, Tech Stack and Security
        • Trusted Execution Environments (TEEs)
        • Oracle Queues
        • Node Architecture
  • Product Documentation
    • Data Feeds
      • Getting Started with Switchboard Data Feeds
      • Solana / SVM
        • Part 1: Designing and Simulating Your Feed
          • Option 1: Drag-and-Drop Feed Builder
          • Option 2: Designing a Feed in Typescript
        • Part 2: Deploying your Feed On-Chain
        • Part 3: Integrating your Feed
          • Integrating your Feed On-Chain
          • Integrating into Frontends
        • Costs
        • Integrating on Eclipse
      • EVM
        • Part 1: Prerequisites and Quick Start Guide
        • Part 2: Designing and Creating Your Feed
          • Option 1: Drag-and-Drop Feed Builder
          • Option 2: Designing a Feed in Typescript
        • Part 3: Integrating your Feed
          • Integrating your Feed On-Chain
          • Integrating your Feed with Typescript
          • Integrating into Frontends (EVM)
      • Aptos
      • Sui
      • Movement
      • Starknet
      • Optional Features
        • Switchboard Secrets
    • Aggregator
      • How to use the Switchboard Oracle Aggregator
    • Randomness
      • Why Randomness is important?
      • Switchboard's Approach to Verifiable Randomness
      • Tutorials
        • Solana / SVM
        • EVM
  • Tooling and Resources
    • Crossbar
      • Run Crossbar with Docker Compose
    • Switchboard Command Line Interface
    • Technical Resources and Documentation
      • SDKs and Documentation
      • Solana Accounts
      • EVM Identifiers
      • Code Examples (Github)
  • Switchboard Protocol
    • (Re)staking
      • What is (re)staking?
      • What are Node Consensus Networks (NCNs)?
      • What are Vault Receipt Tokens (VRTs)?
      • The Node Partner Program
      • The Switchboard NCN
    • Running a Switchboard Oracle
      • Prerequisites
        • Knowledge about Linux, containers and Self-Hosting
        • Hardware Requirements and AMD SEV SNP
        • Software Requirements
        • Network Requirements
      • Hardware: tested providers and setup
        • OVH
      • Platform: Kubernetes + AMD SEV SNP
        • Bare Metal with Kubernetes (K3s)
      • The Git Repo: Clone Our Code
        • Repo Structure
      • Configuration: Tweaking Configurations
        • cfg/00-common-vars.cfg
        • cfg/00-devnet-vars.cfg and cfg/00-mainnet-vars.cfg
      • Installation: Setup Via Scripts
        • Bare Metal with Kubernetes (K3s) + AMD SEV SNP
  • Frequently Asked Questions and Glossary
    • FAQ
    • Glossary
Powered by GitBook
On this page
  1. Product Documentation
  2. Randomness

Why Randomness is important?

Verifiable randomness is crucial for building trustless blockchain applications like games, lotteries, and fair selection processes. However, generating truly random and verifiable values on-chain is a complex challenge. While the idea of randomness seems simple, its verifiability can add layers of complexity to the application.

The Problem: Many existing solutions for on-chain randomness are vulnerable to manipulation, either by oracles providing the data or by blockchain validators/leaders.

Why can't I just use blockhash?

Using the latest blockhash as a source of randomness is a common, but flawed, approach. Each Solana leader has the power and opportunity to tamper with the randomness. It is trivial for bad-faith parties to collude, making blockhashes inadequate.

What are other solutions?

Ultimately, developers need reliable randomness sources with strong guarantees against manipulation. Let's analyse some common approaches:

Method
Explanation
Adversary(ies)

Oracle Provides Random Value

The Oracle picks a random value for every block.

The Oracle. This defeats the purpose of a decentralised system since it provides total control over the randomness.

Randomness from Elliptic Curve Signatures

A user requests randomness with a unique seed. The oracle responds with Sha256(Ed25519Sign(oracleSigner, seed)).

The Oracle. The Ed25519Signallows a malicious Oracle to produce infinite valid signatures if the user leverages the same nonce, controlling the resulting randomness.

User Secrets (Commit-Reveal Scheme)

User generates a unique secret_key. User commits their wager and Sha256(secret_key). User reveals randomness as Sha256(secret_key + [commit_slot+1].hash)

The User. The scheme creates opportunities for users to collude with block leaders to manipulate the slot hash, undermining the protocol's integrity by leaking the user's key.

Trustless applications are complex, and there is no such thing as a free lunch. Various parties on on-chain applications can exhibit different kinds of adversarial behaviour that ultimately influence randomness. By knowing these common schemes, you can better avoid them.

PreviousRandomnessNextSwitchboard's Approach to Verifiable Randomness

Last updated 2 months ago