# Chainlist Schema Validation for ChainID 138

## Schema Requirements

Based on the Chainlist JSON schema, here are the required and optional fields:

### Required Fields
- ✅ `name` - Name of the Network
- ✅ `shortName` - Short identifier (pattern: `^[A-Za-z0-9-_]{1,64}$`)
- ✅ `chain` - Name of the Network
- ✅ `chainId` - Chain ID (number)
- ✅ `networkId` - Network ID (number)
- ✅ `rpc` - Array of RPC URLs (strings)
- ✅ `faucets` - Array of faucet URLs (strings)
- ✅ `infoURL` - Information URL (string)
- ✅ `nativeCurrency` - Object with `name`, `symbol`, `decimals`

### Optional Fields
- `title` - Optional title for the Network
- `icon` - Icon type/URL
- `features` - Array of feature objects (e.g., EIP155)
- `slip44` - Slip44 number
- `ens` - ENS registry configuration
- `explorers` - Array of explorer objects
- `parent` - Parent chain information
- `status` - Chain status
- `redFlags` - Array of red flags (e.g., "reusedChainId")

---

## Our chain-138.json Validation

### Current Configuration

```json
{
  "name": "DBIS Chain",
  "chain": "DBIS",
  "rpc": [
    "https://rpc-http-pub.d-bis.org",
    "https://rpc-http-prv.d-bis.org"
  ],
  "faucets": [],
  "nativeCurrency": {
    "name": "Ether",
    "symbol": "ETH",
    "decimals": 18
  },
  "infoURL": "https://d-bis.org",
  "shortName": "dbis",
  "chainId": 138,
  "networkId": 138,
  "explorers": [
    {
      "name": "Blockscout",
      "url": "https://explorer.d-bis.org",
      "standard": "EIP3091"
    }
  ],
  "icon": "https://raw.githubusercontent.com/ethereum/ethereum.org/main/static/images/eth-diamond-black.png"
}
```

### Validation Results

✅ **All Required Fields Present**:
- ✅ `name`: "DBIS Chain"
- ✅ `shortName`: "dbis" (matches pattern `^[A-Za-z0-9-_]{1,64}$`)
- ✅ `chain`: "DBIS"
- ✅ `chainId`: 138
- ✅ `networkId`: 138
- ✅ `rpc`: Array with 2 URLs
- ✅ `faucets`: Empty array (valid)
- ✅ `infoURL`: "https://d-bis.org"
- ✅ `nativeCurrency`: Object with name, symbol, decimals

✅ **Optional Fields**:
- ✅ `explorers`: Array with Blockscout explorer
- ✅ `icon`: Icon URL

✅ **Schema Compliance**: **PASSED**

---

## Comparison with Current Chainlist Entry

### Current Entry in ethereum-lists/chains

Based on the curl test, the current entry shows:
```json
{
  "name": "Defi Oracle Meta Mainnet",
  "chain": "dfiometa",
  "rpc": ["https://rpc.defi-oracle.io", "wss://wss.defi-oracle.io"]
}
```

### Differences

| Field | Current (Chainlist) | Our Config | Action |
|-------|---------------------|------------|--------|
| `name` | "Defi Oracle Meta Mainnet" | "DBIS Chain" | ⚠️ **Decision needed** |
| `chain` | "dfiometa" | "DBIS" | ⚠️ **Decision needed** |
| `rpc` | `rpc.defi-oracle.io` | `rpc-http-pub.d-bis.org` | ✅ **Must update** |
| `shortName` | Unknown | "dbis" | ⚠️ **Check current** |
| `explorers` | Unknown | Blockscout | ⚠️ **Verify/Add** |

---

## Recommended PR Strategy

### Option 1: Update RPC URLs Only (Safest)
- Keep existing name: "Defi Oracle Meta Mainnet"
- Keep existing chain: "dfiometa"
- **Only update RPC URLs** to new endpoints
- **Add/verify explorer** if missing

**PR Changes**:
```json
{
  "rpc": [
    "https://rpc-http-pub.d-bis.org",
    "https://rpc-http-prv.d-bis.org"
  ]
}
```

### Option 2: Full Update (More Comprehensive)
- Update name to "DBIS Chain" (if preferred)
- Update chain to "DBIS"
- Update RPC URLs
- Ensure all fields match our config

**PR Changes**:
- Update `name`, `chain`, `rpc`, `explorers`, etc.

---

## Validation Checklist

Before creating PR, verify:

- [ ] All required fields are present
- [ ] `shortName` matches pattern: `^[A-Za-z0-9-_]{1,64}$`
- [ ] `rpc` array contains valid URLs
- [ ] `nativeCurrency` has `name`, `symbol`, `decimals`
- [ ] `chainId` is 138
- [ ] `networkId` is 138
- [ ] JSON is valid (no syntax errors)
- [ ] RPC URLs are accessible
- [ ] Explorer URL is accessible

---

## Testing Commands

### Validate JSON Structure
```bash
cat token-lists/chainlists/chain-138.json | jq .
```

### Test RPC Endpoints
```bash
# Public RPC
curl -X POST https://rpc-http-pub.d-bis.org \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'

# Permissioned RPC
curl -X POST https://rpc-http-prv.d-bis.org \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'
```

### Check Current Chainlist Entry
```bash
curl -s "https://raw.githubusercontent.com/ethereum-lists/chains/master/_data/chains/eip155-138/chain.json" | jq .
```

---

## PR File Path

**Target File**: `_data/chains/eip155-138/chain.json`

**Full Path in Repository**: 
```
ethereum-lists/chains/_data/chains/eip155-138/chain.json
```

---

## Recommended PR Description

```markdown
## Update ChainID 138 RPC Endpoints

### Summary
Updates RPC endpoints for ChainID 138 to use the new public and permissioned endpoints.

### Changes
- Updated RPC URLs:
  - From: `https://rpc.defi-oracle.io`, `wss://wss.defi-oracle.io`
  - To: `https://rpc-http-pub.d-bis.org`, `https://rpc-http-prv.d-bis.org`

### Reason
The previous RPC endpoints have been deprecated. The new endpoints provide:
- Public access for general use (MetaMask, dApps)
- Permissioned access for authorized services

### Testing
- ✅ Verified RPC endpoints return Chain ID 138 (0x8a)
- ✅ Tested `eth_chainId` method on both endpoints
- ✅ Verified JSON schema compliance
- ✅ Validated all required fields are present

### Related
- Explorer: https://explorer.d-bis.org
- Token List: https://raw.githubusercontent.com/Defi-Oracle-Meta-Blockchain/metamask-integration/main/config/token-list.json
```

---

**Last Updated**: 2025-12-24
**Status**: ✅ Schema Validation Complete - Ready for PR

