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]
- 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
- 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
- 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.
- Responsive design with mobile support
- Enhanced loading states
- Comprehensive error handling
- Clear navigation with breadcrumbs
- Smooth transitions
- Copy-to-clipboard functionality
- Warning/Error differentiation
- Node.js (v18 or higher)
- npm (v8 or higher)
- Blockfrost API key (Get one here)
-
Clone the repository:
git clone https://github.com/Jimmyh-world/cardano-explorer.git cd cardano-block-explorer -
Install dependencies:
npm install
-
Create
.envfile:BLOCKFROST_API_KEY=your_api_key_here NODE_ENV=development
# Start the development server
npm run dev
# The application will be available at http://localhost:3001- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy using the provided
vercel.jsonconfiguration
For detailed deployment information, see TECHNICAL.md.
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.
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
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- Fork the repository
- Create your feature branch
- Follow code style guidelines:
- Use meaningful variable names
- Add JSDoc comments
- Follow type checking practices
- Update documentation
- Test thoroughly
- Submit a pull request
For detailed contribution guidelines, see TECHNICAL.md.
James Barclay - jamesqbarclay@gmail.com
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.