docs: add ICP blockchain integration plan#2942
Draft
TaprootFreak wants to merge 5 commits intodevelopfrom
Draft
Conversation
Comprehensive technical documentation for integrating Internet Computer Protocol (ICP) blockchain into DFX payment infrastructure. Covers: - Architecture overview and key differences from EVM chains - Required NPM packages (@dfinity/agent, @dfinity/ledger-icrc, etc.) - Core service implementations (IcpClient, IcrcLedger, CkBtc) - PayIn strategy (polling-based deposit detection) - PayOut strategy (ICRC-1 transfers) - Address generation (Principal + Subaccount model) - Configuration and environment variables - Database schema updates - Testing strategy and deployment checklist Tokens in scope: - ICP (native token) - ckBTC (chain-key Bitcoin) - VCHF/VEUR (pending VNX canister deployment) Reference: DFINITY contract signed January 2026
Replace polling-based deposit detection with ICSI (ICP Sub-Account Indexer) webhook integration for scalable deposit detection across thousands of customer deposit addresses. Key changes: - Remove per-address polling (unscalable for DFX customer volume) - Add ICSI webhook-based architecture as primary solution - Document IcsiIndexerService with webhook registration - Add IcpWebhookController for handling deposit notifications - Include ICSI canister ID and API documentation - Update PayIn strategy to be event-driven instead of polling - Add liquidity consolidation flow documentation - Document all relevant canister IDs (ICP, ckBTC, ckUSDC, ckUSDT) ICSI provides real-time webhook notifications when deposits arrive, eliminating the need for expensive polling of individual subaccounts.
|
Major revision after evaluating third-party webhook solutions (ICSI): ICSI Webhooks REJECTED because: - Not true event-driven (internally polls every 15s, then sends webhook) - Single Point of Failure (community-maintained canister) - Only 5 GitHub stars, inactive maintainer - No guaranteed SLA or documented recovery logic POLLING APPROACH CHOSEN because: - Industry standard (used by Binance, Coinbase, Kraken) - Uses official DFINITY-maintained Index Canister - Full control over error handling and recovery - Same pattern already used in DFX for Bitcoin/Lightning - 10-second polling with 2-second finality = excellent UX Key changes: - Remove ICSI/icsi-lib dependency - Remove IcpWebhookController - Add IcpDepositService with @Cron polling - Add IcpAddressService for subaccount-based addresses - Use official ICP Index Canister (qhbym-qaaaa-aaaaa-aaafq-cai) - Add ckBTC Index Canister (n5wcd-faaaa-aaaar-qaaea-cai) - Add comparison table: Polling vs ICSI
Remove references to Base, Solana and other blockchains. Document now covers only ICP-native tokens: - ICP (native) - ckBTC, ckUSDC, ckUSDT (chain-key) - VCHF, VEUR (ICRC-1, pending VNX deployment)
- Remove section 1.3 (Why Polling Instead of Webhooks) - Remove section 12 (Comparison: Polling vs ICSI) - Simplify code comments to focus on implementation - Renumber remaining sections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Comprehensive technical documentation for integrating Internet Computer Protocol (ICP) blockchain into DFX payment infrastructure. Based on the signed DFINITY contract (January 2026).
After thorough evaluation, ICSI webhooks were rejected in favor of polling on official DFINITY infrastructure.
Why ICSI Was Rejected:
Why Polling Was Chosen:
Architecture
Key Features
Official Canister IDs
qhbym-qaaaa-aaaaa-aaafq-cairyjl3-tyaaa-aaaaa-aaaba-cain5wcd-faaaa-aaaar-qaaea-caimxzaz-hqaaa-aaaar-qaada-caiDocumentation Covers
@dfinity/agent,@dfinity/ledger-icrc, etc.)Test Plan