Web3 Integration

The Web3 Integration layer enables Macro Browser to interact seamlessly with blockchain networks and decentralized applications (dApps). This component bridges the traditional web browsing experience with the decentralized web ecosystem.

Architecture Overview


Key Components


Wallet Connector

Facilitates connections with cryptocurrency wallets:

  • External Wallet Support: Integration with popular wallets (MetaMask, Coinbase Wallet, etc.)

  • WalletConnect Support: Connection to mobile wallets via QR code

  • Hardware Wallet Integration: Support for Ledger, Trezor, and other hardware wallets

  • Multi-Wallet Management: Connect and manage multiple wallets simultaneously

  • Connection Status Monitoring: Track wallet connection state

Provider Bridge

Implements the Web3 provider interface for dApp connectivity:

  • EIP-1193 Compliance: Standard Ethereum provider API implementation

  • Method Handling: Processing of Ethereum JSON-RPC methods

  • Event Propagation: Wallet and chain-related events (connect, disconnect, chainChanged, etc.)

  • Request Filtering: Security filtering of provider requests

  • Cross-Origin Isolation: Domain-specific provider instances

Transaction Manager

Handles blockchain transactions securely:

  • Transaction Creation: Help construct valid blockchain transactions

  • Gas Estimation: Accurate gas fee estimations

  • Transaction Signing: Secure signing process with user confirmation

  • Transaction Broadcasting: Sending signed transactions to the network

  • Transaction Monitoring: Track transaction status and confirmations

  • Receipt Validation: Verify transaction completion and effects

Network Manager

Supports multiple blockchain networks:

  • Network Switching: Easy switching between different networks

  • Chain Validation: Ensure proper chain ID and network configuration

  • Custom Network Support: Adding and managing custom RPC endpoints

  • Network Status Monitoring: Track network availability and conditions

  • EIP-3085 Support: Adding new networks via wallet_addEthereumChain

  • EIP-3326 Support: Switching networks via wallet_switchEthereumChain

Security Monitor

Provides security features for Web3 interactions:

  • Phishing Protection: Detection of known scam sites and malicious dApps

  • Contract Verification: Verification of smart contract source code when available

  • Permission Management: Granular control over dApp permissions

  • Transaction Analysis: Pre-execution analysis of transaction effects

  • Spending Limits: Optional spending limits for transactions

Technical Implementation


Wallet Connection Flow

Web3 Provider Implementation

Transaction Security

Integration with dApps


Macro Browser's Web3 integration enables seamless interaction with decentralized applications:

  • Automatic Provider Injection: Web3 provider automatically injected into dApp pages

  • Permission System: dApps request permission to connect to user's wallet

  • Transaction Approval Flow: Clear UI for transaction approval

  • Network Compatibility: Support for multiple blockchain networks

  • Chain Switching: Allow dApps to request network changes

User Interface


The Web3 integration includes several user interface components:

  • Wallet Connection Button: Easily accessible in the browser toolbar

  • Connected Account Display: Shows currently connected wallet and account

  • Transaction Approval Dialog: Clear presentation of transaction details

  • Network Selector: Dropdown for changing the active blockchain network

  • Asset Overview: Summary of wallet balances (optional)

Privacy Considerations


The Web3 integration is designed with privacy in mind:

  • Domain Isolation: Each domain gets its own isolated provider instance

  • Minimal Data Sharing: Only necessary data is shared with dApps

  • No Persistent Storage: Wallet connection data not stored permanently

  • Transparent Permissions: Clear display of what each dApp can access

  • Optional Connections: Users can choose which dApps can connect to their wallet

Future Enhancements


Planned improvements for the Web3 integration:

  • Enhanced Transaction Simulation: More detailed preview of transaction effects

  • NFT Support: Improved handling of non-fungible tokens

  • Multi-Chain Operations: Streamlined cross-chain transactions

  • Layer 2 Optimizations: Better support for Layer 2 scaling solutions

  • Wallet SDK: Developer tools for wallet and dApp developers

Last updated