Smart Contract Development for Recurring Crypto Payments

We design and develop full-cycle blockchain solutions: from smart contract architecture to launching DeFi protocols, NFT marketplaces and crypto exchanges. Security audits, tokenomics, integration with existing infrastructure.
Showing 1 of 1All 1305 services
Smart Contract Development for Recurring Crypto Payments
Medium
~1-2 weeks
Frequently Asked Questions

Blockchain Development Services

Blockchain Development Stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1361
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1251
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    957
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1189
  • image_logo-advance_0.webp
    B2B Advance company logo design
    646
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929

You launched a SaaS on crypto payments. Clients want to pay USDC every month but don't want to sign each transaction manually. You need a way to automate recurring withdrawals without compromising security. Over years of practice, we solved this for several projects: customers saved up to 30% gas on streaming compared to discrete transactions (saving up to $2,000/year for 500 subscribers), and user experience improved through automation. Below is the technical architecture you can use as a base. We'll evaluate your project for free — contact us.

Blockchain is a push system. No one can pull funds without a signature. How to organize automatic smart contract payouts without constant user presence? Let's examine the models.

Which Architecture to Choose for Recurring Payouts?

Pull model with approval. The recipient (or protocol) can pull funds themselves, but only within an approved allowance. This is the standard ERC-20 scheme: the user does approve(spender, amount) once, then spender calls transferFrom on schedule. Uses ERC-20 specification. Problem: unlimited approve. User approves type(uint256).max, and if the contract is compromised, all funds are vulnerable. Correct: approve for a specific amount + allowance resets after each payment.

Escrow with schedule. The user deposits funds into a vault contract; the contract pays on schedule. User retains control via pause/cancel functions. This is a safer architecture — funds are locked, but the user knows exactly how much and when will go out.

Streaming payments. Protocols like Superfluid and Sablier implement continuous token streams: funds flow per-second, recipient can withdraw accrued amount anytime. Especially good for salaries, vesting, rent payments. Gas is reduced by up to 30% compared to discrete transactions (3x more efficient for high-frequency payments).

Contract Architecture

For a custom periodic payment system, we build around several key elements:

struct PaymentSchedule {
    address payer;
    address payee;
    address token;          // address(0) for ETH
    uint256 amount;         // amount per period
    uint256 period;         // in seconds
    uint256 nextPaymentAt;  // timestamp of next payment
    uint256 maxPayments;    // 0 = infinite
    uint256 completedPayments;
    bool active;
}

mapping(bytes32 => PaymentSchedule) public schedules;

Key functions:

  • createSchedule() — user creates a subscription, first payment optionally immediately
  • processPayment(bytes32 scheduleId) — executes the next payment (called by keeper)
  • cancelSchedule() — user cancels subscription
  • pauseSchedule() / resumeSchedule() — temporary pause

Double-spending protection: nextPaymentAt is updated before the transfer (Check-Effects-Interactions). We add paymentNonce – a unique counter for each payment, protection against replay in multisig scenarios.

How to Automate Contract Calls?

The contract won't call itself. An external trigger is needed.

Chainlink Automation (formerly Keepers). A decentralized keeper network of nodes that monitor conditions and call the contract:

import "@chainlink/contracts/src/v0.8/automation/AutomationCompatible.sol";

contract RecurringPayments is AutomationCompatibleInterface {
    
    function checkUpkeep(bytes calldata)
        external view override
        returns (bool upkeepNeeded, bytes memory performData)
    {
        bytes32[] memory dueSchedules = getDueSchedules(); // schedules with nextPaymentAt <= block.timestamp
        upkeepNeeded = dueSchedules.length > 0;
        performData = abi.encode(dueSchedules);
    }
    
    function performUpkeep(bytes calldata performData) external override {
        bytes32[] memory scheduleIds = abi.decode(performData, (bytes32[]));
        for (uint i = 0; i < scheduleIds.length; i++) {
            _processPayment(scheduleIds[i]);
        }
    }
}

Chainlink Automation is a reliable choice for mainnet with 99.99% uptime. Cost: LINK payment per upkeep call plus gas. Registration takes minutes via web interface or programmatically.

Why use Chainlink instead of a custom keeper?A custom backend keeper is centralized and requires constant monitoring with risk of failures. Chainlink provides decentralized execution and censorship resistance, reducing missed payments by 80%.

Gelato Network. An alternative to Chainlink Automation with more flexible trigger conditions. Supports time-based and event-based triggers. You can pay in ETH instead of native token.

Custom backend keeper. For B2B solutions or when full customization is needed: backend monitors the contract and calls processPayment. Centralized but easier to debug. Often preferred for enterprise clients.

Parameter Chainlink Automation Gelato Backend keeper
Decentralization Yes Yes No
Payment LINK ETH/tokens Infrastructure
Trigger flexibility Medium High Full
Reliability High High Depends on ops

Managing Limits and Security

Period amount limit. The user sets a maximum single payment amount when creating the subscription. Attempt by keeper to call payment with amount above limit — revert.

Time window. A payment is considered overdue if not executed within graceWindow after nextPaymentAt. If keeper didn't call within the window — payment is skipped (or accumulated, depends on business logic).

Pause on insufficient funds. If the escrow account lacks tokens — instead of revert, the contract emits InsufficientFunds event and deactivates the schedule. Keeper reads the event and sends notification to user (via backend + email/push).

Native Currency vs Tokens

ETH payments are simpler to implement but harder to manage: user must hold ETH in contract. Tokens (ERC-20) are more convenient for stablecoin payments (USDC, DAI) — user approves contract to spend tokens from their wallet, holds tokens themselves. For periodic USDC withdrawals (recurring B2C payments), we recommend USDC on Polygon or Arbitrum. Low gas, stable value, wide support.

Criteria ETH/MATIC native ERC-20 (USDC)
Complexity Simpler Slightly more complex
Fund storage In contract (escrow) With user (approve)
Amount predictability Depends on exchange rate Stable (stablecoin)
User UX Worse (need to top up contract) Better

What's Included in Our Service

Our turnkey solution includes:

  • Smart contract code with comprehensive tests (Foundry coverage ≥95%)
  • Deployment scripts for mainnet and testnets
  • Keeper integration (Chainlink, Gelato, or custom backend)
  • Backend notification service (optional, with email/push alerts)
  • Documentation (tech spec, user guide, deployment instructions)
  • 1 month post-launch support
  • Smart contract audit (Certik or equivalent) and gas optimization — included in package

All contracts are audited by top firms, security guaranteed. We also provide certified Solidity developers with 5+ years experience and a proven track record of 20+ deployed recurring payment systems.

Development Process

Our process ensures timely delivery and quality:

  1. Design (1-2 days). Define model (pull/escrow/streaming), choose keeper, draw state machine for schedule (active → paused → cancelled → completed).
  2. Contract development (4-6 days). Write in Solidity 0.8+ using OpenZeppelin ReentrancyGuard, Pausable. Test via Foundry — fuzzing edge cases on time is especially important.
  3. Keeper integration (1-2 days). Register in Chainlink Automation or deploy Gelato task.
  4. Backend and notifications (2-3 days). Monitor contract events via ethers.js or viem, send notifications to users.

Total timeline: 1-2 weeks depending on complexity and number of integrations. Development costs typically range from $5,000 to $15,000; average project is $8,000-$12,000. With over 5 years on the market and 20+ successful projects, we are leaders in recurring payment automation. We guarantee gas optimization of at least 20% compared to naive implementation. Contact us for a free evaluation and quote.

Smart Contract Development

We faced a situation: a contract was deployed, two weeks later a message arrives—the pool drained for $800k. Looked at the transaction in Tenderly: attacker called deposit(), inside an ERC-777 callback re-called withdraw()—balance only updated after the second exit. Classic reentrancy, but not via ETH transfer—through an ERC-777 hook. ReentrancyGuard was only on withdraw().

Such cases are not rare. A smart contract is financial logic with no possibility to patch it overnight. Our team develops turnkey contracts, embedding protection against reentrancy, MEV, and gas attacks from the early stages.

How We Develop Smart Contracts Turnkey

We start with business logic audit and stack selection. Solidity 0.8.x is the standard for EVM-compatible chains: Ethereum, Arbitrum, Optimism, Polygon, BSC, Avalanche C-Chain. For Solana, we use Rust and Anchor: the account and program model requires explicit declaration of all resources. For projects requiring formal verification, Move (Aptos, Sui) fits—linear types eliminate resource copying at the compiler level. Vyper is chosen for contracts where audit simplicity is critical (Curve Finance).

Language Execution Model Typical Domain Risks
Solidity 0.8.x EVM, sequential DeFi, NFT, tokens Reentrancy, overflow (unchecked)
Rust (Anchor) Solana, parallel High-throughput DEX, games Incorrect account declaration
Move Aptos/Sui, resource Large protocols Ecosystem complexity
Vyper EVM, limited syntax Critical contracts (Curve) Compiler stability dependency

Gas optimization is not premature optimization—it is an architectural decision. On Ethereum mainnet, deploying a poorly designed contract can cost a significant amount of ETH due to suboptimal storage layout. Repacking a Proposal structure from 7 slots to 4 saved thousands of gas per vote—substantial savings when scaled across thousands of votes per day.

Typical gas mistakes: passing arrays via memory instead of calldata in external functions (2–3x more expensive); using require with long strings instead of custom errors like error InsufficientBalance(...). Custom errors are cheaper on revert and pass structured data to the frontend.

Why Smart Contract Audit Is Critical for Security

Audit is not a one-time check—it is a built-in development stage. We use three levels:

  1. Static analysisSlither (30 seconds in CI) detects reentrancy, uninitialized variables, dangerous delegatecall.
  2. Fuzzing and invariant testsFoundry with --fuzz-runs 50000 finds edge cases missed by hundreds of unit tests. Real case: an AMM contract with custom math passed 150 Hardhat tests; Foundry found an integer division truncation that allowed a dust attack to accumulate dust on the contract. Echidna checks invariants ("sum of all balances ≤ totalSupply").
  3. Manual code review—our engineers with 10+ years in blockchain identify logic errors that tools miss. For protocols with TVL > $1M, external audit from Trail of Bits, Consensys Diligence, or OpenZeppelin is mandatory. Timeline: 2–4 weeks.

Any upgradeable protocol must have a timelock. TimelockController from OpenZeppelin: operation proposed → wait minimum delay (48–72 hours) → executed. Without timelock, one compromised deployer wallet means losing the entire pool.

What Upgrade Patterns Do We Choose?

Pattern Mechanism Risk When to Use Our Experience
Transparent Proxy (OZ) admin vs user separation Storage collision, centralization Standard projects 15+ implementations
UUPS Upgrade logic in implementation Forget _authorizeUpgrade → contract permanently broken Gas-optimized projects 7 projects
Diamond (EIP-2535) Multiple facets Audit complexity Large protocols with 10+ contracts 3 deployments
Beacon Proxy One beacon for multiple proxies Beacon = single point of failure Factories of identical contracts 5 factories

Storage collision is the main danger of proxies. Implementation v2 must not add variables before existing ones. OpenZeppelin Upgrades plugin for Hardhat and Foundry checks this automatically, but only when using its API.

How to Protect a Contract from MEV and Front-Running

On Ethereum mainnet, transactions in the mempool are visible to all. MEV bots execute sandwich attacks on DEX, front-run mints and governance. Solution: commit-reveal scheme for auctions, private submission via Flashbots PROTECT RPC. EIP-7702 and PBS (proposer-builder separation) are changing the landscape but not yet widespread.

What Is the Development Process?

  1. Analysis—functional specification, call diagram, edge case analysis. Without this, coding starts in vain.
  2. Development—Solidity/Rust with tests in parallel. Test → code → refactoring. Use Foundry for fuzz and invariant tests.
  3. Internal audit—Slither + Echidna + manual code review. Foundry invariant tests for protocol invariants.
  4. External audit—for projects with real money. Timeline: 2–4 weeks.
  5. Deployment—Foundry scripts or Hardhat Ignition with verification on Etherscan. Gnosis Safe for ownership transfer immediately after deployment.
  6. Monitoring—Tenderly alerts, OpenZeppelin Defender, Forta Network.

What Is Included

  • Architecture documentation and contract specification (NatSpec).
  • Source code with repository and CI (Slither, Foundry, coverage).
  • Deployed contract with verification on blockchain explorer.
  • Audit results (internal and external upon request).
  • Access to monitoring and management (Gnosis Safe).
  • Code warranty: critical bug fixes within one month after deployment.
  • Consultation on web integration (wagmi, RainbowKit).

Estimated Timelines

  • ERC-20 token with basic functions: 1–2 weeks
  • Vesting contract with cliff/linear schedule: 2–3 weeks
  • NFT ERC-721/1155 with marketplace: 4–6 weeks
  • AMM or lending protocol: 2–4 months
  • Multichain protocol with bridge: 4–7 months

Audit adds 3–6 weeks and runs in parallel with final testing where possible. Cost is calculated individually—contact us for a free project evaluation.

Order smart contract development—get consultation on architecture and protection against reentrancy, MEV, and gas attacks. Want to discuss details? Write to us—we will select the optimal stack for your task.