{"id":29323863,"url":"https://github.com/longcipher/ledgerflow","last_synced_at":"2025-09-03T02:14:14.499Z","repository":{"id":303232625,"uuid":"1012508614","full_name":"longcipher/ledgerflow","owner":"longcipher","description":"LedgerFlow: Web3 Payment Gateway, Web3 version Stripe","archived":false,"fork":false,"pushed_at":"2025-08-27T10:52:26.000Z","size":2464,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-27T18:53:49.350Z","etag":null,"topics":["circle","contract","create2","eth","indexer","multi-chain","payment","payment-gateway","stripe","telegrambot","usdc","uups","vault","vault-contract"],"latest_commit_sha":null,"homepage":"https://ledgerflow.longcipher.com/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/longcipher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-02T12:46:13.000Z","updated_at":"2025-08-27T10:52:29.000Z","dependencies_parsed_at":"2025-07-07T08:22:59.314Z","dependency_job_id":"9187019f-75ef-479f-b1dd-66226433800f","html_url":"https://github.com/longcipher/ledgerflow","commit_stats":null,"previous_names":["longcipher/ledgerflow-vault","longcipher/ledgerflow"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/longcipher/ledgerflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcipher%2Fledgerflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcipher%2Fledgerflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcipher%2Fledgerflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcipher%2Fledgerflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/longcipher","download_url":"https://codeload.github.com/longcipher/ledgerflow/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcipher%2Fledgerflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273377165,"owners_count":25094531,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["circle","contract","create2","eth","indexer","multi-chain","payment","payment-gateway","stripe","telegrambot","usdc","uups","vault","vault-contract"],"created_at":"2025-07-07T16:44:05.975Z","updated_at":"2025-09-03T02:14:14.474Z","avatar_url":"https://github.com/longcipher.png","language":"Rust","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"/assets/ledgerflow_banner.png\" alt=\"LedgerFlow Banner\" /\u003e\n\u003c/div\u003e\n\n# LedgerFlow\n\n**Making value flow as freely, efficiently, and borderlessly as information flow.**\n\nLedgerFlow is a modern payment gateway built on blockchain technology, centered around stablecoins (such as USDC). We aim to solve the pain points of current mainstream payment systems (such as Stripe), including high registration barriers, opaque fees, account freezing risks, and difficult appeals.\n\nBy leveraging blockchain's transparency, security, and composability, LedgerFlow provides SaaS service providers, developers, and independent creators worldwide with a **low-barrier, low-cost, high-efficiency, censorship-resistant** payment solution.\n\n## 🔥 First-class x402 Protocol Support (EVM)\n\n- Standards-based paywalls using x402 V1 \"exact\" with USDC EIP-3009.\n- Settlement via PaymentVault.depositWithAuthorization preserves on-chain `DepositReceived(payer, orderId, amount)` linkage.\n- Distributed `orderId` equals the EIP-3009 `nonce` (no central issuance).\n- See details: [Exact scheme notes](./docs/scheme_exact_evm.md)\n\nx402 workflow\n\n```mermaid\nsequenceDiagram\n    participant Client\n    participant Server\n    participant Facilitator\n    participant Blockchain\n\n    %% Step 1 \u0026 2: Initial Request and Payment Challenge\n    Client-\u003e\u003eServer: GET /premium-resource\n    Server--\u003e\u003eClient: 402 Payment Required \u003cbr\u003e WWW-Authenticate: X402 (price, token, facilitator...)\n\n    %% Step 3: Client-side Signing\n    Note over Client: User signs payment authorization \u003cbr\u003e in their wallet to generate authToken.\n\n    %% Step 4: Second Request with Payment Proof\n    Client-\u003e\u003eServer: GET /premium-resource \u003cbr\u003e Authorization: X402 authToken=\"...\"\n\n    %% Step 5-8: Server-side Verification via Facilitator\n    Server-\u003e\u003eFacilitator: POST /verify (authToken, price, token...)\n    Facilitator-\u003e\u003eBlockchain: Submits signed transaction\n    Blockchain--\u003e\u003eFacilitator: Transaction Confirmed\n    Facilitator--\u003e\u003eServer: Verification OK\n\n    %% Step 9: Success and Resource Delivery\n    Server--\u003e\u003eClient: 200 OK \u003cbr\u003e { \"data\": \"...\" }\n```\n\n## Testnet(Unichain Sepolia) Demo\n\n* PaymentVault Contract: [0x8b6f22009ae835795b9b33d75ad218c730db039b](https://sepolia.uniscan.xyz/address/0x8b6f22009ae835795b9b33d75ad218c730db039b)\n* Telegram Bot: [@LedgerFlowBot](https://t.me/LedgerFlowBot)\n* USDC Faucet: \u003chttps://faucet.circle.com/\u003e\n* Unichain Faucet: \u003chttps://docs.unichain.org/docs/tools/faucets\u003e\n* MVP Demo video: \u003chttps://youtu.be/YedfwqCenMQ\u003e\n\n## Aptos Testnet Demo\n\n* PaymentVault Contract: [0xd2b5bb7d81b7fa4eeae1b5f6d6a8e1f9cdc738189a1dcc2315ba4bb846](https://aptoscan.com/account/0xd2b5bb7d81b7fa4eeae1b5f6d6a8e1f9cdc738189a1dcc2315ba4bb846?network=testnet)\n* Deposit tx: [0x93e242a077c1424b1ff64e2dfafd7b965a77ed4f4f381e74615a76b1c14a7e58](https://aptoscan.com/transaction/6812053128?network=testnet)\n* Withdraw tx: [0x28a2e327961686fdaa0e3bf1ea5ef1a342019044fe161b7ea9d61417e4c1e38b](https://aptoscan.com/transaction/6812054574?network=testnet)\n\n## Arch\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"/assets/ledgerflow_arch.png\" alt=\"LedgerFlow Arch\" /\u003e\n\u003c/div\u003e\n\n## 🎯 Problems We Solve\n\nCurrent centralized payment gateways, while powerful, have inherent flaws that create barriers for emerging digital economies and global collaboration:\n\n- **High Entry Barriers**: Must register a company entity to open an account, excluding many independent developers and small teams\n- **Account Freezing Risk**: Platforms have unilateral power to freeze accounts, lack of fund security guarantees, lengthy and low-success appeal processes\n- **Complexity \u0026 Learning Costs**: Integrating traditional payment systems requires significant learning costs and development resources\n- **Geographic \u0026 Banking Restrictions**: Business scope limited to supported countries and banking systems, cannot achieve true global coverage\n- **Opaque Fees**: Hidden currency conversion fees, cross-border transaction fees make final costs unpredictable\n\n## 🚀 Our Solution\n\nLedgerFlow fundamentally solves these problems through the Web3 technology stack:\n\n### Core Advantages\n\n- **Permissionless**: Anyone with an EVM address can start receiving payments immediately, no company registration required\n- **Self-Custody**: Funds go directly into on-chain Vault contracts you control, platform cannot freeze or misappropriate funds\n- **Truly Global**: Can receive payments anywhere in the world with internet connection, no geographic restrictions\n- **Transparent Fees**: Fees only include predictable blockchain network Gas fees, no hidden charges\n- **Simple \u0026 Decoupled**: Easy integration through simple APIs, business systems completely decoupled from on-chain funds\n\n## 🏗️ System Architecture\n\nLedgerFlow uses a lightweight decoupled architecture consisting of the following core components:\n\n```text\nledgerflow/                         # Project root directory\n├── ledgerflow-vault-evm/           # EVM smart contracts (PaymentVault)\n│   ├── src/                        # Solidity contract source code\n│   ├── test/                       # Contract tests (Foundry)\n│   ├── script/                     # Deployment scripts\n│   └── ...                         # EVM contract-related files\n├── ledgerflow-vault-aptos/         # Aptos smart contracts (PaymentVault)\n│   ├── sources/                    # Move contract source code\n│   ├── tests/                      # Contract tests\n│   ├── scripts/                    # Deployment scripts\n│   └── ...                         # Aptos contract-related files\n├── ledgerflow-balancer/            # Backend service (business logic core)\n├── ledgerflow-bot/                 # Telegram Bot (user frontend)\n├── ledgerflow-indexer-evm/         # EVM event indexer (on-chain monitoring)\n├── ledgerflow-indexer-aptos/       # Aptos event indexer (on-chain monitoring)\n├── ledgerflow-eth-cli/             # Command-line tool for Ethereum\n├── ledgerflow-aptos-cli/           # Command-line tool for Aptos (Rust)\n├── ledgerflow-aptos-cli-ts/        # Command-line tool for Aptos (TypeScript)\n├── ledgerflow-migrations/          # Database schema management\n└── ...                             # Workspace configuration\n```\n\n### Component Description\n\n1. **PaymentVault Contract (Smart Contract)**\n   * **EVM Implementation**: Solidity-based contracts for Ethereum, Polygon, Arbitrum, BSC, and other EVM-compatible chains\n   * **Aptos Implementation**: Move-based contracts for the Aptos blockchain ecosystem\n   * Serves as the sole entry point and vault for funds, receiving and storing all USDC payments\n   * Supports both standard `approve/deposit` and `permit/deposit` modes\n   * Triggers events for Indexer monitoring, enabling on-chain and off-chain data synchronization\n\n2. **Event Indexers (Blockchain Monitoring)**\n   * **EVM Indexer**: Real-time monitoring of DepositReceived events from PaymentVault contracts on EVM-compatible chains\n   * **Aptos Indexer**: Dedicated indexer for monitoring events on the Aptos blockchain\n   * Supports multi-chain monitoring with separate instances for each blockchain\n   * Parses event data and updates order status to \"completed\"\n\n3. **Balancer (Backend Service)**\n   * Business logic core of the system, providing REST APIs\n   * Handles account management, order creation, status queries, balance calculations, and other business functions\n   * Connects user frontend with off-chain data\n\n4. **Telegram Bot (User Frontend)**\n   * Primary interface for users to interact with the LedgerFlow system\n   * Handles user onboarding, payment initiation, status notifications, balance queries, and other functions\n\n5. **Command Line Tools**\n   * **ledgerflow-eth-cli**: Rust-based CLI for EVM blockchain interactions\n   * **ledgerflow-aptos-cli**: Rust-based CLI for Aptos blockchain interactions\n   * **ledgerflow-aptos-cli-ts**: TypeScript-based CLI for modern Aptos development experience\n\n6. **Database Migrations**\n   * **ledgerflow-migrations**: Unified database schema management across all services\n   * Supports PostgreSQL with proper migration versioning and rollback capabilities\n\n## 🔄 Payment Flow\n\n1. **Merchant initiates payment request**: Input \"I want to receive 10 USDC\" through Telegram Bot\n2. **System generates order**: Bot calls Balancer API to generate unique `orderId`\n3. **Display payment details**: Bot shows payer the payment address, amount, and order information\n4. **On-chain payment**: Payer uses wallet to send USDC to PaymentVault contract\n5. **Event monitoring**: Indexer captures DepositReceived event\n6. **Status update**: Indexer updates order status to \"completed\" in database\n7. **Confirmation notification**: Merchant receives payment success notification\n\n## 🌟 Core Features\n\n### x402 Protocol (EVM) — Standards-based Paywalls\n\n- Supports x402 V1 \"exact\" with USDC EIP-3009 for seamless, standards-based paywalls\n- Settlement via PaymentVault.depositWithAuthorization preserves on-chain `DepositReceived(payer, orderId, amount)` linkage\n- Distributed `orderId` equals EIP-3009 `nonce` (no central issuance); verifiable client-side\n- Backend provides `/x402/verify` and `/x402/settle` endpoints for facilitators and agents\n- Learn more: [Exact scheme notes](./docs/scheme_exact_evm.md)\n\n### 1. Non-Custodial Vault\n\n* Uses a single PaymentVault smart contract as the fund aggregation entry point\n* Eliminates complexity and security risks of server private key management\n* Supports secure storage of large amounts of funds\n\n### 2. Comprehensive Multi-Chain Support\n\n* Can be deployed on any EVM-compatible chain (Ethereum, Polygon, Arbitrum, Optimism, Base, BNB Chain, etc.)\n* Supports non-EVM blockchains through dedicated implementations (Aptos with Move language)\n* Merchants can freely choose to enable payment collection on one or multiple chains based on needs\n* Specialized indexers support monitoring across different blockchain architectures\n\n### 3. Programmable \u0026 Composable\n\n* **Subscription payments**: Support time-locked automatic deduction subscription models\n* **DeFi integration**: Idle funds can be combined with Staking, Lending and other protocols to generate additional yield\n* **Multi-currency support**: Can be combined with DEX aggregators to support payments in any token\n\n### 4. User-Friendly Payment Experience\n\n* Supports EIP-2612 permit signatures for \"user-side gasless\" experience\n* One off-chain signature completes authorization and payment\n* Greatly improves conversion rates and user experience\n\n## 🎯 Quick Start\n\nFor detailed usage instructions, please refer to the README.md files in each module:\n\n* [EVM Smart Contract Deployment](./ledgerflow-vault-evm/README.md)\n* [Aptos Smart Contract Deployment](./ledgerflow-vault-aptos/README.md)\n* [Backend Service Configuration](./ledgerflow-balancer/README.md)\n* [Telegram Bot Setup](./ledgerflow-bot/README.md)\n* [EVM Event Indexer Configuration](./ledgerflow-indexer-evm/README.md)\n* [Aptos Event Indexer Configuration](./ledgerflow-indexer-aptos/README.md)\n* [Database Migrations Setup](./ledgerflow-migrations/README.md)\n* [EVM Command Line Tool Usage](./ledgerflow-eth-cli/README.md)\n* [Aptos CLI Tools](./ledgerflow-aptos-cli/README.md)\n* [TypeScript Aptos CLI](./ledgerflow-aptos-cli-ts/README.md)\n\n- [x402 Facilitator Server](./ledgerflow-facilitator/README.md)\n\n## 🔮 Future Vision\n\n* **SaaS Merchant Dashboard**: Develop Web frontend for merchants to manage orders and data more intuitively\n* **One-Click Plugin Integration**: Develop payment plugins for mainstream e-commerce platforms\n \n- **Subscription \u0026 Recurring Payments**: Implement authorization and time-lock logic at the contract level\n\n- **Business Model**: Free usage initially, future minimal service fees (0.1% - 0.25%) on withdrawals\n\n---\n\n**Let's build a more open, transparent, and efficient global payment network together!**\n\n## x402 Protocol Integration (EVM)\n\nLedgerFlow supports the x402 V1 `exact` scheme on EVM via USDC EIP-3009. The `PaymentVault` exposes `depositWithAuthorization` so a facilitator can settle x402 payments while the vault emits `DepositReceived(payer, orderId, amount)` to preserve our on-chain order linkage. Clients generate `orderId` locally and set the EIP-3009 `nonce` to this `orderId`. See `docs/scheme_exact_evm.md` for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongcipher%2Fledgerflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flongcipher%2Fledgerflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongcipher%2Fledgerflow/lists"}