Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cardano PreProd Live Explorer

Real-time blockchain explorer with Web3 wallet integration

Live Demo Rust Next.js TypeScript Cardano

Live Demo β€’ Report Bug



Features

Real-Time Streaming

Watch blocks and transactions as they happen on the blockchain with WebSocket connections

Wallet Integration

Connect your Cardano wallet securely with CIP-30 standard support for multiple wallets

Web3 Authentication

Sign in with your wallet using message signing - no passwords needed!

Rust Performance

High-performance backend built with Rust, Actix-web, and Oura pipeline


Live Deployment

Service URL
Frontend blockchainliveexpolrer-production-af39.up.railway.app
Backend API blockchainliveexpolrer-production-b895.up.railway.app
WebSocket wss://blockchainliveexpolrer-production-b895.up.railway.app/ws
Health Check Backend Health

Tech Stack

Backend Architecture

graph LR
    A[Cardano Node] -->|Node-to-Client| B[Oura Pipeline]
    B -->|Event Stream| C[Rust Backend]
    C -->|WebSocket| D[Frontend]
    C -->|REST API| D
    C -->|JWT Auth| D
Loading
Language Rust
Web Framework Actix-web 4.x
Async Runtime Tokio
Blockchain Data Oura v1.9 (txpipe)
Authentication JWT + Ed25519 Signature Verification
WebSocket actix-ws

Frontend Architecture

Framework Next.js 14 (App Router)
Language TypeScript
Styling Tailwind CSS 3.x
Wallet Integration CIP-30 Standard
State Management React Context API
HTTP Client Native Fetch API

Quick Start

Prerequisites

# Rust & Cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Node.js & npm (v18+)
# Download from https://nodejs.org/

# Oura CLI
cargo install oura

Docker (Recommended)

The easiest way to run the entire stack:

# Clone the repository
git clone https://github.com/kushal2060/Blockchain_live_expolrer.git
cd cardano-explorer

# Start everything with Docker Compose
docker-compose up --build

# Access the application
# Frontend: http://localhost:3000
# Backend:  http://localhost:8000
# WebSocket: ws://localhost:8000/ws

πŸ”§ Manual Setup

Backend Setup
# Navigate to backend directory
cd backend

# Install Oura
cargo install oura

# Verify Oura installation
oura --version

# Build the project
cargo build --release

# Run the backend
cargo run

# Backend will start on http://localhost:8000

Environment Variables (.env):

RUST_LOG=info
JWT_SECRET=your-super-secret-jwt-key-change-in-production
SERVER_HOST=127.0.0.1
SERVER_PORT=8000
Frontend Setup
# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Create environment file
cat > .env.local << EOF
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_WS_URL=ws://localhost:8000/ws
EOF

# Run development server
npm run dev

# Frontend will start on http://localhost:3000

Build for Production:

npm run build
npm run start

Wallet Integration

Supported Wallets

Wallet Website Status
Lace lace.io Recommended
Eternl eternl.io Supported
Yoroi yoroi-wallet.com Supported
Typhon typhonwallet.io Supported
Flint flint-wallet.com Supported

Authentication Flow

sequenceDiagram
    participant U as User
    participant W as Wallet
    participant F as Frontend
    participant B as Backend
    participant C as Cardano Node

    U->>F: Click "Connect Wallet"
    F->>W: Request Connection
    W->>U: Approve Connection?
    U->>W:  Approve
    W->>F: Connected βœ“
    
    U->>F: Click "Sign In"
    F->>B: Request Challenge
    B->>F: Return Message to Sign
    F->>W: Request Signature
    W->>U: Sign Message?
    U->>W: Sign
    W->>F: Signed Message
    F->>B: Submit Signature
    B->>B: Verify Signature
    B->>F: JWT Tokens
    F->>U: Authenticated!
Loading

Getting Started with Wallets

  1. Install a Wallet Extension

    • Choose from: Lace, Eternl, Yoroi, Typhon, or Flint
    • Install browser extension from official website
  2. Switch to PreProd Testnet

    • Open wallet settings
    • Select "PreProd" or "Testnet" network
    • Never use mainnet for testing!
  3. Get Test ADA (tADA)

  4. Connect to Explorer

    • Visit the live demo
    • Click "Connect Wallet"
    • Select your wallet
    • Approve connection
    • Sign authentication message
    • Start exploring!

API Endpoints

Public Endpoints

Method Endpoint Description
GET /health Health check
GET /api/blocks?limit=20 Get latest blocks
GET /api/blocks/latest Get latest block
GET /api/transactions?limit=50 Get latest transactions
GET /api/auth/challenge?address=<addr> Get authentication challenge
POST /api/auth/login Login with signed message
POST /api/auth/refresh Refresh access token
WS /ws WebSocket connection

Protected Endpoints (Requires JWT)

Method Endpoint Description
GET /api/auth/me Get current user info
POST /api/auth/logout Logout and revoke token
POST /api/auth/add-wallet Add additional wallet
GET /api/user/transactions Get user's transactions
GET /api/user/balance Get user's balance
GET /api/user/wallets Get connected wallets
Example API Calls

Get Latest Blocks:

curl https://blockchainliveexpolrer-production-b895.up.railway.app/api/blocks?limit=5

Get Authentication Challenge:

curl "https://blockchainliveexpolrer-production-b895.up.railway.app/api/auth/challenge?address=addr_test1qz..."

Login (with signature):

curl -X POST https://blockchainliveexpolrer-production-b895.up.railway.app/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "address": "addr_test1qz...",
    "message": "Sign this message...",
    "signature": "abc123...",
    "public_key": "def456..."
  }'

Access Protected Endpoint:

curl https://blockchainliveexpolrer-production-b895.up.railway.app/api/auth/me \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Project Structure

πŸ“‚ Backend Structure
backend/
β”œβ”€β”€ Cargo.toml
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs                 # Entry point & server setup
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ block.rs           # Block data structure
β”‚   β”‚   └── transaction.rs     # Transaction data structure
β”‚   β”œβ”€β”€ oura_stream.rs         # Oura integration & blockchain state
β”‚   β”œβ”€β”€ websocket.rs           # WebSocket handler
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ jwt.rs             # JWT generation & verification
β”‚   β”‚   β”œβ”€β”€ verification.rs    # Signature verification (Ed25519)
β”‚   β”‚   β”œβ”€β”€ middleware.rs      # Auth middleware
β”‚   β”‚   └── routes.rs          # Auth endpoints
β”‚   └── api/
β”‚       β”œβ”€β”€ mod.rs
β”‚       β”œβ”€β”€ blocks.rs          # Block endpoints
β”‚       β”œβ”€β”€ transactions.rs    # Transaction endpoints
β”‚       └── user_transactions.rs # User-specific endpoints
Frontend Structure
frontend/
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ tailwind.config.ts
β”œβ”€β”€ next.config.js
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ layout.tsx         # Root layout with providers
β”‚   β”‚   β”œβ”€β”€ page.tsx           # Home page (explorer)
β”‚   β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   β”‚   └── page.tsx       # User dashboard
β”‚   β”‚   β”œβ”€β”€ my-transactions/
β”‚   β”‚   β”‚   └── page.tsx       # User transactions
β”‚   β”‚   └── my-wallets/
β”‚   β”‚       └── page.tsx       # Wallet management
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”‚   └── Navbar.tsx     # Navigation bar
β”‚   β”‚   β”œβ”€β”€ wallet/
β”‚   β”‚   β”‚   β”œβ”€β”€ WalletConnectButton.tsx
β”‚   β”‚   β”‚   └── WalletModal.tsx
β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”‚   └── ProtectedRoute.tsx
β”‚   β”‚   β”œβ”€β”€ BlockList.tsx
β”‚   β”‚   β”œβ”€β”€ BlockCard.tsx
β”‚   β”‚   β”œβ”€β”€ TransactionList.tsx
β”‚   β”‚   └── Stats.tsx
β”‚   β”œβ”€β”€ context/
β”‚   β”‚   β”œβ”€β”€ WalletContext.tsx  # Wallet state management
β”‚   β”‚   └── AuthContext.tsx    # Auth state management
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ cardano.ts         # CIP-30 wallet interface
β”‚   β”‚   └── api.ts             # Backend API client
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   β”œβ”€β”€ wallet.ts
β”‚   β”‚   └── auth.ts
β”‚   └── hooks/
β”‚       └── useWebSocket.ts

Deployment

Backend Deployment (Railway)

# Dockerfile is already configured
# Just connect your repository to Railway or Fly.io

# Railway
railway up

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/luffy)
  3. Commit your changes (git commit -m 'Add some hakis')
  4. Push to the branch (git push origin feature/luffy)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments


⭐ Star this repository if you found it helpful!

Built with ❀️ for the Cardano community


Made with πŸ¦€ Rust and βš›οΈ React

About

Real-time Cardano blockchain explorer with Rust + Oura + WebSockets + Next.js | Live blocks & transactions streaming from PreProd testnet

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages