# Infura Settings Fix

**Date**: 2025-12-11
**Issue**: Infura RPC requires project secret authentication

---

## 📋 Current Configuration (lines 14-19)

From `.env`:
- **INFURA_PROJECT_ID** or **METAMASK_API_KEY**: Infura Project ID (set in .env; never commit)
- **INFURA_PROJECT_SECRET** or **METAMASK_SECRET**: Infura project secret for Basic Auth
- **INFURA_GAS_API**: optional; scripts also use INFURA_PROJECT_ID for Gas API
- **ETHEREUM_MAINNET_RPC**: `https://mainnet.infura.io/v3/<INFURA_PROJECT_ID>`; relay adds Basic Auth from INFURA_PROJECT_SECRET
- **Line 19**: `ETHERSCAN_API_KEY=...`

---

## ❌ Issue

**Error**: `HTTP error 403 with body: private key only is enabled in Project ID settings`

**Cause**: Infura project has "Private Key Only" setting enabled, which requires project secret authentication.

---

## ✅ Solutions

### Solution 1: Disable "Private Key Only" in Infura (Easiest)

1. Go to https://infura.io/
2. Log in to your account
3. Select your project (ID set in .env as INFURA_PROJECT_ID)
4. Go to **Settings**
5. Find **"Private Key Only"** setting
6. **Disable** it
7. Save changes

After this, the RPC URL with project ID will work (or use INFURA_PROJECT_SECRET for Basic Auth):
```bash
ETHEREUM_MAINNET_RPC=https://mainnet.infura.io/v3/<INFURA_PROJECT_ID>
```

### Solution 2: Get Infura Project Secret

1. Go to Infura dashboard
2. Select your project
3. Go to **Settings**
4. Copy the **"Project Secret"**
5. Update `.env` line 18:
   ```bash
   # Set INFURA_PROJECT_SECRET in .env; relay builds Basic Auth URL automatically.
   ETHEREUM_MAINNET_RPC=https://mainnet.infura.io/v3/<INFURA_PROJECT_ID>
   ```

### Solution 3: Use Alternative RPC Provider

Update `.env` line 18 with alternative provider:

**Alchemy**:
```bash
ETHEREUM_MAINNET_RPC=https://eth-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY
```

**QuickNode**:
```bash
ETHEREUM_MAINNET_RPC=https://your-endpoint.quiknode.pro/YOUR_API_KEY
```

**Public RPC** (not recommended for production):
```bash
ETHEREUM_MAINNET_RPC=https://eth.llamarpc.com
```

---

## 🚀 Recommended Action

**Easiest**: Disable "Private Key Only" in Infura dashboard settings.

**Scripts**: When `INFURA_PROJECT_SECRET` is set in `.env`, deployment and verification scripts now use Infura with Basic Auth automatically (see [RPC_URLS_AND_INFURA_ACCESS.md](RPC_URLS_AND_INFURA_ACCESS.md)).

This will allow the current RPC URL (line 18) to work without changes.

---

## ✅ After Fix

Once RPC is working, deployment will proceed automatically:

```bash
# Deploy MainnetTether
forge script script/DeployMainnetTether.s.sol \
  --rpc-url "$ETHEREUM_MAINNET_RPC" \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --verify \
  -vvvv

# Deploy TransactionMirror
forge script script/DeployTransactionMirror.s.sol \
  --rpc-url "$ETHEREUM_MAINNET_RPC" \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --verify \
  --via-ir \
  -vvvv
```

---

**Last Updated**: 2025-12-11
**Status**: Infura Settings Fix Required

