# Pull Request Guide for ChainID 138 Updates

## Overview

This guide provides step-by-step instructions for creating pull requests to update ChainID 138 configurations in external repositories.

---

## 1. ethereum-lists/chains (Chainlist.org) - PRIORITY 1

### Repository
- **URL**: https://github.com/ethereum-lists/chains
- **File**: `_data/chains/eip155-138/chain.json`
- **Current Status**: ChainID 138 exists but has incorrect RPC URLs

### Current Configuration (in repository)
```json
{
  "name": "Defi Oracle Meta Mainnet",
  "chain": "dfiometa",
  "rpc": ["https://rpc.defi-oracle.io", "wss://wss.defi-oracle.io"]
}
```

### Required Updates

1. **Update RPC URLs**:
   ```json
   {
     "rpc": [
       "https://rpc-http-pub.d-bis.org",
       "https://rpc-http-prv.d-bis.org"
     ]
   }
   ```

2. **Verify Explorer URL**:
   ```json
   {
     "explorers": [{
       "name": "Blockscout",
       "url": "https://explorer.d-bis.org",
       "standard": "EIP3091"
     }]
   }
   ```

3. **Decision Needed**: Chain name
   - Current: "Defi Oracle Meta Mainnet"
   - Alternative: "DBIS Chain"
   - **Recommendation**: Keep current name if it's already established, or update if preferred

### Steps to Create PR

```bash
# 1. Fork the repository (via GitHub web interface)
# Go to: https://github.com/ethereum-lists/chains
# Click "Fork"

# 2. Clone your fork
git clone https://github.com/YOUR_USERNAME/chains.git
cd chains

# 3. Create a new branch
git checkout -b update-chainid-138-rpc-endpoints

# 4. Update the chain configuration
# Edit: _data/chains/eip155-138/chain.json
# Update RPC URLs to:
#   - https://rpc-http-pub.d-bis.org
#   - https://rpc-http-prv.d-bis.org

# 5. Verify the file is valid JSON
cat _data/chains/eip155-138/chain.json | jq .

# 6. Commit changes
git add _data/chains/eip155-138/chain.json
git commit -m "chore: update ChainID 138 RPC endpoints

- Update RPC URLs to use public and permissioned endpoints
- Public: https://rpc-http-pub.d-bis.org
- Permissioned: https://rpc-http-prv.d-bis.org
- Previous endpoints (rpc.defi-oracle.io) are deprecated"

# 7. Push to your fork
git push origin update-chainid-138-rpc-endpoints

# 8. Create PR via GitHub web interface
# Go to: https://github.com/ethereum-lists/chains
# Click "Compare & pull request"
```

### PR Description Template

```markdown
## Update ChainID 138 RPC Endpoints

### Summary
Updates RPC endpoints for ChainID 138 (Defi Oracle Meta Mainnet) to use the new public and permissioned endpoints.

### Changes
- Updated RPC URLs from `rpc.defi-oracle.io` to:
  - `https://rpc-http-pub.d-bis.org` (public endpoint)
  - `https://rpc-http-prv.d-bis.org` (permissioned endpoint)

### 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 are accessible
- ✅ Tested `eth_chainId` returns `0x8a` (138)
- ✅ Verified explorer URL is correct: `https://explorer.d-bis.org`

### Related
- Chain configuration: https://github.com/Defi-Oracle-Meta-Blockchain/metamask-integration
- Explorer: https://explorer.d-bis.org
```

---

## 2. Cross-Chain-Mirroring Repository - PRIORITY 2

### Repository
- **URL**: https://github.com/Defi-Oracle-Meta-Blockchain/Cross-Chain-Mirroring
- **Status**: Needs investigation

### Steps to Investigate and Update

```bash
# 1. Clone the repository
git clone https://github.com/Defi-Oracle-Meta-Blockchain/Cross-Chain-Mirroring.git
cd Cross-Chain-Mirroring

# 2. Search for ChainID 138 references
grep -r "138" . --include="*.json" --include="*.yaml" --include="*.yml" --include="*.toml" --include="*.env"
grep -r "rpc" . --include="*.json" --include="*.yaml" --include="*.yml" --include="*.toml" --include="*.env" -i

# 3. Search for old RPC URLs
grep -r "rpc-core.d-bis.org" .
grep -r "rpc.defi-oracle.io" .
grep -r "defi-oracle.io" .

# 4. Create branch for updates
git checkout -b update-chainid-138-rpc-endpoints

# 5. Update RPC URLs in configuration files
# Replace old URLs with:
#   - https://rpc-http-pub.d-bis.org (for public access)
#   - https://rpc-http-prv.d-bis.org (for permissioned access)

# 6. Commit and push
git add .
git commit -m "chore: update ChainID 138 RPC endpoints to public/permissioned URLs"
git push origin update-chainid-138-rpc-endpoints

# 7. Create PR
```

### PR Description Template

```markdown
## Update ChainID 138 RPC Endpoints

### Summary
Updates ChainID 138 RPC endpoints in cross-chain mirroring configuration to use the new public and permissioned endpoints.

### Changes
- Updated RPC URLs to:
  - `https://rpc-http-pub.d-bis.org` (public endpoint)
  - `https://rpc-http-prv.d-bis.org` (permissioned endpoint)

### Files Updated
- [List of files updated]

### Testing
- ✅ Verified RPC endpoints are accessible
- ✅ Tested cross-chain operations with new endpoints
```

---

## 3. app-ethereum (Ledger) Repository - PRIORITY 3

### Repository
- **URL**: https://github.com/Defi-Oracle-Meta-Blockchain/app-ethereum
- **Status**: Forked from LedgerHQ/app-ethereum

### Steps to Add ChainID 138 Support

```bash
# 1. Clone the repository
git clone https://github.com/Defi-Oracle-Meta-Blockchain/app-ethereum.git
cd app-ethereum

# 2. Check if ChainID 138 is already supported
grep -r "138" . --include="*.c" --include="*.h" --include="*.json"
grep -r "chain.*id" . -i --include="*.c" --include="*.h"

# 3. Look for network configuration files
find . -name "*network*" -o -name "*chain*" -o -name "*config*" | grep -i "chain\|network"

# 4. Check documentation
cat README.md | grep -i "chain\|network"

# 5. If ChainID 138 is not supported, add it:
#    - Add chain definition in appropriate config file
#    - Add network parameters (chain ID, RPC URLs, currency)
#    - Update documentation

# 6. Create branch
git checkout -b add-chainid-138-support

# 7. Commit and push
git add .
git commit -m "feat: add ChainID 138 (DBIS Chain) support

- Add ChainID 138 network configuration
- RPC: https://rpc-http-pub.d-bis.org
- Explorer: https://explorer.d-bis.org
- Currency: ETH (18 decimals)"
git push origin add-chainid-138-support

# 8. Create PR
```

### PR Description Template

```markdown
## Add ChainID 138 (DBIS Chain) Support

### Summary
Adds support for ChainID 138 (DBIS Chain) to the Ledger Ethereum app, enabling users to interact with ChainID 138 using Ledger hardware wallets.

### Changes
- Added ChainID 138 network configuration
- Network name: DBIS Chain
- Chain ID: 138 (0x8a)
- RPC endpoint: https://rpc-http-pub.d-bis.org
- Block explorer: https://explorer.d-bis.org
- Native currency: ETH (18 decimals)

### Testing
- ✅ Verified network configuration
- ✅ Tested transaction signing on Ledger device
- ✅ Verified RPC connectivity

### Related
- Chain configuration: https://chainlist.org (after PR merge)
- Explorer: https://explorer.d-bis.org
```

---

## Verification Checklist

Before creating PRs, verify:

- [ ] RPC endpoints are accessible and return correct Chain ID
- [ ] JSON files are valid (use `jq .` to validate)
- [ ] All references to old RPC URLs are updated
- [ ] Documentation is updated (if applicable)
- [ ] Changes are tested locally
- [ ] Commit messages follow conventional commits format
- [ ] PR descriptions are clear and complete

---

## Testing Commands

### Test Public RPC
```bash
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}'
# Should return: {"jsonrpc":"2.0","id":1,"result":"0x8a"}
```

### Test Permissioned RPC
```bash
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}'
# Should return: {"jsonrpc":"2.0","id":1,"result":"0x8a"}
```

### Validate JSON
```bash
cat file.json | jq .
```

---

**Last Updated**: 2025-12-24
**Status**: Ready for PR Creation

