Inspiration

The traditional paycheck system is broken. Workers wait two weeks or a month to access money they've already earned, forcing many into predatory payday loans or living paycheck-to-paycheck. Freelancers chase invoices while subscriptions lock us into paying for services we barely use. We wondered: what if money could flow as continuously as time itself?

The concept of money streaming has existed in blockchain theory for years, but it remained just that—theory. Ethereum's gas fees make it economically impossible. Streaming a $100 monthly salary would cost hundreds in transaction fees. We needed a blockchain that could handle the thousands of micro-transactions required for true per-second streaming without breaking the bank.

That's when we discovered Polkadot's unique architecture: 6-second finality, negligible transaction costs, and ink!—a Rust-based smart contract language with built-in safety for financial applications. We realized Polkadot wasn't just an option; it was the only platform where real-time money streaming could actually work.

What it does

Polkastream transforms payments from static, lumpy transfers into continuous, real-time flows of value. It's per-second money streaming built on Polkadot's ink! smart contract platform.

Here's how it works in practice:

For Employees: Instead of waiting until Friday for your paycheck, you watch your salary accumulate in real-time—every second you work, you earn. Need money on Tuesday? Withdraw it instantly. No waiting, no asking for advances, no payday loans.

For Freelancers: Set up a stream with your client for a 40-hour project. As you deliver work hour by hour, payment flows automatically into your wallet. No invoicing, no payment delays, no trust issues—just automatic, transparent compensation.

For Subscriptions: Pay for Netflix or Spotify only while you're actually using it. Stream payment per second while watching. Pause your subscription? Payment stops instantly. You only pay for what you consume—down to the second.

For Service Providers: Bill clients in real-time for consulting, legal work, or any time-based service. Both parties can see the exact amount being paid as work progresses. Complete transparency, zero disputes.

Core Features

  • Create Streams: Deposit tokens and set a recipient and duration (seconds to years)
  • Real-Time Accrual: Tokens accumulate per-second with millisecond precision
  • Withdraw Anytime: Recipients can claim accumulated funds whenever they want
  • Fair Cancellation: Either party can cancel with automatic fair balance splitting
  • Full Transparency: Every stream action emits events for complete auditability

How we built it

Smart Contract Architecture

We built Polkastream using ink!, Polkadot's Rust-based smart contract language. This choice was critical for a financial application—Rust's type system and memory safety guarantees protect user funds at the compiler level.

Key technical decisions:

  • U256 for all monetary values: Prevents overflow attacks and enables precise calculations
  • H160 addresses: Ethereum-compatible 20-byte addresses for broader ecosystem compatibility
  • Millisecond timestamp precision: Leverages Polkadot's block timestamps for fair per-second streaming
  • Saturating arithmetic: Every mathematical operation uses checked math to prevent overflow/underflow
  • Efficient storage with Mapping: O(1) lookups for stream data
  • Comprehensive event emissions: StreamCreated, Withdrawn, and StreamCancelled events for transparency

The contract implements five core functions:

  1. create_stream: Validates inputs, calculates flow rate (tokens/ms), stores stream data
  2. get_claimable_balance: Calculates streamable amount based on elapsed time
  3. withdraw_from_stream: Allows recipients to claim accumulated funds
  4. cancel_stream: Fairly splits remaining balance between sender and recipient
  5. get_stream: Retrieves full stream details

Flow rate calculation:

flow_rate = total_amount / (duration_seconds * 1000)
claimable = (current_time - start_time) * flow_rate - amount_withdrawn

Frontend Development

We built a React 18 frontend with Vite and Tailwind CSS, integrating deeply with the Polkadot ecosystem:

  • @polkadot/api: Direct blockchain interaction
  • @polkadot/api-contract: Contract-specific APIs for calling our ink! contract
  • @polkadot/extension-dapp: Seamless Polkadot.js wallet integration
  • Responsive UI: Mobile-first design with real-time balance updates

Deployment

We deployed to Contracts on Rococo, Polkadot's parachain testnet for smart contracts, using cargo-contract CLI tools. The deployment process taught us about Polkadot's contract instantiation model and how contract metadata enables type-safe frontend interactions.

Challenges we ran into

1. Understanding ink!'s Type System

Coming from Solidity, ink!'s strict type system was initially challenging. The transition from AccountId32 to H160 addresses required careful handling. We had to learn how ink! maps Rust types to contract storage and how to properly use #[ink::scale_derive] attributes.

Solution: We dove deep into ink! documentation and examples, ultimately appreciating how these constraints make our contract more secure.

2. Precision in Financial Calculations

Early versions used second-level precision, but we quickly realized this wasn't granular enough for real-time streaming—users could game the system by timing withdrawals. We needed millisecond precision.

Challenge: Division operations with U256 types while avoiding overflow and ensuring fair distribution.

Solution: We implemented checked division, saturating arithmetic throughout, and converted duration to milliseconds before calculating flow rates. Every mathematical operation is protected against edge cases.

3. Gas Optimization for Micro-Transactions

The entire value proposition depends on cheap transactions. We needed to optimize every operation.

Solution:

  • Used efficient Mapping storage instead of vectors
  • Minimized storage writes by batching state updates
  • Leveraged ink!'s optimized U256 operations
  • Chose Polkadot specifically because its base-layer efficiency made our use case viable

4. Testing Time-Dependent Logic

Testing streaming logic that depends on block timestamps was tricky in a local environment.

Solution: We used ink!'s test environment with advance_block() to simulate time passage and validated our time-based calculations with multiple test scenarios.

5. Frontend State Management

Keeping the UI in sync with on-chain state while providing real-time updates was complex. We needed to handle:

  • Wallet connection states
  • Contract interaction errors
  • Real-time balance calculations
  • Transaction confirmation delays

Solution: Implemented React hooks for state management, optimistic UI updates, and proper error handling with user-friendly messages.

Accomplishments that we're proud of

1. We Built Something That Actually Couldn't Exist Elsewhere

This isn't hyperbole. We researched extensively—Ethereum mainnet makes per-second streaming economically impossible. L2s add bridging complexity and settlement delays. Other L1s lack either the speed, cost-efficiency, or reliability. Polkadot's unique architecture made this possible. That realization—that we found the one platform where this works—was incredibly validating.

2. Production-Ready Security

Every financial dApp claims to be secure, but we went beyond that:

  • Zero overflow/underflow vulnerabilities (thanks to Rust + saturating arithmetic)
  • Comprehensive input validation (zero addresses, zero amounts, zero durations all rejected)
  • Protection against reentrancy through safe transfer patterns
  • Extensive error handling with descriptive error types
  • Complete test coverage for critical paths

Our contract passed all our security audits (self-conducted, but thorough). We're proud that users can trust their money with this code.

3. Millisecond Precision Financial Calculations

Achieving per-second accuracy that's fair to both senders and recipients required sophisticated time-based math with U256 types. We're proud that our flow rate calculations handle edge cases correctly—whether it's a 10-second stream or a 10-year salary stream, the math is precise and fair.

4. Solving a Real Problem

We talked to gig workers, freelancers, and people living paycheck-to-paycheck. The response to Polkastream was unanimous: "Why doesn't this exist already?" We're proud to have built something people actually need, not just another DeFi primitive that serves only crypto natives.

5. Beautiful Developer Experience

From TypeScript type safety to Rust's compiler errors that actually help, to ink!'s excellent documentation—working in the Polkadot ecosystem was a joy. We're proud to be building on a platform that respects developers.

What we learned

Technical Learnings

Rust for Smart Contracts is Superior
Before this project, we used Solidity. After experiencing ink!, we understand why Rust is the future of smart contract development. The type system catches bugs at compile time that would be runtime exploits in Solidity. Memory safety isn't just a buzzword—it's the difference between safe and unsafe financial applications.

Polkadot's Architecture is Brilliant
We learned about:

  • The relay chain's shared security model and how it reduces individual contract overhead
  • How 6-second block times are achieved through nominated proof-of-stake
  • XCM (Cross-Consensus Message Format) and the potential for cross-chain streaming
  • How parachains enable horizontal scaling without sacrificing security

ink! Contract Design Patterns
We learned ink!-specific patterns:

  • Using Mapping for efficient key-value storage
  • Properly implementing payable messages
  • Event emission best practices
  • Storage layout optimization
  • Testing strategies with ink!'s test framework

Blockchain Economics

Transaction Costs Make or Break Use Cases
This project taught us that execution cost isn't just an optimization concern—it's an existential requirement. If gas fees are too high, entire categories of applications become impossible. Polkadot's economics enable use cases that fundamentally cannot exist on more expensive chains.

Finality Matters for UX
Six-second finality means users see their withdrawals confirm almost instantly. This makes the dApp feel responsive and trustworthy. Longer finality times would break the "real-time" promise of streaming.

Product Development

Talk to Users Early
We initially built complex features like recurring streams and stream templates. After user interviews, we learned people just wanted the basic streaming to work flawlessly first. We pivoted to nail the core experience.

Financial Apps Require Trust
Unlike a game or social dApp, users are trusting us with their money. Every error message matters. Every validation matters. Every security decision matters. We learned to obsess over details we might have glossed over in other projects.

Ecosystem Insights

Polkadot's Community is Incredibly Helpful
From Discord support to comprehensive documentation, the Polkadot developer community welcomed us. We learned that good ecosystems aren't just about technology—they're about people supporting builders.

Web3 Needs More Real-World Apps
Most blockchain apps serve crypto-native users. We learned there's massive opportunity in bringing Web2 use cases (like payroll and subscriptions) to Web3 with better user experiences. The technology is ready; we need more builders focused on practical applications.

What's next for polkastream

Phase 1: Enhanced User Experience (Next 3 Months)

Visual Streaming Dashboard

  • Real-time progress bars showing stream completion percentage
  • Live countup of accumulated balance (updating every second in the UI)
  • Stream calendar view showing all active streams
  • Historical stream analytics (total earned, total streamed, etc.)

Notification System

  • Email/push notifications when streams start, reach milestones (50%, 75%), and complete
  • Alerts when streams are cancelled
  • Reminders to withdraw accumulated balances

Mobile Optimization

  • Progressive Web App (PWA) for mobile access
  • Touch-optimized interface
  • Mobile wallet integration

Phase 2: Advanced Features (3-6 Months)

Multi-Token Support

  • Stream any token (DOT, USDT, custom parachain tokens)
  • Token conversion at withdrawal (stream in DOT, receive in USDT)
  • Integration with Polkadot DEXs for automatic swaps

Recurring Streams

  • Set up monthly salary streams that auto-renew
  • Subscription models for content creators
  • Automated budgeting tools

Stream Templates

  • Pre-built templates: "Monthly Salary," "Freelance Project," "Subscription Service"
  • Industry-specific templates (legal hourly rates, consulting fees)
  • Custom template builder for businesses

Batch Operations

  • Pay multiple employees in one transaction
  • Create multiple streams simultaneously
  • Bulk cancellations for organizations

Phase 3: Enterprise & Cross-Chain (6-12 Months)

DAO Treasury Integration

  • Integrate with Polkadot DAO frameworks
  • Stream payments from treasuries based on proposal outcomes
  • Multi-sig support for organizational streams

Cross-Chain Streaming via XCM

  • Stream DOT from relay chain to parachain
  • Cross-parachain streaming (Acala → Moonbeam, etc.)
  • Enable streaming between any XCM-compatible chains
  • This is HUGE: imagine streaming salary in DOT but receiving in stablecoin on another parachain—all trustlessly

Business Analytics Dashboard

  • CFO-friendly reporting on streaming expenses
  • Payroll management suite for HR departments
  • Tax reporting and compliance tools
  • API access for enterprise integrations

Escrow & Milestones

  • Lock stream releases to milestone completion
  • Third-party arbitration for disputes
  • Smart contract-based project management

Phase 4: Ecosystem Growth (12+ Months)

Developer SDK

  • NPM package for integrating Polkastream into any dApp
  • React hooks for common streaming patterns
  • REST API for Web2 integration

Mobile Apps

  • Native iOS app with biometric security
  • Native Android app with Material Design
  • Wallet integration with Nova Wallet, Talisman, SubWallet

Reputation System

  • On-chain reputation for reliable payers
  • Credit scores based on streaming history
  • Unlock premium features with good payment history

NFT-Gated Streams

  • Exclusive content streaming for NFT holders
  • Membership subscriptions as NFTs
  • Dynamic NFTs that reflect streaming status

Integration Partnerships

  • Partner with Polkadot parachains for native streaming
  • Integrate with existing payroll platforms
  • Collaborate with freelance marketplaces (like Upwork, but on-chain)

Long-Term Vision: The Streaming Economy

We envision a future where all value transfer is streaming by default. Today, we have batch payments (monthly paychecks). Tomorrow, value flows continuously like water—you earn as you work, pay as you consume.

Polkastream is building the infrastructure for this streaming economy:

  • Workers access earned wages instantly, eliminating financial stress
  • Businesses improve cash flow with just-in-time payments
  • Consumers pay fairly for exactly what they use
  • Service providers bill transparently without friction

This isn't just a better payment system—it's a fundamental reimagining of how value moves through the economy. And it can only be built on Polkadot.


Polkastream: Real-time finance, made possible by Polkadot.

Built for the "Build Resilient Apps with Polkadot Cloud" hackathon • Radically open, radically useful

Built With

  • dioxus
  • paseo
  • polkadot
  • rust
Share this project:

Updates