BeaconVerificationService

Service responsible for cryptographic verification of drand randomness beacons.

This service implements the complete drand beacon verification pipeline, which includes:

  1. Round validation - Ensuring the beacon round matches the expected value

  2. Randomness validation - Verifying that randomness = SHA256(signature)

  3. Signature verification - Cryptographically verifying the BLS signature

The verification process follows the drand specification and ensures that beacons are authentic and have not been tampered with. All beacons must pass all three checks to be considered valid.

Supported Schemes

This service supports all BLS12-381 signing schemes:

  • pedersen-bls-chained - League of Entropy default network

  • pedersen-bls-unchained - Timelock encryption compatible

  • bls-unchained-g1-rfc9380 - Quicknet network (RFC 9380 compliant)

Usage

Typically used internally by DrandClient, but can be used standalone:

val verifier = BeaconVerificationService()
val chainInfo = // ... fetch from drand API
val beacon = // ... fetch beacon

val result = verifier.verifyBeacon(
chainInfo = chainInfo,
beacon = beacon,
expectedRound = 1000
)

result.onSuccess { verifiedBeacon ->
println("Beacon verified: ${verifiedBeacon.randomness}")
}.onFailure { error ->
println("Verification failed: ${error.message}")
}

See also

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard

Validates that the beacon's randomness field equals SHA-256(signature).

Link copied to clipboard

Validates that the beacon's round number matches the expected round.

Link copied to clipboard
fun verifyBeacon(chainInfo: ChainInfo, beacon: RandomnessBeacon, expectedRound: Long): Result<RandomnessBeacon>

Verifies a beacon against expected round and chain info.

Link copied to clipboard

Verifies the beacon's BLS signature using the chain's public key and cryptographic scheme.