{
  "id": 7091580,
  "title": "Building VALYVRA: two authentication lessons from a Web3 prototype",
  "url": "https://urgent.news/2026/09/13/building-valyvra-two-authentication-lessons-from-a-web3-prototype",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-13T10:01:52.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/joy_valyvra/building-valyvra-two-authentication-lessons-from-a-web3-prototype-1c1"
  },
  "original_language": "en",
  "account": "VALYVRA is a Web3 prototype designed to explore alternative ways of connecting asset value with demand. The platform aims to create liquidity by running prize draws involving real-world goods and experiences, with blockchain-based verification of certain aspects of the process. The goal is still a hypothesis, as a working prototype cannot establish demand, validate an asset's price, or guarantee a successful sale.\n\nThe source material chronicles the development process behind VALYVRA's authentication service, which is built using Python, SQLite, Flask, and Nginx. The authentication service runs under Gunicorn with two worker processes, and Nginx forwards requests to it. The SQLite database stores account and authentication state.\n\nTo address concurrency issues, the team modified the verification flow to use two short transactions. The first transaction reserves an attempt atomically, checking challenge and user state, incrementing the counter, and committing. The second transaction performs verification outside the write transaction and includes re-reading the challenge and user state to ensure validity and state consistency. Consuming the challenge and creating the session occur within the same transaction.\n\nThe second lesson pertains to connection lifetime. In Python's sqlite3 module, a connection's context manager handles transaction commit and rollback but does not close the connection. The team made connection closure explicit by using two context managers: one for transaction handling and another for connection closure. They updated 27 transaction contexts with explicit connection closure to ensure proper cleanup on exceptions and early returns.\n\nThe updated authentication test suite now includes 44 tests, covering topics such as two-factor verification, rate limits, connection cleanup, and Flask integration. The tests exercise extracted functions with test doubles and run nine through the Flask application. The tests verify competing successful submissions, concurrent invalid submissions, and session-creation failure, among other cases.",
  "summary": "I started VALYVRA with a problem that has little to do with software: owning a valuable asset does not mean being able to sell it when you need to. An owner may face a long wait for a buyer willing to pay a fair market price. Selling sooner can mean accepting a substantial discount. I wanted to explore an alternative way to connect the value of an asset with demand from participants. That is the…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}