A comprehensive Ethereum blockchain explorer built for Week 3 of the Alchemy Ethereum Bootcamp. Explore blocks, transactions, accounts, NFTs, and send ETH programmatically - easier than MetaMask! πππΈ
This block explorer provides a complete set of tools to interact with Ethereum:
- π Block Explorer - Browse latest blocks and their transactions
- π€ Account Lookup - Check balances and transaction history
- π¨ NFT Metadata - Fetch NFT details by contract address and token ID
- π Transaction Status - Track transaction confirmations and receipts
- πΈ Transfer History - View asset transfers by wallet address
- π Testnet Playground - Send ETH programmatically (testnet supported)
- β No popups - Transactions execute instantly
- β Batch operations - Send multiple transactions with ease
- β Automation - Integrate into scripts and workflows
- β Testing - Perfect for testnet experimentation
- β Reliability - No browser extension dependencies
- Next.js 16 β‘: React framework with App Router
- React 19 βοΈ: Latest React with concurrent features
- Tailwind CSS 4 π: Utility-first CSS framework
- shadcn/ui π¨: Accessible component library
- TypeScript 5.7 π: Type-safe development
- Alchemy SDK 3.x βοΈ: Enhanced Ethereum API access
- ethers.js 6.x π: Ethereum utilities and wallet management
- pnpm π¦: Fast, disk space efficient package manager
- ESLint π: Code quality enforcement
- PostCSS π¨: CSS processing with Tailwind
Home page featuring all the explorer tools: Blocks, Accounts, NFT Lookup, Transaction Status, Transfers, and Testnet Playground.
- π’ Node.js 18.0 or later
- π¦ pnpm (recommended) or npm
- π Alchemy Account (free tier works!)
-
π₯ Clone this repository:
git clone [email protected]:ernanibmurtinho/alchemy-bootcamp-week3.git cd alchemy-bootcamp-week3
-
π Install dependencies:
pnpm install
-
π Set up environment variables:
Create a
.env.localfile:# Alchemy API Key (required - server-side only) ALCHEMY_API_KEY=your_alchemy_api_key_here # Network (optional, defaults to mainnet) # Options: mainnet, sepolia, goerli ALCHEMY_NETWORK=mainnet
β οΈ Important: The API key is only used server-side in API routes for security. -
βΆοΈ Start the development server:pnpm dev
-
π Open your browser at http://localhost:3000
| Page | Route | Description |
|---|---|---|
| π Home | / |
Feature cards linking to all sections |
| π Blocks | /blocks |
Browse latest blocks with transaction counts |
| π€ Accounts | /accounts |
Look up balances and transaction history |
| π¨ NFT Lookup | /nft-lookup |
Fetch NFT metadata by contract and token ID |
| π Tx Status | /transaction-status |
Check transaction status by hash |
| πΈ Transfers | /transfers |
View asset transfers for any wallet |
| π Playground | /playground |
Send testnet ETH programmatically |
- View latest block numbers and details
- Browse transactions within blocks
- Navigate between blocks
- See gas usage and timestamps
- Enter any Ethereum address
- View ETH balance in real-time
- See transaction history
- Detect if address is a contract
- Enter contract address and token ID
- Fetch complete NFT metadata
- View token name, description, and attributes
- Display token image when available
- Enter transaction hash
- View confirmation status
- See gas used and transaction details
- Track pending transactions
- Enter wallet address
- View all transfers received
- Filter by token type (ERC-20, ERC-721, ERC-1155)
- See timestamps and values
Testnets let you experiment without spending real ETH. Perfect for learning!
-
π Create a testnet API key in Alchemy Dashboard
-
π Update
.env.local:ALCHEMY_API_KEY=your_testnet_api_key ALCHEMY_NETWORK=sepolia
-
π Restart the dev server
| Network | Faucets |
|---|---|
| Sepolia | Alchemy Faucet β’ PoW Faucet |
| Holesky | Holesky Faucet |
The playground page (/playground) lets you send testnet ETH. Here's how it works under the hood:
import { Alchemy, Network } from 'alchemy-sdk';
import { Wallet, parseEther } from 'ethers';
const settings = {
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_SEPOLIA, // Use testnet!
connectionInfoOverrides: {
skipFetchSetup: true, // Required for server-side
},
};
const alchemy = new Alchemy(settings);
export async function sendETH(toAddress: string, amountInETH: number, privateKey: string) {
try {
const provider = await alchemy.config.getProvider();
const wallet = new Wallet(privateKey, provider);
const tx = await wallet.sendTransaction({
to: toAddress,
value: parseEther(amountInETH.toString()),
});
console.log('Transaction sent:', tx.hash);
const receipt = await tx.wait();
return { success: true, hash: tx.hash, block: receipt?.blockNumber };
} catch (error) {
return { success: false, error: (error as Error).message };
}
}const result = await sendETH(
'0xRECIPIENT_ADDRESS_HERE', // Recipient address
0.1, // Amount in ETH
'your_private_key' // β οΈ Never commit this!
);alchemy-bootcamp-week3/
βββ app/ # Next.js App Router pages
β βββ page.tsx # Home page with feature cards
β βββ layout.tsx # Root layout with navbar
β βββ globals.css # Global styles and theme
β βββ blocks/
β β βββ page.tsx # Block explorer page
β βββ accounts/
β β βββ page.tsx # Account lookup page
β βββ nft-lookup/
β β βββ page.tsx # NFT metadata page
β βββ transaction-status/
β β βββ page.tsx # Transaction status page
β βββ transfers/
β β βββ page.tsx # Transfer history page
β βββ playground/
β β βββ page.tsx # Testnet playground page
β βββ api/ # API routes (server-side)
β βββ blocks/
β β βββ with-transactions/route.ts
β βββ transaction/route.ts
β βββ transfers/route.ts
β βββ account/
β β βββ info/route.ts
β β βββ transactions/route.ts
β βββ nft/
β βββ metadata/route.ts
βββ components/ # React components
β βββ navbar.tsx # Navigation component
β βββ send-eth-form.tsx # Send ETH form
β βββ ui/ # shadcn/ui components
βββ lib/ # Utilities
β βββ alchemy.ts # Alchemy SDK setup (server-only)
β βββ format-utils.ts # Formatting helpers
β βββ utils.ts # General utilities
βββ .env.local # Environment variables (create this)
βββ package.json # Dependencies
βββ README.md # This file
All Alchemy SDK calls are made server-side through API routes to keep the API key secure:
| Endpoint | Method | Description |
|---|---|---|
/api/blocks/with-transactions |
GET | Fetch latest blocks with transaction data |
/api/transaction |
GET | Get transaction details by hash |
/api/transfers |
GET | Fetch asset transfers for an address |
/api/account/info |
GET | Get account balance and transaction count |
/api/account/transactions |
GET | Get recent transactions for an account |
/api/nft/metadata |
GET | Fetch NFT metadata |
The Alchemy SDK wraps ethers.js with enhanced functionality:
| Operation | ethers.js | Alchemy SDK |
|---|---|---|
| Get block number | provider.getBlockNumber() |
alchemy.core.getBlockNumber() |
| Get block | provider.getBlock(n) |
alchemy.core.getBlock(n) |
| Get balance | provider.getBalance(addr) |
alchemy.core.getBalance(addr) |
| NFT metadata | β Not available | alchemy.nft.getNftMetadata() |
| Asset transfers | β Not available | alchemy.core.getAssetTransfers() |
Need full ethers.js access?
const ethersProvider = await alchemy.config.getProvider();- π Alchemy SDK Quickstart
- π Alchemy API Overview
- π ethers.js Documentation
- β‘ Next.js Documentation
- π¨ shadcn/ui Components
- π Tailwind CSS
- π Etherscan (Mainnet)
- π§ͺ Sepolia Etherscan
| Rule | Description |
|---|---|
| π Never commit private keys | Use .env.local and add to .gitignore |
| π§ͺ Use testnet first | Always test transactions on testnet |
| π Server-side API keys | API keys are only used in API routes |
| β Validate addresses | Check address format before transactions |
| π° Check balances | Verify sufficient funds before sending |
| Implement proper error handling |
# Start development server
pnpm dev
# Build for production
pnpm build
# Start production server
pnpm start
# Run linting
pnpm lint# Verify Alchemy connection
curl -X POST https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'When using Alchemy SDK in Next.js API routes, add this configuration to avoid fetch issues:
const settings = {
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET,
connectionInfoOverrides: {
skipFetchSetup: true, // Required for server-side environments
},
};- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Make your changes
- Commit:
git commit -m 'Add new feature' - Push:
git push origin feature/new-feature - Submit a pull request
Ernani Britto
- GitHub: @ernanibmurtinho
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ by Ernani Britto for the Alchemy Ethereum Bootcamp Week 3
