Healthcare / Fintech

On-Chain Payment Rails for a Healthcare Platform

Smart contracts that let a healthcare platform accept ERC-20 payments with per-provider fees, deterministic patient wallets, and recurring billing.

Blockchain and Web3 smart contract development services
Industry
Healthcare / Fintech
Location
USA
Timeline
Multi-phase build

By the numbers

4
Core contracts: registry, factory, processor, subscriptions
0.1%–5%
Configurable per-provider fee range
CREATE2
Deterministic patient wallet addresses
Audited patterns
Reentrancy guards, pausable, access control

The problem

A healthcare platform wanted to add crypto payment support across many providers. That meant variable platform fees per provider, deterministic patient wallet addresses that could be known before creation, support for arbitrary ERC-20 tokens, and recurring subscription billing — all with the security guarantees money movement demands. Building this ad hoc on-chain risks reentrancy attacks, fee abuse, and unpredictable addresses.

What we built

We designed and built a modular Solidity contract suite: a token registry for validated ERC-20 support, a CREATE2-based factory for deterministic patient wallets, a payment processor with configurable per-provider fees and downstream wallet splits, and a subscription manager for recurring billing — hardened with reentrancy guards, pausability, and access control, and covered by an automated test suite.

Our approach

  • Split responsibilities into focused contracts: token registry, wallet factory, payment processor, subscription manager
  • Used CREATE2 so patient wallet addresses are deterministic and predictable before deployment
  • Implemented configurable per-provider fees with a safe default and hard caps, plus downstream wallet splits
  • Applied ReentrancyGuard, Pausable, and Ownable patterns with input validation throughout
  • Built a Hardhat project with unit and integration tests and gas-optimized storage patterns
  • Provided deploy scripts for local, testnet, and mainnet with contract verification

Results & outcomes

  • Platform can accept any supported ERC-20 token with validation and amount limits
  • Per-provider fee rates with a safe default and maximum caps to prevent abuse
  • Deterministic patient wallet addresses via CREATE2 — predictable before creation
  • Automated recurring billing through a dedicated subscription manager
  • Security patterns (reentrancy, pausable, access control) backed by a passing test suite

On-chain payment rails

Analysis

Payment contracts fail in expensive, irreversible ways, so the architecture optimizes for predictability and safety over cleverness. Splitting responsibilities across four focused contracts keeps each one auditable; CREATE2 makes patient wallet addresses knowable before they exist, which is critical for reconciling payments to patients; and per-provider fees with a safe default plus hard caps prevent both misconfiguration and abuse. ReentrancyGuard, Pausable, and Ownable patterns alongside an integration test suite are table stakes for moving real money on-chain.

Related topics

smart contract developmentERC-20 payment processorCREATE2 wallet factoryhealthcare crypto paymentsSolidity subscription billingHardhat smart contractsblockchain payment integration

← Back to all work