Skip to content

0-x-joseph/block-explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ethereum Block Explorer

A minimal, modular blockchain exploration tool built with React and the Alchemy SDK. Features pure black & white design with clean, comment-free code.

Made with React Alchemy SDK JavaScript


Overview

A production-ready web application for exploring the Ethereum blockchain in real-time. Built as part of Week 3 of the Alchemy University Ethereum Developer Bootcamp.

Key Features:

  • Minimal black & white design (no colors, no rounded corners)
  • Modular architecture (7 clean components)
  • Real-time mainnet data
  • Fully responsive
  • Zero comments (self-documenting code)

Features

Latest Blocks

  • View the 10 most recent blocks on Ethereum mainnet
  • See transaction count, gas used, timestamp, and miner
  • Click any block to view full details

Smart Search

Automatically detects what you're searching for:

  • Block number (e.g., 18000000)
  • Transaction hash (e.g., 0x123... - 64 hex chars)
  • Address (e.g., 0x123... - 40 hex chars)

No dropdown menus needed - just paste and search!

Block Details

  • Complete block information (hash, parent hash, gas metrics)
  • List all transactions in the block
  • Navigate to previous blocks via parent hash
  • View miner address

Transaction Details

  • Transaction status (success/failed/pending)
  • From and To addresses
  • Value transferred in ETH
  • Gas limit, used, price, and total fee
  • Input data for contract interactions

Address Lookup

  • Current ETH balance
  • Recent transaction history (last 20)
  • Support for all transfer types (external, internal, ERC20, ERC721, ERC1155)

Design Philosophy

Minimal Black & White

  • Colors: Pure black (#000000) and white (#ffffff) only
  • Borders: 2px solid black throughout
  • Corners: Square edges (no border-radius)
  • Effects: No gradients, shadows, or animations
  • Typography: Clean sans-serif with proper hierarchy
  • Spacing: Consistent padding and margins (16px, 20px, 40px)

Why? To prioritize data over decoration. The blockchain information is the focus, not the design.

Modular Architecture

src/
├── App.js                      # Main router (45 lines)
├── App.css                     # Minimal styles (320 lines)
├── components/
│   └── Header.js              # Search & navigation (55 lines)
├── pages/
│   ├── Home.js                # Latest blocks (59 lines)
│   ├── BlockDetails.js        # Block info (130 lines)
│   ├── TransactionDetails.js  # TX details (145 lines)
│   └── AddressDetails.js      # Address info (85 lines)
└── utils/
    └── alchemy.js             # SDK config (8 lines)

Benefits:

  • Easy to understand and maintain
  • Each component has a single responsibility
  • Simple to test and extend
  • No comments needed - code is self-documenting

Quick Start

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn
  • Alchemy API key (Get one free)

Installation

  1. Clone the repository

    git clone https://github.com/0-x-joseph/block-explorer.git
    cd block-explorer
  2. Install dependencies

    npm install
  3. Set up environment variables

    Create a .env file in the root directory:

    REACT_APP_ALCHEMY_API_KEY=your_alchemy_api_key_here

    You can use .env.example as a template:

    cp .env.example .env
  4. Start the development server

    npm start
  5. Open your browser

    Navigate to http://localhost:3000


Project Structure

blockexplorer/
├── public/                    # Static files
├── src/
│   ├── App.js                # Main application with routing
│   ├── App.css               # Minimal black & white styles
│   ├── index.js              # React entry point
│   ├── components/           # Reusable components
│   │   └── Header.js         # Search bar and navigation
│   ├── pages/                # Page components
│   │   ├── Home.js           # Latest blocks display
│   │   ├── BlockDetails.js   # Individual block view
│   │   ├── TransactionDetails.js  # Transaction view
│   │   └── AddressDetails.js # Address information
│   └── utils/                # Utility functions
│       └── alchemy.js        # Alchemy SDK configuration
├── .env.example              # Environment variable template
├── .gitignore               # Git ignore rules
├── package.json             # Dependencies
└── README.md                # This file

Tech Stack

Frontend:

  • React 17.0.2
  • React Router DOM 5.3.4
  • Pure CSS3 (no frameworks)

Blockchain:

  • Alchemy SDK 2.2.3
  • Ethereum Mainnet

Development:

  • Create React App
  • ES6+ JavaScript

Usage Examples

Search for a Block

Enter: 18000000
Result: Shows Block #18000000 with all transactions

View a Transaction

Enter: 0x123abc... (full transaction hash)
Result: Shows transaction details, gas fees, status

Look Up an Address

Enter: 0x123abc... (Ethereum address)
Result: Shows balance and recent transactions

Navigate the Chain

  • Click any block number → View block details
  • Click parent hash → Go to previous block
  • Click any address → View address info
  • Click any transaction → View transaction details

Key Metrics

  • Total Lines: ~850 (vs 990+ before refactor)
  • Components: 7 modular files
  • Comments: 0 (self-documenting code)
  • CSS: 320 lines (minimal, no frameworks)
  • API Methods: 7+ Alchemy SDK methods
  • Load Time: Fast (no heavy assets)

Available Scripts

npm start      # Start development server (localhost:3000)
npm test       # Run test suite
npm run build  # Build for production
npm run eject  # Eject from Create React App (one-way)

What I Learned

Blockchain Concepts

  • How blocks chain together via parent hashes
  • Transaction lifecycle from pending to confirmed
  • Gas mechanics: base fee, priority fee, limits
  • Difference between EOA and contract addresses
  • How block explorers like Etherscan work

Technical Skills

  • React component architecture and hooks
  • Modular code organization
  • Asynchronous data handling
  • Client-side routing
  • Responsive CSS without frameworks
  • Writing self-documenting code

Design Principles

  • Constraint-driven design (black/white only)
  • Data-first approach to UI/UX
  • Minimalism in practice
  • Consistency across pages
  • Typography and spacing hierarchy

Customization

Change Network

Edit src/utils/alchemy.js:

import { Alchemy, Network } from "alchemy-sdk";

const settings = {
  apiKey: process.env.REACT_APP_ALCHEMY_API_KEY,
  network: Network.ETH_GOERLI, // Change this
};

export const alchemy = new Alchemy(settings);

Available networks:

  • Network.ETH_MAINNET
  • Network.ETH_GOERLI
  • Network.ETH_SEPOLIA
  • Network.MATIC_MAINNET (Polygon)
  • Network.ARB_MAINNET (Arbitrum)

Deployment

Deploy to Vercel

npm run build
npx vercel

Deploy to Netlify

npm run build
npx netlify deploy --prod --dir=build

Deploy to GitHub Pages

npm install gh-pages --save-dev
npm run build
npx gh-pages -d build

Contributing

This is a learning project, but suggestions are welcome! Feel free to:

  • Open issues for bugs or feature requests
  • Submit pull requests
  • Share your own implementations

License

This project is open source and available for educational purposes.

Built as part of the Alchemy University Ethereum Developer Bootcamp.


Acknowledgments

  • Alchemy - For the excellent SDK and free API access
  • Alchemy University - For the structured curriculum and challenges
  • Etherscan - For design inspiration
  • Ethereum community - For building an amazing ecosystem

Resources


About

A minimal, modular blockchain exploration tool built with React and the Alchemy SDK.

Topics

Resources

Stars

Watchers

Forks

Contributors