A Next.js e-commerce application built with OnchainKit, featuring Coinbase Commerce integration and Base attestation verification.
In today's digital commerce landscape, merchants face several critical challenges:
-
Rising Customer Acquisition Costs
- Digital advertising costs have increased by over 60% in the last five years
- Traditional targeting methods are becoming less effective due to privacy regulations
- Cookie deprecation and iOS privacy changes have disrupted conventional marketing channels
-
Trust and Verification Challenges
- Difficulty in verifying customer demographics and eligibility
- Risk of fraud in promotional campaigns and regional launches
- Limited ability to offer exclusive deals to verified customer segments
-
Customer Relationship Building
- Lack of reliable mechanisms to reward loyal customers
- Limited tools for creating verifiable customer segments
- Challenge in maintaining long-term customer engagement
Blockchain attestations are much better than NFTs for creating tailored e-commerce experience for users allowing merchants to do more targetted marketing.
- Targeted Marketing: Leverage Base attestations to precisely target verified customer segments
- Cost Reduction: Dramatically lower customer acquisition costs by reaching pre-verified audiences
- Flash Sale Management: Securely run region-specific flash sales with guaranteed customer verification
- Fraud Prevention: Ensure promotions reach only eligible, verified customers
- Customer Loyalty: Build stronger relationships through verified customer segments
- Exclusive Access: Unlock special products and deals through verifiable attestations
- Privacy-Preserving: Prove eligibility without sharing personal data
- Better Deals: Access region-specific offers and flash sales
- Simplified Verification: One-time verification process for ongoing benefits
- Trustless Interaction: No need to trust the merchant with personal information
The solution addresses a massive market opportunity in the e-commerce space:
- Global e-commerce market expected to reach $8.1 trillion by 2026
- Customer acquisition costs (CAC) have increased by 222% over the last eight years
- 63% of marketers cite generating traffic and leads as their top challenge
-
Underserved Market for Attestation-Based E-commerce
- Leverage Base attestations for customer verification
- Unique position in combining blockchain verification with e-commerce
- E-commerce market will grow rappidly with AI
-
Technical Innovation
- Built on Base, ensuring scalability and low costs
- Integration with Coinbase Commerce for seamless payments (lower fees cross-border)
- Extensible architecture for future features
-
Privacy-First Approach
- Aligned with global privacy regulations
- No storage of personal data
- Trustless verification system
- Primary: E-commerce platforms and merchants
- Secondary: Direct-to-consumer (D2C) brands
- Tertiary: Loyalty program providers
graph TD
A[User Visits Store] --> B[Connect Wallet]
B --> C[Verify Attestations]
C --> D[Browse Products Catered to Region]
D --> E[Flash Sales Targeted to Customers - Lowering CAC for Merchants and Being More Relevant to Customers]
E --> F[Add to Cart]
F --> G[Checkout Process]
G --> H[Payment Processing on Base at Low Fees]
-
Connect Wallet
- User connects their wallet using OnchainKit's wallet connector
- System identifies the connected wallet address
-
Attestation Check
- System queries Base Attestation Service for:
- Region verification (e.g., Canadian residency)
- Trading access verification
- Real-time validation of attestation status
- Unlocks eligible products based on verifications
- System queries Base Attestation Service for:
-
Product Access
- Verified users see their eligible products
- Special deals and flash sales become available
- Product cards display verification status
- Prices adjust based on verification level
-
Cart Management
- Add verified products to cart
- Quantity adjustments
- Cart persistence across sessions
-
Payment Processing
- Seamless integration with Coinbase Commerce
- Support for multiple payment methods
- Real-time transaction status updates
- Automatic order creation upon payment
- No personal data stored on-chain
- Attestations verify eligibility without exposing details
- Encrypted payment processing
- Wallet connection through secure protocols
- Clear feedback for verification failures
- Graceful handling of network issues
- Guided resolution for payment errors
- Support for transaction retry
*Homepage showing the product catalog before verification
*Customer connects wallet and verifies attestion - protecting privacy and only revealing region and trading access
Verification status check for region and trading access
Product cards showing verification status and pricing as examples of more products relevant to customer to encourage verification
Shopping cart with verified products
Coinbase Commerce checkout integration
Payout to Merchants through Coinbase Wallet
- Faciitates flash sales by targeting verified Canadian users through Base attestations
- Gates products based on verifications for trading and region
- Successfullly implement payment processing through Coinbase Commerce and payout through Coinbase Wallet
- Coinbase Commerce integration
- Base attestation verification
- Wallet connection
- Test mode for development
- @coinbase/onchainkit: Comprehensive SDK for building onchain applications
- Features used:
- Identity components for ENS/Base name resolution
- Wallet connection components
- Frame components for social integration
- Transaction handling utilities
- Base Attestation Service:
- Uses
@ethereum-attestation-service/eas-sdk
for attestation verification - Verifies user region and trading access attestations
- Implements schema-based attestation validation
- Handles attestation UIDs and data decoding
- Uses
- Coinbase Commerce API Integration:
- Direct API integration for payment processing
- Handles both NFT and physical product sales
- Supports test mode for development
- Implements webhook handling for order status updates
- Manages charge creation and verification
- wagmi: Ethereum hooks library
- Wallet connection management
- Chain management
- Transaction handling
- viem: Low-level Ethereum interaction
- Contract interactions
- RPC provider management
- Transaction building
- Next.js 14
- App Router for routing
- Server Components for improved performance
- API Routes for backend functionality
- React 18
- Hooks for state management
- Context for global state
- Server and Client Components
- @headlessui/react: Accessible UI components
- @heroicons/react: Icon set
- Tailwind CSS: Utility-first CSS framework
- TypeScript: Type safety and developer experience
- ESLint: Code quality and consistency
- PostCSS: CSS processing
Copy .env.example
to .env.local
and fill in your values:
# OnchainKit API Key
NEXT_PUBLIC_ONCHAINKIT_API_KEY=your_api_key_here
# Coinbase Commerce API
NEXT_PUBLIC_COINBASE_COMMERCE_API_KEY=your_api_key_here
# Base Network RPC URL (for attestations)
You can get your own custom RPC from Base as well on CDP for Developer Tools at portal.cdp.coinbase.com under node
NEXT_PUBLIC_BASE_RPC_URL=https://mainnet.base.org
The project uses Base Attestations for user verification:
-
Region Attestation:
- Verifies user's region eligibility
- Decodes region data from attestation
-
Trading Access:
- Verifies user's trading permissions
- Handles multiple attestation types
- Implements proper error handling
Payment processing is handled through Coinbase Commerce:
-
Test Mode:
- Physical items: $0.10 USD each
- Simplified testing flow
-
Production Mode:
- Full price implementation
- Secure payment processing
# Install dependencies
npm install
# Run development server
npm run dev
- Push code to GitHub
- Import project in Vercel
- Configure environment variables in Vercel dashboard
- Deploy!
Use test mode for development:
- Physical items: $0.10 USD each
Regular pricing applies in production mode.
The project follows a modular architecture:
app/
βββ components/ # React components
β βββ cart/ # Cart-related components
β βββ product/ # Product-related components
β βββ checkout/ # Checkout components
βββ utils/ # Utility functions
β βββ coinbase.ts # Coinbase Commerce integration
β βββ attestation.ts # Base attestation handling
βββ hooks/ # Custom React hooks
βββ types/ # TypeScript type definitions