Skip to content

Jimmyh-world/cardano-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

100 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cardano Block Explorer

A lightweight, high-performance block explorer for the Cardano blockchain built with vanilla JavaScript and the Blockfrost API. This application provides real-time blockchain data visualization with robust security features and a clean, responsive interface.

graph TD
    A[Client Application] --> B[API Layer]
    B --> C[Service Layer]
    C --> D[Blockfrost API]
Loading

πŸš€ Features

Real-time Block Information

  • Latest block data auto-refresh
  • Detailed block information display
  • Transaction list viewing with pagination
  • Block navigation and search
  • Advanced transaction details with UTXO tracking
  • Address tracking and balance display

Performance Optimized

  • Efficient DOM updates with modular renderers
  • Debounced search and event handlers
  • Optimized rendering cycles
  • BigInt support for precise calculations
  • Smart date formatting and validation
  • Responsive UI components

Security First

  • Rate limiting protection
  • Secure headers (Helmet)
  • CORS protection
  • API key validation
  • Input validation and sanitization
  • Error handling and logging
  • Type checking and validation

For detailed security information, see SECURITY.md.

Clean UI/UX

  • Responsive design with mobile support
  • Enhanced loading states
  • Comprehensive error handling
  • Clear navigation with breadcrumbs
  • Smooth transitions
  • Copy-to-clipboard functionality
  • Warning/Error differentiation

πŸ› οΈ Prerequisites

  • Node.js (v18 or higher)
  • npm (v8 or higher)
  • Blockfrost API key (Get one here)

πŸ“¦ Installation

  1. Clone the repository:

    git clone https://github.com/Jimmyh-world/cardano-explorer.git
    cd cardano-block-explorer
  2. Install dependencies:

    npm install
  3. Create .env file:

    BLOCKFROST_API_KEY=your_api_key_here
    NODE_ENV=development

πŸš€ Deployment Options

Local Development

# Start the development server
npm run dev

# The application will be available at http://localhost:3001

Production Deployment (Vercel)

  1. Connect your repository to Vercel
  2. Set environment variables in Vercel dashboard
  3. Deploy using the provided vercel.json configuration

For detailed deployment information, see TECHNICAL.md.

πŸ—οΈ Project Structure

cardano-block-explorer/
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ middleware/          # Error handling, validation, and async handlers
β”‚   β”‚   β”œβ”€β”€ errorHandler.js  # Centralized error handling
β”‚   β”‚   β”œβ”€β”€ asyncHandler.js  # Async operation wrapper
β”‚   β”‚   └── validators.js    # Input validation
β”‚   β”œβ”€β”€ services/           # Business logic and external services
β”‚   β”‚   └── blockfrost/    # Blockfrost API integration
β”‚   β”œβ”€β”€ utils/             # Server utilities
β”‚   β”‚   β”œβ”€β”€ APIError.js    # Custom error handling
β”‚   β”‚   └── validators.js  # Validation utilities
β”‚   └── server.js          # Express server setup
β”œβ”€β”€ public/                # Client-side assets
β”‚   β”œβ”€β”€ js/               # JavaScript modules
β”‚   β”‚   β”œβ”€β”€ api.js        # API client
β”‚   β”‚   β”œβ”€β”€ utils.js      # Client utilities
β”‚   β”‚   β”œβ”€β”€ main.js       # Application entry
β”‚   β”‚   β”œβ”€β”€ wallet.js     # Wallet functionality
β”‚   β”‚   β”œβ”€β”€ ui.js         # UI controllers
β”‚   β”‚   └── renderers/    # UI components
β”‚   β”‚       β”œβ”€β”€ shared.js    # Shared components
β”‚   β”‚       β”œβ”€β”€ search.js    # Search functionality
β”‚   β”‚       └── transactions.js # Transaction views
β”‚   β”œβ”€β”€ css/              # Stylesheets
β”‚   β”‚   β”œβ”€β”€ modules/     # CSS modules
β”‚   β”‚   └── styles.css   # Main styles
β”‚   └── assets/          # Static assets
β”‚       β”œβ”€β”€ images/      # Image resources
β”‚       └── icons/       # Icon assets
β”œβ”€β”€ docs/                # Documentation
β”‚   β”œβ”€β”€ ARCHITECTURE.md  # System architecture
β”‚   β”œβ”€β”€ TECHNICAL.md    # Technical details
β”‚   β”œβ”€β”€ API.md          # API documentation
β”‚   └── SECURITY.md     # Security guidelines
β”œ
β”œβ”€β”€ vercel.json        # Vercel configuration
└── index.html         # Entry point

For detailed architecture information, see ARCHITECTURE.md.

πŸ”’ Security Features

For comprehensive security documentation, see SECURITY.md.

Key security features include:

  • Rate limiting (100 requests per 15 minutes)
  • HTTP security headers via Helmet
  • CORS protection with environment config
  • API key validation and security
  • Comprehensive error handling
  • Input validation and sanitization
  • Production error sanitization
  • Secure number handling with BigInt

πŸ“š Documentation

πŸ§ͺ Testing

For detailed API testing information, see API.md.

Quick test examples:

# Get latest block
curl http://localhost:3001/api/blocks/latest | json_pp

# Get specific block
curl http://localhost:3001/api/blocks/{block_hash} | json_pp

# Get block transactions
curl http://localhost:3001/api/blocks/{block_hash}/transactions | json_pp

# Get transaction details
curl http://localhost:3001/api/tx/{tx_hash} | json_pp

# Search
curl http://localhost:3001/api/blocks/search?q={query} | json_pp

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Follow code style guidelines:
    • Use meaningful variable names
    • Add JSDoc comments
    • Follow type checking practices
    • Update documentation
    • Test thoroughly
  4. Submit a pull request

For detailed contribution guidelines, see TECHNICAL.md.

πŸ“§ Contact

James Barclay - jamesqbarclay@gmail.com

πŸ—ΊοΈ Roadmap

Current Status:

  • Advanced transaction details
  • Address tracking
  • Search functionality

Upcoming Features:

  • Asset information display
  • Stake pool integration
  • WebSocket updates
  • Caching layer
  • TypeScript migration

For detailed enhancement plans, see TECHNICAL.md.

About

A lightweight, vanilla JavaScript block explorer for the Cardano blockchain using the Blockfrost API. This project demonstrates building a secure client-server application with real-time blockchain data display.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors