> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shieldhq.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Contract Verification

> Verify Shield contract on BaseScan

# Contract Verification

Verify the Shield contract source code on BaseScan for transparency.

## Why Verify?

* ✅ Users can verify contract logic
* ✅ Tools can read contract ABI
* ✅ Required for some integrations
* ✅ Builds trust

## Hardhat Verification

### Install Plugin

```bash theme={null}
cd contracts
npm install --save-dev @nomicfoundation/hardhat-verify
```

### Configure

```typescript theme={null}
// hardhat.config.ts
import '@nomicfoundation/hardhat-verify';

export default {
  // ... other config
  etherscan: {
    apiKey: {
      baseSepolia: process.env.BASESCAN_API_KEY,
      baseMainnet: process.env.BASESCAN_API_KEY,
    },
  },
};
```

### Get API Key

1. Go to [BaseScan](https://basescan.org)
2. Register account
3. Go to API Keys
4. Create new key

### Verify

```bash theme={null}
# Testnet
npx hardhat verify --network baseSepolia CONTRACT_ADDRESS

# Mainnet
npx hardhat verify --network baseMainnet CONTRACT_ADDRESS
```

## Manual Verification

If Hardhat verification fails, verify manually:

1. Go to [BaseScan](https://basescan.org)
2. Search for contract address
3. Click "Verify and Publish"
4. Select:
   * Compiler Type: Solidity (Single file)
   * Compiler Version: 0.8.24
   * License: MIT
5. Paste source code
6. Click "Verify"

## Flattened Source

If using imports, flatten first:

```bash theme={null}
npx hardhat flatten contracts/Shield.sol > Shield_flat.sol
```

Then verify with `Shield_flat.sol`.

## Verification Status

Check verification status:

```bash theme={null}
curl "https://api.basescan.org/api?module=contract&action=getabi&address=CONTRACT_ADDRESS"
```

Success response:

```json theme={null}
{
  "status": "1",
  "message": "OK",
  "result": "[{\"constant\":true,\"inputs\":[]..."
}
```
