A High-Performance, Non-Custodial Infrastructure for Global Workforce Payments on Bitcoin & Stacks.
Payrail was born from a fundamental frustration: global payroll is slow, expensive, and opaque. In a world of decentralized teams, why do we still rely on centralized bank silos?
Payrail reimagines payroll as a verifiable on-chain protocol. By anchoring payments to the Bitcoin blockchain via the Stacks Layer 2, we provide businesses with:
- Absolute Financial Sovereignty: No bank can freeze your payroll. No custodian holds your keys.
- Atomic Precision: Payments that either happen perfectly or not at all.
- Trustless Transparency: A public (yet privacy-conscious) ledger of truth for every salary disbursement.
Payrail utilizes a dual-layer architecture to provide a seamless "Web2.5" experienceβthe speed of a centralized app with the security of a trustless blockchain.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER INTERFACE (NEXT.JS 15) β
β ββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββ β
β β Dashboard & Admin β <ββ€ Framer Motion & Tailwind v4 β β
β βββββββββββ¬βββββββββββ ββββββββββββββββββββββββββββββββββ β
βββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββΌββββββββββββββββ ββββββββββββββββββββββββββββ
β EXTERNAL SERVICES β β DATA STORAGE β
β βββββββββββββββββββββ β β ββββββββββββββββββββββ β
β β CoinGecko API β β β β Supabase (PG) β β
β βββββββββββββββββββββ ββββββββββ€ β (Metadata/History)β β
β βββββββββββββββββββββ β β ββββββββββββββββββββββ β
β β Resend/Mailjet β β
β βββββββββββββββββββββ β
βββββββββββ¬ββββββββββββββββ
β
βββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BLOCKCHAIN EXECUTION LAYER β
β ββββββββββββββββββββββ ββββββββββββββββββββββββββββββββββ β
β β Stacks (L2) Node β <ββ€ payrail.clar (Smart Contract) β β
β βββββββββββ¬βββββββββββ ββββββββββββββββββββββββββββββββββ β
βββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββ
β BITCOIN (Finality) β
ββββββββββββββββββββββββββ
The "Crown Jewel" of Payrail is its High-Throughput Batching Engine. Traditional blockchain transfers require a
Inside payrail.clar, we utilize the fold operation to process mass payments. This is an Iterative Map-Reduce style logic that allows us to process up to 20 recipients in one atomic call.
The Benefits:
- Atomic Integrity: If transaction #19 fails due to an invalid address, every previous payment in that batch is rolled back. No one gets half-paid.
- Fee Compression: By bundling, we minimize the data footprint on the Stacks blockchain, reducing total gas costs for the employer significantly.
- Performance: Mass actions that would take 10 minutes manually now happen in a single wallet signature.
Our contract is built for the Stacks 2.1 environment, ensuring high security and clarity.
businesses: Tracks registered wallet addresses and their associatedorg-id.organizations: MapsuintIDs to organization metadata (owner, name).freelancer-registry: A simple validator to ensure recipient addresses are active.
register-business: Entry point for organization owners.create-organization: Initializes a workspace on-chain.execute-payroll: Handles a single, standard STX disbursement.execute-batch-payroll: The core engine for multiple payments.
At Payrail, we operate under the "Don't Trust, Verify" mantra.
Every transaction in Payrail is guarded by Post-Conditions. This is a Stacks-specific security feature that lets the user's wallet say: "I am signing this contract call, BUT if it tries to spend even ONE uSTX more than my selected batch total, fail the entire transaction."
This makes Payrail immune to common smart contract drainage exploits.
The binary for Payrail never sees, stores, or transmits your private keys. All signing happens within your wallet interface (Leather, Hiro, Xverse).
Our custom hook abstracts the complexity of the Stacks JS SDK.
const { executeBatchPayroll, address } = useStacks();
// Triggering a 20-person batch:
await executeBatchPayroll(recipients, "Jan-2026-Payroll");Team management (names, roles, rates) is handled via Next.js Server Actions (src/app/actions/team.ts), which provide a secure, server-side interface to Supabase.
# Clone the repository
git clone https://github.com/QuaddBox/payrail.git
cd payrail
# Install premium dependencies
npm install
# Environment variables
# Copy .env.example to .env.local and fill in your Stacks/Supabase keys
# Run
npm run devWe use Jest and Testing Library for UI verification and Clarinet for smart contract testing.
npm testPayrail represents a shift from "Financial Services" to "Financial Software."
- For Businesses: Tax-ready reporting with immutable blockchain hashes.
- For Workers: Instant global liquidity without waiting for SWIFT or SEPA.
- For the World: A demonstration of Bitcoin's utility beyond a store of value.
- Core Protocol: Deployment of
payrail.clarfor single & batch settlements. - Batching Engine: Support for up to 20 recipients in a single atomic transaction.
- Management Dashboard: Secure organization and recipient management via Supabase.
- Real-time Price Feeds: Integration with CoinGecko for BTC/STX price parity.
- User Interface Design Overhaul and Rebranding: Complete user interface design overhaul and premium rebranding.
- Native USDCx Support: Direct payout integration with Circle's native USDC on Stacks.
- sBTC Integration: Enabling 1:1 Bitcoin-backed payouts as sBTC goes live on Stacks.
- Scheduled Payroll: Implementation of a decentralized cron-layer for automated week-over-week payouts.
- Tax-Ready Exports: Generate cryptographically signed PDF/CSV reports for international tax compliance.
- Multi-Sig Auth: Compatibility with corporate treasury tools like Asigna.
- Tiered Org Permissions: Roles for "Finance Leads" (execute) vs "Auditors" (view-only).
- Advanced Analytics: Visualizing payroll spending, trends, and projected budget burns.
- Direct Fiat On-Ramps: Allowing employers to fund payroll wallets via traditional bank transfers.
This intellectual property is licensed under the MIT License.