verifyBeacon

fun verifyBeacon(chainInfo: ChainInfo, beacon: RandomnessBeacon, expectedRound: Long): Result<RandomnessBeacon>

Verifies a beacon against expected round and chain info.

Performs comprehensive validation in the following order:

  1. Validates beacon format (required fields present and valid)

  2. Validates round matches expected round

  3. Validates randomness equals SHA256(signature)

  4. Verifies BLS signature using chain's public key

Return

Result.success containing the verified beacon if all checks pass, or Result.failure with DrandError describing what failed

Parameters

chainInfo

The chain configuration containing public key and signing scheme

beacon

The beacon to verify

expectedRound

The expected round number (typically the round you requested)