# Custom Domain for MetaMask Token List - Recommendation

**Date**: $(date)  
**Domain**: `d-bis.org`  
**Question**: Should you use a custom domain for GitHub Pages token list?

---

## 📊 Recommendation: ✅ **YES - Use Custom Domain**

**Recommended Subdomain**: `tokens.d-bis.org` or `metamask.d-bis.org`

---

## ✅ Pros of Using Custom Domain

### 1. **Professional Branding**
- ✅ Consistent with your infrastructure (`rpc-core.d-bis.org`, `explorer.d-bis.org`)
- ✅ Shorter, memorable URL: `https://tokens.d-bis.org/token-list.json`
- ✅ Better than: `https://defi-oracle-meta-blockchain.github.io/metamask-integration/config/token-list.json`

### 2. **User Trust**
- ✅ Users see your domain, not GitHub
- ✅ Consistent branding across all services
- ✅ Professional appearance

### 3. **Flexibility**
- ✅ Can switch hosting later without changing URL
- ✅ Can add multiple token lists under same domain
- ✅ Can add API endpoints later

### 4. **Consistency**
- ✅ Matches your existing pattern:
  - `rpc-core.d-bis.org` (RPC)
  - `explorer.d-bis.org` (Explorer)
  - `tokens.d-bis.org` (Token List) ← New

---

## ❌ Cons of Using Custom Domain

### 1. **Additional Setup**
- ⚠️ Need to configure DNS
- ⚠️ Need to verify domain in GitHub
- ⚠️ Slightly more complex

### 2. **Maintenance**
- ⚠️ Need to keep DNS record updated
- ⚠️ SSL certificate management (handled by GitHub Pages)

---

## 🎯 Recommended Subdomain Options

### Option 1: `tokens.d-bis.org` ✅ **RECOMMENDED**

**Pros**:
- ✅ Clear purpose (token list)
- ✅ Short and memorable
- ✅ Can host multiple token lists later

**URL**: `https://tokens.d-bis.org/token-list.json`

### Option 2: `metamask.d-bis.org`

**Pros**:
- ✅ Specific to MetaMask integration
- ✅ Clear purpose

**URL**: `https://metamask.d-bis.org/token-list.json`

### Option 3: `api.d-bis.org`

**Pros**:
- ✅ Can expand to full API later
- ✅ Professional naming

**URL**: `https://api.d-bis.org/token-list.json`

**Recommendation**: Use **`tokens.d-bis.org`** ✅

---

## 🚀 Setup Instructions

### Step 1: Configure DNS in Cloudflare

**In Cloudflare DNS Dashboard**:

1. **Go to DNS**:
   - Cloudflare Dashboard → `d-bis.org` → DNS → Records

2. **Create CNAME Record**:
   ```
   Type: CNAME
   Name: tokens
   Target: defi-oracle-meta-blockchain.github.io
   Proxy: ⚪ DNS only (gray cloud) - REQUIRED for GitHub Pages
   TTL: Auto
   ```

   **Important**: 
   - ✅ Must use **DNS only** (not proxied) for GitHub Pages
   - ✅ Target must be: `<username>.github.io` (no path)

3. **Save Record**

### Step 2: Configure Custom Domain in GitHub Pages

**In GitHub Repository Settings**:

1. **Go to Pages Settings**:
   - Repository → Settings → Pages

2. **Add Custom Domain**:
   - Under "Custom domain", enter: `tokens.d-bis.org`
   - Click **Save**

3. **Verify Domain**:
   - GitHub will show verification instructions
   - Add TXT record to DNS (if required)
   - Wait for verification (usually 1-2 minutes)

4. **Enable HTTPS**:
   - After verification, GitHub will provision SSL certificate
   - Enable "Enforce HTTPS" checkbox
   - Wait for certificate (5-10 minutes)

### Step 3: Update Token List Path

**Current Structure**:
```
config/token-list.json
```

**After Custom Domain**:
- URL: `https://tokens.d-bis.org/config/token-list.json`
- Or move to root: `https://tokens.d-bis.org/token-list.json`

**Recommendation**: Keep `config/token-list.json` structure (more organized)

---

## 📋 DNS Configuration Details

### Cloudflare DNS Record

```
Type: CNAME
Name: tokens
Target: defi-oracle-meta-blockchain.github.io
Proxy: ⚪ DNS only (gray cloud)
TTL: Auto
Comment: GitHub Pages for MetaMask token list
```

### Why DNS Only (Not Proxied)?

GitHub Pages requires:
- Direct DNS resolution to GitHub's servers
- Cloudflare Proxy can interfere with GitHub's SSL certificates
- GitHub handles SSL/TLS automatically

**Note**: You lose Cloudflare DDoS protection, but GitHub Pages has its own protection.

---

## ✅ Verification Steps

### 1. Test DNS Resolution

```bash
dig tokens.d-bis.org
nslookup tokens.d-bis.org

# Should resolve to GitHub Pages IPs
```

### 2. Test HTTPS Access

```bash
curl -I https://tokens.d-bis.org/config/token-list.json

# Should return:
# HTTP/2 200
# Content-Type: application/json
```

### 3. Verify SSL Certificate

```bash
openssl s_client -connect tokens.d-bis.org:443 -servername tokens.d-bis.org

# Should show GitHub Pages certificate
```

### 4. Test in MetaMask

1. Add token list URL: `https://tokens.d-bis.org/config/token-list.json`
2. Verify tokens appear
3. Check metadata

---

## 🔄 Alternative: Keep GitHub Pages URL

**If you prefer simplicity**:

- ✅ No DNS configuration needed
- ✅ Works immediately
- ✅ GitHub handles everything
- ❌ Longer URL
- ❌ Less professional

**URL**: `https://defi-oracle-meta-blockchain.github.io/metamask-integration/config/token-list.json`

---

## 📊 Comparison

| Feature | Custom Domain | GitHub Pages URL |
|--------|---------------|-------------------|
| **URL Length** | ✅ Short | ❌ Long |
| **Branding** | ✅ Professional | ❌ Generic |
| **Setup Complexity** | ⚠️ Medium | ✅ Simple |
| **Maintenance** | ⚠️ DNS + GitHub | ✅ GitHub only |
| **SSL Certificate** | ✅ Auto (GitHub) | ✅ Auto (GitHub) |
| **Consistency** | ✅ Matches infrastructure | ❌ Different pattern |
| **Flexibility** | ✅ Can switch hosting | ⚠️ Tied to GitHub |

---

## 🎯 Final Recommendation

**Use Custom Domain**: ✅ **YES**

**Configuration**:
- **Subdomain**: `tokens.d-bis.org`
- **DNS**: CNAME to `defi-oracle-meta-blockchain.github.io` (DNS only)
- **GitHub Pages**: Add custom domain in settings
- **URL**: `https://tokens.d-bis.org/config/token-list.json`

**Benefits**:
- ✅ Professional appearance
- ✅ Consistent with your infrastructure
- ✅ Shorter, memorable URL
- ✅ Better user experience

**Setup Time**: ~10-15 minutes

---

## 📚 Related Documentation

- [GitHub Pages Setup Guide](./METAMASK_GITHUB_PAGES_INSTRUCTIONS.md)
- [Token List Hosting Guide](./METAMASK_TOKEN_LIST_HOSTING.md)
- [Cloudflare DNS Configuration](../04-configuration/CLOUDFLARE_DNS_SPECIFIC_SERVICES.md)

---

**Last Updated**: $(date)

