Generalization case: the consent and attestation primitives behind FSL’s behavioral-health platforms — EIP-191 wallet signatures and MerkleAnchor — applied to a clinical practice platform built for a second domain and a second jurisdiction.
Self-hosted Bitcoin settlement and on-chain record integrity for a clinical practice platform
Designed and built end to end by Margarita Montañez Davenport — product, UX/UI, the practice website, the clinical application, and the payment and integrity rails. Live at clinical.futuresystemslab.io.
Working prototype of an owner-controlled clinical record — access granted and revoked by the participant; encryption keys held by the practice in the current build, owner-held keys specified as the end state — built for a jurisdiction where it can be operated.
The platform accepts Bitcoin through a self-hosted, fully validating Bitcoin node and BTCPay Server. The wallet is non-custodial and watch-only: the server holds only what it needs to generate addresses and watch for payments. Each Bitcoin invoice is created from the platform’s own billing records, so every checkout corresponds to an issued invoice in the practice ledger.
Settlement arrives as a signed webhook. The platform verifies each one with HMAC-SHA256 using a constant-time comparison, and automated tests confirm that forged, missing and wrong-length signatures are rejected. A verified settlement is recorded exactly once, keyed on the BTCPay invoice ID, at the amount actually received; an underpayment leaves the invoice partial. A reconciliation sweep runs every 15 minutes and records any settled invoice whose webhook was missed.
Every day, the platform hashes its new records, builds a Merkle tree, and anchors the root to the MerkleAnchor contract on the Ethereum Sepolia testnet. Each record stores its own Merkle proof. The verify page recomputes the root from a record’s leaf and proof, then checks it against the RootAnchored event in the anchoring transaction on chain. Only hashes go on chain: no clinical content and no identifiers.
A $1.00 test invoice, paid on-chain in production, ran end to end: the payment was received and confirmed, the settlement webhook was delivered and accepted with HTTP 200, and exactly one ledger row was written. The first integrity batch anchored 86 records on the Ethereum Sepolia testnet in a single transaction, and records from that batch verify against the on-chain root.