You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue involves adding basic Bitcoin blockchain support to enable operations like connecting to a Bitcoin node, validating addresses, checking balances, and broadcasting transactions. This is part of the multi-chain expansion, allowing Aframp to handle Bitcoin alongside Stellar and Ethereum for broader crypto support. Focus on core RPC interactions without advanced features like multi-sig or Lightning. This will integrate into the unified blockchain service (Issue #15) and support future onramp/offramp for BTC.
Use a reliable Bitcoin RPC client to interact with nodes (testnet/mainnet), ensuring compatibility with AFRI if bridged to Bitcoin in the future. Emphasize security, efficiency, and error handling to prevent issues like invalid transactions or network failures. This complements Ethereum integration (Issue #13) and builds on Phase 1 infrastructure.
Modular Design: Develop in a dedicated module (e.g., src/services/bitcoin_rpc.rs) with a BitcoinService struct. Align methods with the common trait in Issue Implement Ethereum RPC Integration #15 for chain-agnostic use.
Overview
This issue involves adding basic Bitcoin blockchain support to enable operations like connecting to a Bitcoin node, validating addresses, checking balances, and broadcasting transactions. This is part of the multi-chain expansion, allowing Aframp to handle Bitcoin alongside Stellar and Ethereum for broader crypto support. Focus on core RPC interactions without advanced features like multi-sig or Lightning. This will integrate into the unified blockchain service (Issue #15) and support future onramp/offramp for BTC.
Use a reliable Bitcoin RPC client to interact with nodes (testnet/mainnet), ensuring compatibility with AFRI if bridged to Bitcoin in the future. Emphasize security, efficiency, and error handling to prevent issues like invalid transactions or network failures. This complements Ethereum integration (Issue #13) and builds on Phase 1 infrastructure.
Key Requirements
bitcoin-rpcorbitcoincore-rpc). Use async for RPC calls. Configure via env vars (Issue Good First Issue: Setup Project Configuration and Health Check Endpoint #1) for node URLs, auth credentials, and network (testnet/mainnet).src/services/bitcoin_rpc.rs) with aBitcoinServicestruct. Align methods with the common trait in Issue Implement Ethereum RPC Integration #15 for chain-agnostic use.BtcError::InvalidAddress,BtcError::BroadcastFailed) linked to Issue Implement Redis Caching Layer #8's system. Handle RPC-specific issues like connection timeouts.Detailed Tasks
Bitcoin RPC Connection:
async fn init_client(url: &str, auth: &Auth) -> Result<BitcoinClient, BtcError>getblockchaininfoto verify connection and network.Address Validation:
fn validate_address(address: &str) -> Result<bool, BtcError>validateaddress.Balance Checking:
async fn get_balance(address: &str) -> Result<Satoshi, BtcError>getreceivedbyaddressif wallet-enabled; for non-custodial, preferscantxoutsetor external indexing if needed.Transaction Broadcasting:
async fn broadcast_tx(raw_tx: &str) -> Result<TxId, BtcError>sendrawtransaction.Acceptance Criteria
Estimated Effort
4-5 hours: 1h connection/setup, 1h validation/balance, 1h broadcasting, 1h testing/debugging.
Related Issues