SShortSingh.
Back to feed

How to verify drand randomness beacons in your app using 30 lines of code

0
·2 views

Developers building agents that rely on random numbers often use HTTP relay APIs, but these relays cannot be independently trusted to deliver unaltered data. The drand project, operated by the League of Entropy, publishes a public randomness beacon every three seconds using BLS signatures, allowing anyone to verify results offline with a pinned public key. By fetching the same round directly from drand's own endpoint and comparing it against the relay's response, developers can confirm the beacon has not been tampered with or replayed. A small code example using the drand-client npm package demonstrates how to perform this cross-verification in under 30 lines. The approach reduces reliance on relay trust and enables reproducible, auditable random sampling for use cases like reviewer selection, tie-breaking, or raffles.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

What Working on a Japanese Engineering Team Actually Looks Like Day to Day

Daily work on Japanese engineering teams centres on frequent status updates rooted in the cultural practice of hou-ren-sou, where communicating problems early is valued over working silently. Technical decisions are engineer-led but go through multiple rounds of review involving many stakeholders, making approvals slower yet smoother to execute once reached. Overtime is legally capped under Japan's 2019 labour reforms, but the limits still permit close to 80 hours of overtime monthly, and violations carry criminal penalties. Foreign engineers are often caught off guard by 'fixed overtime pay', a common salary structure where a set number of overtime hours is already bundled into the headline figure, effectively lowering the real base pay. Candidates are advised to ask explicitly during interviews whether a salary includes fixed overtime and how many hours are assumed.

0
ProgrammingDEV Community ·

New Attention Technique Cuts Transformer KV Cache Memory by 45% With Minimal Accuracy Loss

Grouped Value Attention (GVA) is a new approach to transformer memory management that reduces persistent key-value cache scalars by approximately 45–47% compared to existing grouped-query attention methods. Instead of storing a full key matrix, GVA stores only grouped values and reconstructs keys on the fly during decoding. Tested on a 350-million-parameter model across five tasks, GVA matched GQA's average accuracy to within 0.01 points. Separately, DeepSeek-V4.1-Flash achieves even greater compression, shrinking its KV cache footprint to around one-eighth of its predecessor while reportedly improving performance. Both approaches show promise for enabling longer context windows on less powerful hardware, though real-world latency and throughput gains on commodity GPUs have yet to be confirmed.

0
ProgrammingDEV Community ·

How a calibration flaw taught a fraud detection AI to approve fraudulent transactions

A developer building an AI-powered fraud investigation system on TigerGraph discovered that a miscalibrated risk score threshold was causing the agent to incorrectly clear fraudulent transactions as legitimate. The system was designed as an agentic investigator using LangGraph and a TigerGraph graph database, where the AI gathers evidence iteratively before recommending an action and approval route. A key architectural decision kept all regulatory-critical logic — including the Bayesian ledger, policy engine, and approval routing — in a separate core module that is structurally prevented from importing any LLM library. To retrieve relevant past cases, the system fuses vector similarity search with graph traversal, addressing the shortcomings of using either method alone. The project highlights how measurement and calibration errors in underlying data can silently undermine even well-architected AI decision systems.