Architecture

System Architecture

Understand how LaserEyes is built and how its components work together to provide a seamless Bitcoin wallet integration experience.

LaserEyes is built with a modular architecture that separates concerns and provides flexibility through its provider system. This guide explains the core concepts and how different parts work together.

Core Concepts

Provider System

A flexible provider architecture that allows seamless integration with different Bitcoin wallets through a unified interface.

Data Sources

Pluggable data source system for fetching Bitcoin network data with built-in fallback support.

Wallet Abstraction

Abstract wallet interfaces that normalize different wallet implementations into a consistent API.

Framework Adapters

Framework-specific packages that provide optimized integrations for React, Vue, and more.

Package Structure

Project Layout

lasereyes/
├── packages/
│   ├── lasereyes-core/     # Core functionality
│   ├── lasereyes-react/    # React integration
│   ├── lasereyes-vue/      # Vue integration
│   └── lasereyes-ui/       # Shared UI components
└── apps/
    ├── docs/               # Documentation site
    └── examples/           # Example applications

Core Architecture

Provider Architecture

interface WalletProvider {
  connect(): Promise<void>
  disconnect(): Promise<void>
  signMessage(message: string): Promise<string>
  sendBitcoin(address: string, amount: number): Promise<string>
  // ... other methods
}

Each wallet provider implements this interface, ensuring consistent behavior across different wallet implementations.

Data Source System

interface DataSource {
  getBalance(address: string): Promise<string>
  getTransaction(txid: string): Promise<Transaction>
  getInscriptions(address: string): Promise<Inscription[]>
  // ... other methods
}

Data sources provide a standardized way to interact with the Bitcoin network and fetch required data.

Security Considerations

Security Best Practices

  • Never store private keys or sensitive wallet data
  • Validate all transaction parameters before signing
  • Implement proper error handling for failed transactions
  • Use secure communication channels with wallet providers
  • Follow Bitcoin network best practices for transaction handling