A decentralized application demonstrating Base Flashblocks capabilities with side-by-side comparison of transaction confirmations: Flashblocks vs Traditional blocks.
- Side-by-Side Comparison: Live comparison of Flashblocks vs Traditional transaction confirmations
- Transaction Tracking: Send test transactions and monitor confirmation times by fetching block transactions with
getBlockand checking for transaction inclusion - Live Metrics Dashboard: Balances, and transaction status
- Wallet Integration: RainbowKit wallet connection with Wagmi
You will need the following:
- A Quicknode account with Base Sepolia endpoint (optional)
- Project ID from Reown, formerly WalletConnect - required for wallet connection
-
Create Endpoints: Log in to your Quicknode account and create a new endpoint for Base Sepolia testnet.
-
Get Endpoint Key: After creating the endpoint, go to the endpoint dashboard and copy the HTTPS endpoint URL. You will need this key to configure your application.
-
Create a Reown (formerly, WalletConnect) Project: Head to the Reown Cloud and create a new project. You can name it whatever you want.
-
Get Project ID: After creating the project, you will be redirected to the project dashboard. Here, you can find your Project ID, which you'll need to use in your application.
- Clone and Install
git clone https://github.com/quiknode-labs/qn-guide-examples.git
cd qn-guide-examples/sample-dapps/flashblocks-base- Install Dependencies
npm install
# or
yarn install
# or
pnpm install- Configure Environment
Copy the .env.example file to .env.local.
cp .env.example .env.localThen, fill in the following variables:
`NEXT_PUBLIC_QUICKNODE_ENDPOINT`: Your Quicknode endpoint
`NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID`: Your WalletConnect project ID- Run Development Server
npm run dev
# or
yarn dev
# or
pnpm dev- Open Application
Navigate to http://localhost:3000
- Framework: Next.js
- Language: TypeScript
- Styling: Tailwind CSS + shadcn/ui components
- Web3: Viem, Wagmi, RainbowKit for wallet connections
- State Management: React hooks with custom state management
- ComparisonPanel (
components/comparison-panel.tsx): Main orchestrator for side-by-side comparison view - MetricsDisplay (
components/metrics-display.tsx): Individual metrics display for each chain type - CTASection (
components/cta-section.tsx): Quicknode marketing integration and signup links - Header (
components/header.tsx): Application header with branding - Providers (
components/providers.tsx): Context providers for theme and Web3
- use-transaction-tracking.ts: Manages transaction lifecycle, sending, and confirmation tracking
- use-balance-tracker.ts: Tracks wallet balances
- Uses Viem's
getBlockwith different client configurations, polling recent blocks every 100ms until the transaction is included
Note: This implementation is not optimized for production use, but is suitable for demonstration purposes of the Flashblocks. In a production application, you would need to use
waitForTransactionReceiptor a similar method to ensure transaction confirmation.
- Flashblocks: Uses
baseSepoliaPreconfchain - Traditional: Uses
baseSepoliachain
Note: The default block tag for Base Sepolia Preconf is
pending. Thependingtag is required for Flashblocks support.
- Dual client architecture for simultaneous transaction monitoring
// Flashblocks client
export const flashblocksClient = createPublicClient({
chain: baseSepoliaPreconf, // Auto-uses "pending" for supported actions
transport: http(process.env.QUICKNODE_ENDPOINT),
})
// Traditional client
export const traditionalClient = createPublicClient({
chain: baseSepolia, // Uses "latest" by default
transport: http(process.env.QUICKNODE_ENDPOINT),
})# Development
pnpm dev # Start Next.js development server on port 3000
pnpm build # Build production application
pnpm start # Start production server
pnpm lint # Run ESLint on codebase
# Package management
pnpm install # Install dependencies/app/ # Next.js App Router pages and layouts
/components/ # React components (main UI + shadcn/ui)
/ui/ # shadcn/ui component library
/hooks/ # Custom React hooks for blockchain interactions
/lib/ # Utilities, constants, client configs, and mock data
/types/ # TypeScript type definitions
/public/ # Static assets
/styles/ # Global CSS files
lib/constants.ts: Centralized configuration including polling intervals and mock mode togglelib/clients.ts: Viem client configurations for Flashblocks and traditional chainslib/wagmi.ts: Wagmi configuration with RainbowKit integration