How we added Bitcoin to an EVM-native app (without a seed phrase)

FairWins was born EVM. Every address was twenty bytes of 0x…, every network
was a numeric chainId, every balance read went through an RPC provider, and
every signature came from a passkey-backed ERC-4337 smart account. Then we
decided members should be able to hold, receive, and send actual Bitcoin —
first-class, self-custodied, inside the same account.

Bitcoin is not “another chain” to an EVM app. It’s a different account model
(UTXOs, not balances), a different address universe (four generations of
formats), a different fee market (sat/vB, not gas), and no smart contracts at
all. This post is about the five design decisions that made it fit — and the
guardrails that keep it honest.

1. The wallet nobody has to back up

The hardest question was key management. FairWins deliberately killed the
seed phrase: accounts are WebAuthn passkeys driving P-256 smart accounts.
Bitcoin needs secp256k1 keys. Where do they come from, if not a new mnemonic
we’d force members to write down?

The answer was already in our stack. Our passkey accounts maintain a 32-byte
master seed — created once per account, wrapped under a key derived from
the WebAuthn PRF extension, recoverable on any device with one passkey
ceremony, and shareable across a member’s registered devices. It already
powers our end-to-end encryption. It is, functionally, a seed phrase that
nobody ever sees.

Bitcoin becomes one more consumer of that seed:

masterSeed (32B, PRF-recoverable)
  → HKDF-SHA256(info = "fairwins-btc-seed-v1", 64 bytes)
  → BIP32 root
  → m/84'/0'/0'  native segwit (bc1q…, default)
  → m/86'/0'/0'  taproot      (bc1p…, opt-in)

The HKDF info string gives us domain separation — the Bitcoin tree can never
collide with the encryption keys or any future consumer of the seed. The
paths are bog-standard BIP84/BIP86, which means the wallet is legible to the
wider Bitcoin ecosystem, not a proprietary scheme. Those constants are
frozen in a normative contract in-repo and marked wallet-breaking: funds
live at the derived addresses, so changing them ever requires a versioned
migration, not a refactor.

Recovery falls out for free. Sign in on a new device → one PRF ceremony
unwraps the master seed → standard gap-limit-20 discovery walks the
derivation chain against chain data and rebuilds every address and balance.
There is no Bitcoin backup step because there is no Bitcoin-specific secret.

Everything stays client-side. Private keys and account xpubs never leave the
browser; our backend sees bare addresses (batched, max 50 per call) and
signed raw transactions. That’s the whole interface.

2. A network that isn’t a chainId

Our network registry was a map keyed by numeric EVM chainIds, and dozens of
consumers assume those keys mean “something wagmi can switch to” and
“somewhere contracts are deployed.” The tempting hack — give Bitcoin a fake
number and stuff it in — would have leaked those assumptions everywhere:
contract-address lookups, subgraph routing, wallet switch prompts for a chain
no wallet can switch to.

Instead, Bitcoin lives in a parallel, string-keyed registry: 'bitcoin'
and 'bitcoin-testnet' (testnet4), with their own capability descriptors,
explorer links, and testnet/mainnet pairing. A single type guard —
isBitcoinNetworkId() — sits at every boundary the two worlds share, and a
dedicated test suite pins that no Bitcoin id ever reaches EVM-typed code.

That suite earned its keep before launch: our capability resolver had a
default-network fallback that quietly reported Polygon’s features as
available for unknown ids — meaning Bitcoin would have claimed swap and DAO
support it doesn’t have. The guard-rail test caught it; the fix shipped with
the feature.

Capabilities are self-disclosed and blunt: Bitcoin does portfolio, send,
receive, and Stamps display. It does not do wagers, pools, memberships,
swaps, or gasless anything, and every surface that lists networks says so
rather than hiding the row.

3. A stateless data plane you can turn off

The app needs UTXOs, balances, fee estimates, transaction status, and a
broadcast path. Browsers calling public block explorers directly would leak
members’ full address sets to third parties, with no rate control and CORS
fragility.

We already had a pattern for this: our relay gateway fronts external services
(prediction markets, NFT data) through small self-contained modules with a
fixed pipeline — killswitch → validation → per-IP and global quotas → TTL
cache → normalize to DTOs. Bitcoin became one more module, speaking the
Esplora REST dialect. mempool.space is the default upstream; because Esplora
is the de-facto standard, swapping to blockstream.info or a self-hosted
electrs is a config change, not a code change.

Two details we’d underline for anyone building similar infrastructure:

  • Broadcasts are never retried. A timed-out broadcast may still have
    propagated; a retry loop can double-submit. Reads retry, writes don’t.
  • The whole module is optional. With BTC_ENABLED=false the routes
    return an explicit “disabled” status and every Bitcoin surface in the app
    hides or degrades with an honest message. Ops can also kill it instantly
    mid-incident — and because keys are client-side, members’ funds remain
    theirs and fully recoverable in any standard wallet regardless of what our
    infrastructure is doing.

4. Transactions built like a contract audit

Signing happens entirely in the client with @scure/btc-signer and
@scure/bip32 — audited, zero-WASM libraries from the same family as the
crypto primitives we already ship, so the whole signing path stays auditable
JavaScript in our bundle. We can spend our own P2WPKH and P2TR (key-path)
coins and pay out to every standard destination type: P2PKH, P2SH, bech32 v0,
bech32m v1.

The interesting engineering is in coin selection and fees, where we applied
the same paranoia we’d give a smart contract:

  • Fail-safe classification. Every UTXO is classified before selection:
    spendable, pending (unconfirmed), protected (a Bitcoin Stamp travels
    with it), or unverified (Stamps recognition unavailable). Only
    positively-verified spendable coins may fund a send. This is how Stamps
    protection works: spending a Stamps-bearing UTXO destroys or transfers the
    collectible, so recognition failure defaults to over-protection. The
    degraded state is disclosed in the UI along with exactly how much value is
    protected — total ≠ spendable is always explained, never mysterious.
  • A fee ceiling, enforced twice. Fee quotes (fast/normal/slow, sat/vB)
    expire after 60 seconds. The fee a member confirms becomes a hard ceiling:
    the planner checks it, and the signer independently refuses to produce a
    signature for any transaction whose real fee exceeds it. If the mempool
    moves, the member re-confirms against a fresh quote. The UI can’t promise
    one fee and pay another even if it has a bug — the signing layer won’t let
    it.
  • No dust, no strays. Sub-dust change folds into the fee (reported
    honestly as fee, not vanished); MAX computes everything-spendable-minus-fee
    to the satoshi; selection tests assert exact conservation — inputs equal
    amount + fee + change on every path.
  • Concurrency locks. Coins referenced by an in-flight send are excluded
    from selection until the transaction confirms or is abandoned, so two
    quick sends can’t double-commit the same UTXO. Everything signals RBF.

Address rotation rounds out the receive side: every receive request issues
the next derivation index, cursors never decrease (even against stale local
caches), and old addresses are monitored forever. The local address ledger is
just a cache — chain-driven discovery is the source of truth, which is what
makes recovery trustworthy.

5. Tests that pin the protocol, not the mock

A wallet is the wrong place for “seems to work.” The test strategy leaned on
the fact that Bitcoin’s derivation standards publish reference vectors:

  • Derivation is tested against the official BIP84 and BIP86 vectors, plus
    pinned FairWins fixture vectors that freeze our HKDF domain separation —
    if anyone ever changes a constant, byte-exact assertions fail loudly.
  • Address parsing runs an accept/reject matrix: checksum mutations,
    mainnet/testnet cross-use, EVM addresses pasted by muscle memory, mixed-case
    bech32, unknown witness versions — each with its own member-facing reason,
    because “invalid address” is a uniquely useless error in a four-format
    universe.
  • Coin selection is tested as properties (protected coins never selected,
    MAX leaves zero remainder, no dust outputs exist) rather than examples.
  • The gateway module’s route tests cover the unhappy paths that matter
    operationally: quota breaches, upstream outages, degraded Stamps data,
    cache behavior, and boot-time config validation that fails loudly.

Roughly 250 tests landed with the feature, alongside a security review that
covered key hygiene, fund-loss vectors, and the gateway surface. The review’s
two real findings were both honesty bugs — a capability leak and a gasless
badge that could have appeared on the Bitcoin row — and both were caught by
tests written to enforce disclosure rules, which says something about where
the real risks live in a wallet UI.

What we deliberately didn’t build

No Lightning (on-chain only, for now). No BTC wagers — FairWins escrow is
smart-contract-based and Bitcoin has no contracts; we’d rather not offer a
trust-us version. No server-side anything for keys: no custody, no xpub
sync, no address registry. And no gasless Bitcoin — sponsoring UserOps on an
EVM chain is one thing; misrepresenting who pays a Bitcoin miner is another.
The confirm screen says, in plain words, that you pay the network fee.

The pattern that made all of this tractable: derive from what you already trust, isolate what doesn’t fit, and disclose everything the system can’t do. The passkey seed gave us self-custody without new backup burdens; the
parallel registry kept a UTXO chain from contaminating EVM assumptions; and
the honesty rules — stale-not-zero balances, pending-not-final deposits,
fee ceilings, capability self-disclosure — did more for member safety than
any single cryptographic choice.

Bitcoin is FairWins’ first non-EVM network. The seams we cut for it are the
ones the next one will slide through.

Quantum

If you have trouble wrapping your head around the idea of quantum computing or if you are a visual learner looking for a way to learn how it works; the financial times has got you covered. 10 minutes learning today could be all it takes to spark your next great adventure!

https://ig.ft.com/quantum-computing/

Prompt Engineering: Redefining the Art of Storytelling in Entertainment

Introduction

Storytelling has been a vital part of human culture for centuries, and as technology advances, the ways in which we tell stories continue to evolve. Prompt engineering, an AI-driven technology, is now redefining the art of storytelling in entertainment, from movies and television to video games and virtual reality experiences. In this article, we’ll explore how prompt engineering is revolutionizing the entertainment industry, creating immersive, interactive, and personalized stories that captivate audiences like never before.

A New Approach to Storytelling

No alt text provided for this image
A content creator using prompt engineering to generate a captivating, multi-layered narrative that seamlessly adapts to the preferences and emotions of individual users.

By leveraging prompt engineering, content creators can generate unique and engaging narratives that adapt to the preferences and choices of individual users. This cutting-edge AI technology allows storytellers to explore new concepts and styles, pushing the boundaries of traditional storytelling and enriching the entertainment landscape.

The Rise of Interactive and Personalized Narratives

No alt text provided for this image
Visualize a metaverse movie theater, where virtual characters come to life and interact with the audience, immersing them in a captivating and interactive storytelling experience

Prompt engineering enables content creators to develop interactive and personalized stories, empowering audiences to shape their own narrative experiences. By tapping into the user’s preferences, emotions, and choices, stories can unfold in unique and unexpected ways, fostering a deeper connection with the audience and ensuring a truly memorable experience.

Creating Immersive Worlds

No alt text provided for this image
A futuristic entertainment scene, where virtual and augmented reality blend seamlessly with prompt engineering-generated stories, creating truly immersive and personalized experiences for audiences.

The use of prompt engineering in the entertainment industry not only revolutionizes storytelling but also enhances the creation of immersive worlds. Content creators can generate rich and detailed environments, populated with dynamic and lifelike characters, that draw audiences in and encourage exploration. This level of immersion is particularly valuable in the context of virtual reality and video games, where users can actively participate in the narrative and interact with the environment around them.

The Future of Entertainment

No alt text provided for this image
A futuristic entertainment studio, where creative professionals are collaborating with AI-powered tools and prompt engineering to develop engaging stories and immersive experiences.

As prompt engineering becomes increasingly prevalent in the entertainment industry, it has the potential to transform the way stories are told and experienced. By offering audiences personalized, interactive, and immersive narratives, content creators can forge deeper connections with their audience and redefine the art of storytelling for the digital age. As we continue to explore the limitless possibilities of prompt engineering, we can look forward to a future filled with captivating and innovative entertainment experiences that truly capture the imagination.

The Impact of Prompt Engineering on the Gaming Industry: Unleashing Unlimited Potential

Introduction

The gaming industry is no stranger to embracing cutting-edge technologies, and prompt engineering is no exception. This AI-powered tool is opening up new horizons for game developers and designers, enabling them to create more engaging, immersive, and personalized gaming experiences. In this article, we’ll explore the impact of prompt engineering on the gaming industry and how it’s reshaping the future of gaming.


Revolutionizing Game Design

No alt text provided for this image
Visualize a game developer using prompt engineering to create a diverse range of character designs, each with their own unique appearance, abilities, and backstory, within a highly detailed game environment.

Prompt engineering allows game developers to rapidly generate unique characters, environments, and assets, streamlining the game design process and offering unparalleled creative freedom. This groundbreaking technology enables designers to experiment with various styles and concepts, resulting in innovative and diverse gaming experiences.


Unleashing Interactive Storytelling

No alt text provided for this image
Depict a pivotal moment in a game where the player’s choice dramatically alters the narrative, demonstrating the power of prompt engineering in creating interactive and responsive storytelling.

With the power of prompt engineering, game developers can create highly interactive and dynamic narratives that adapt to player choices and actions. This level of personalization and responsiveness creates a deeply engaging experience, allowing players to truly shape the outcome of the story and forging a strong connection with the game world.


Transforming the Metaverse

No alt text provided for this image
Showcase a bustling metaverse cityscape, teeming with a diverse range of characters, buildings, and experiences, all generated using prompt engineering to create a truly immersive and interconnected virtual world.

As the metaverse continues to grow and evolve, prompt engineering offers unique opportunities for game developers to create immersive and interconnected virtual worlds. By leveraging AI-generated content, developers can build vast, dynamic landscapes filled with diverse characters and experiences, enhancing the overall appeal of the metaverse.


The Future of Gaming

No alt text provided for this image
Illustrate a game development studio where creative professionals are using prompt engineering to generate unique game concepts, characters, and environments that push the boundaries of traditional gaming. –v 5

As prompt engineering continues to make waves in the gaming industry, its potential to transform the way games are designed, developed, and experienced is undeniable. By harnessing the power of AI-generated content, game developers can create captivating and immersive gaming experiences that push the boundaries of what is possible in the world of gaming.