Skip to content

Repository files navigation

ENS Tools - Web3 Ethereum Name Service Platform

Node.js Version Static IPFS License Build Status Coverage

Decentralized Ethereum Name Service management platform with Web3 wallet integration, static deployment, and IPFS support.

Features

Core Functionality

  • ENS Resolution: Resolve .eth names to Ethereum addresses
  • Ownership Queries: Check ENS name ownership and expiry dates
  • Availability Checking: Verify name availability for registration
  • Text Records: Retrieve and manage ENS text records
  • Content Hashes: Handle IPFS and other content hash protocols

Web3 Features

  • Wallet Integration: MetaMask, WalletConnect, and Coinbase Wallet support
  • Multi-Chain: Support for Ethereum mainnet, testnets, Polygon, and Arbitrum
  • Decentralized: Static deployment with IPFS support for true decentralization
  • Performance: Optimized for Web3 with efficient RPC calls and caching
  • Security: Web3-specific security with wallet connection validation
  • Analytics: On-chain data analysis and ENS portfolio tracking
  • Real-time: Live updates for ENS name status and transactions

Web3 Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Web3 Wallets  │────│   DApp Frontend │────│   ENS Service   │
│                 │    │   (Static Site)  │    │   (Client-side) │
│ - MetaMask      │    │   (IPFS/Static) │    │ - RPC Calls     │
│ - WalletConnect │    │   (No Backend)  │    │ - On-chain Data │
│ - Coinbase      │    │                 │    │ - Cache Layer   │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                       │                       │
         └───────────────────────┼───────────────────────┘
                                 │
                    ┌─────────────────┐    ┌─────────────────┐
                    │   Blockchain     │────│   IPFS/Storage  │
                    │   Networks       │    │   (Decentralized)│
                    │                  │    │                 │
                    │ - Ethereum       │    │ - ENS Records   │
                    │ - Polygon        │    │ - Content Hashes│
                    │ - Arbitrum       │    │ - Metadata      │
                    └─────────────────┘    └─────────────────┘

Prerequisites

  • Node.js: 18.0.0 or higher
  • Web3 Wallet: MetaMask, Coinbase Wallet, or any WalletConnect-compatible wallet
  • IPFS (optional): For decentralized deployment
  • Git: For version control and deployment

Quick Start

1. Clone and Setup

# Clone the repository
git clone https://github.com/your-org/ens-tools.git
cd ens-tools

# Install dependencies
npm install

# Copy environment configuration
cp .env.example .env

# Edit environment variables
nano .env

2. Environment Configuration

# Required environment variables
NODE_ENV=development
PORT=3001
ETHEREUM_NETWORK=mainnet
INFURA_API_KEY=your_infura_api_key
JWT_SECRET=your_secure_jwt_secret_min_32_chars
MONGODB_URI=mongodb://localhost:27017/ens-tools
REDIS_URL=redis://localhost:6379

3. Development

# Start development server with hot reload
npm run dev

# Run linting
npm run lint

# Run tests
npm run test

# Run tests with coverage
npm run test:unit

4. Production Build

# Build the application
npm run build

# Start production server
npm start

Web3 Deployment

Static Hosting (Recommended for Web3)

Web3 applications are typically deployed as static sites to maximize decentralization and reduce server dependencies.

Netlify Deployment

# Install Netlify CLI
npm install -g netlify-cli

# Build and deploy
npm run deploy:netlify

# Or deploy manually
npm run build
netlify deploy --prod --dir=public

Vercel Deployment

# Install Vercel CLI
npm install -g vercel

# Deploy
npm run deploy:vercel

# Or deploy manually
vercel --prod

IPFS Deployment

# Install IPFS deploy tools
npm install -g ipfs-deploy

# Build and deploy to IPFS
npm run deploy:ipfs

# Pin to IPFS for permanence
ipfs pin add <your-deployment-hash>

Traditional Static Hosting

# Build the application
npm run build

# Serve static files
npm run serve

# Or use any static hosting service:
# - GitHub Pages
# - AWS S3 + CloudFront
# - Firebase Hosting
# - Surge.sh

API Usage

Health Check

curl http://localhost:3001/health

Resolve ENS Name

curl http://localhost:3001/api/v1/ens/resolve/vitalik.eth

Check Availability

curl -X POST http://localhost:3001/api/v1/ens/availability \
  -H "Content-Type: application/json" \
  -d '{"name": "mynewname"}'

Get Text Record

curl http://localhost:3001/api/v1/ens/text/example.eth/email

Testing

Unit Tests

# Run unit tests
npm run test:unit

# Run with coverage
npm run test:unit -- --coverage

# Run specific test file
npm run test:unit -- tests/unit/services/ens.test.js

Integration Tests

# Run integration tests
npm run test:integration

End-to-End Tests

# Run e2e tests
npm run test:e2e

Test Coverage

# Generate coverage report
npm run test:unit

# View coverage report
open coverage/lcov-report/index.html

Monitoring

Health Endpoints

  • GET /health - Basic health check
  • GET /health/detailed - Detailed system information
  • GET /health/ready - Readiness probe for orchestration
  • GET /health/live - Liveness probe for orchestration

Logging

All requests are logged with the following information:

  • Request ID for tracking
  • Response time and status
  • IP address and user agent
  • Error details with stack traces

Metrics (Future Enhancement)

  • Request/response metrics
  • Error rates and patterns
  • Performance monitoring
  • Database query metrics

Security

Features

  • Helmet.js: Security headers and XSS protection
  • Rate Limiting: Configurable request limits per IP
  • Input Validation: Comprehensive validation with express-validator
  • CORS: Configurable cross-origin resource sharing
  • Data Sanitization: Automatic XSS and injection prevention
  • JWT Authentication: Secure token-based authentication (future)

Configuration

// Security settings in config
const securityConfig = {
  rateLimit: {
    windowMs: 15 * 60 * 1000, // 15 minutes
    max: 100 // limit each IP to 100 requests per windowMs
  },
  cors: {
    origin: process.env.CORS_ORIGIN || 'http://localhost:3000',
    credentials: true
  },
  jwt: {
    secret: process.env.JWT_SECRET,
    expiresIn: '24h'
  }
};

API Documentation

Complete API documentation is available at:

  • Swagger UI: http://localhost:3001/api/docs
  • OpenAPI Spec: /docs/api/README.md
  • Postman Collection: /docs/api/postman_collection.json

Key Endpoints

Method Endpoint Description
GET /health Health check
GET /api/v1/ens/resolve/:name Resolve ENS name
GET /api/v1/ens/owner/:name Get name owner
POST /api/v1/ens/availability Check availability
GET /api/v1/ens/expiry/:name Get expiry date
GET /api/v1/ens/text/:name/:key Get text record

Deployment

Development

npm run dev

Production

# Build and deploy
npm run build
npm start

# Or using Docker
docker-compose -f docker-compose.prod.yml up -d

Kubernetes

# Deploy to Kubernetes
kubectl apply -f k8s/

# Check deployment status
kubectl get pods -n ens-tools

Decentralized Hosting

  • IPFS: Permanent, decentralized hosting
  • Filecoin: Long-term storage with incentives
  • Arweave: Permanent data storage

See Web3 Deployment section above for detailed instructions.

Development

Project Structure

ens-tools/
├── src/
│   ├── controllers/     # Route handlers
│   ├── middleware/      # Express middleware
│   ├── services/        # Business logic
│   ├── models/          # Data models
│   ├── utils/           # Utility functions
│   ├── validators/      # Input validation
│   ├── config/          # Configuration management
│   └── app.js          # Application setup
├── tests/
│   ├── unit/           # Unit tests
│   ├── integration/    # Integration tests
│   └── e2e/            # End-to-end tests
├── docs/
│   ├── api/            # API documentation
│   ├── deployment/     # Deployment guides
│   └── architecture/   # Architecture docs
├── public/             # Static assets
├── scripts/            # Build and deployment scripts
├── docker-compose.yml  # Docker orchestration
├── Dockerfile         # Container definition
└── package.json       # Dependencies and scripts

Code Quality

# Linting
npm run lint

# Code formatting
npm run format

# Type checking (future)
npm run type-check

# Security audit
npm run security

Git Hooks

Pre-commit hooks are configured to:

  • Run linting
  • Run tests
  • Check code formatting
  • Prevent commits with security issues

Contributing

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

Development Guidelines

  • Follow the contributing guide
  • Write tests for new features
  • Update documentation
  • Follow the existing code style
  • Use conventional commits

License

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

Acknowledgments

Support

Roadmap

Phase 1 (Current)

  • Basic ENS operations
  • RESTful API
  • Static deployment
  • Comprehensive testing
  • Web3 security

Phase 2 (Next)

  • User authentication and authorization
  • Advanced analytics dashboard
  • WebSocket real-time updates
  • Multi-chain support
  • Advanced caching strategies

Phase 3 (Future)

  • ENS name management interface
  • Bulk operations
  • Integration APIs
  • Mobile SDKs
  • Advanced monitoring and alerting

ENS Tools - Making Ethereum Name Service management enterprise-ready.

About

test

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages