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

# Chains

> Reference for the Chain enum and supported blockchain networks in the Webacy SDK, including EVM, Solana, TON, Bitcoin, and address validation helpers.

Use the `Chain` enum to specify which blockchain you want to analyze. The SDK provides type-safe chain identifiers for all supported networks.

## Chain Enum

```typescript theme={null}
import { Chain } from '@webacy-xyz/sdk';

// Use in API calls
const result = await client.addresses.analyze('0x...', {
  chain: Chain.ETH,
});
```

## Supported Chains

| Chain             | Enum Value      | API Value | Type    |
| ----------------- | --------------- | --------- | ------- |
| Ethereum          | `Chain.ETH`     | `eth`     | EVM     |
| Solana            | `Chain.SOL`     | `sol`     | Solana  |
| Base              | `Chain.BASE`    | `base`    | EVM     |
| BNB Smart Chain   | `Chain.BSC`     | `bsc`     | EVM     |
| Polygon           | `Chain.POL`     | `pol`     | EVM     |
| Arbitrum          | `Chain.ARB`     | `arb`     | EVM     |
| Optimism          | `Chain.OPT`     | `opt`     | EVM     |
| TON               | `Chain.TON`     | `ton`     | TON     |
| Sui               | `Chain.SUI`     | `sui`     | Sui     |
| Stellar           | `Chain.STELLAR` | `stellar` | Stellar |
| Bitcoin           | `Chain.BTC`     | `btc`     | Bitcoin |
| Sei               | `Chain.SEI`     | `sei`     | Sei     |
| Hedera            | `Chain.HEDERA`  | `hedera`  | Hedera  |
| Sepolia (Testnet) | `Chain.SEP`     | `sep`     | EVM     |

## Default Chain

Set a default chain to avoid specifying it on every request.

<Info>
  **Prerequisites:**

  * SDK installed (`npm install @webacy-xyz/sdk`)
  * API key available (from your Webacy dashboard)
</Info>

```typescript theme={null}
import { ThreatClient, Chain } from '@webacy-xyz/sdk';

const client = new ThreatClient({
  apiKey: process.env.WEBACY_API_KEY,
  defaultChain: Chain.ETH,
});

// No need to specify chain - uses ETH
const result = await client.addresses.analyze('0x742d35Cc...');

// Override for a specific request
const solResult = await client.addresses.analyze('So1ana...', {
  chain: Chain.SOL,
});
```

## Chain Compatibility

The SDK provides utilities to check chain compatibility:

```typescript theme={null}
import { Chain, isEvmChain, getChainCompatibility, ChainCompatibility } from '@webacy-xyz/sdk';

// Check if chain is EVM-compatible
isEvmChain(Chain.ETH);  // true
isEvmChain(Chain.SOL);  // false

// Get compatibility group
getChainCompatibility(Chain.ETH);  // ChainCompatibility.EVM
getChainCompatibility(Chain.SOL);  // ChainCompatibility.SOLANA
getChainCompatibility(Chain.TON);  // ChainCompatibility.TON
```

### Compatibility Groups

| Group     | Chains                             |
| --------- | ---------------------------------- |
| `EVM`     | ETH, SEP, ARB, POL, OPT, BASE, BSC |
| `SOLANA`  | SOL                                |
| `TON`     | TON                                |
| `BTC`     | BTC                                |
| `SEI`     | SEI                                |
| `SUI`     | SUI                                |
| `STELLAR` | STELLAR                            |
| `HEDERA`  | HEDERA                             |

## Chain IDs

For EVM chains, you can access the chain ID:

```typescript theme={null}
import { CHAIN_IDS, Chain } from '@webacy-xyz/sdk';

CHAIN_IDS[Chain.ETH];   // 1
CHAIN_IDS[Chain.BSC];   // 56
CHAIN_IDS[Chain.POL];   // 137
CHAIN_IDS[Chain.OPT];   // 10
CHAIN_IDS[Chain.ARB];   // 42161
CHAIN_IDS[Chain.BASE];  // 8453
```

## Chain Names

Get human-readable chain names:

```typescript theme={null}
import { CHAIN_NAMES, Chain } from '@webacy-xyz/sdk';

CHAIN_NAMES[Chain.ETH];     // "Ethereum"
CHAIN_NAMES[Chain.SOL];     // "Solana"
CHAIN_NAMES[Chain.BSC];     // "BNB Smart Chain"
CHAIN_NAMES[Chain.STELLAR]; // "Stellar"
```

## Address Validation

The SDK automatically validates addresses for the specified chain when you call API methods:

```typescript theme={null}
// Valid Ethereum address
await client.addresses.analyze('0x742d35Cc6634C0532925a3b844Bc454e4438f44e', {
  chain: Chain.ETH,
});

// Valid Solana address
await client.addresses.analyze('So11111111111111111111111111111111111111112', {
  chain: Chain.SOL,
});

// Invalid address throws ValidationError
try {
  await client.addresses.analyze('invalid', { chain: Chain.ETH });
} catch (error) {
  // ValidationError: Invalid Ethereum address format
}
```

### Standalone Validation Utilities

You can also validate addresses and URLs directly without making API calls:

```typescript theme={null}
import {
  isValidAddress,
  isValidEvmAddress,
  isValidSolanaAddress,
  isValidBitcoinAddress,
  isValidTonAddress,
  isValidSuiAddress,
  isValidStellarAddress,
  isValidHederaAddress,
  isValidUrl,
  normalizeUrl,
  Chain,
} from '@webacy-xyz/sdk';

// Chain-aware validation
isValidAddress('0x742d35Cc...', Chain.ETH);     // true
isValidAddress('So111...', Chain.SOL);           // true

// Chain-specific validators
isValidEvmAddress('0x742d35Cc...');              // true
isValidSolanaAddress('So111...');                // true
isValidHederaAddress('0.0.1234567');             // true

// URL validation
isValidUrl('https://uniswap.org');               // true
normalizeUrl('uniswap.org');                     // 'https://uniswap.org'
```

### Address Formats

| Chain Type | Format                     | Example                                                    |
| ---------- | -------------------------- | ---------------------------------------------------------- |
| EVM        | 42-char hex with 0x prefix | `0x742d35Cc6634C0532925a3b844Bc454e4438f44e`               |
| Solana     | Base58, 32-44 chars        | `So11111111111111111111111111111111111111112`              |
| Bitcoin    | Various formats            | `bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq`               |
| TON        | Base64 or raw              | `EQBvW8Z5huBkMJYdnfAEM5JqTNLuuFU8cAF7P2CvbXj8-E-t`         |
| Stellar    | 56-char starting with G    | `GCKV3Z7HN3WUT2WIOUM4SMAS5DN3X5LWQ6FQXVH7ZRMWKFU4Z5IPQWWN` |
| Hedera     | Native `0.0.X` or EVM hex  | `0.0.1234567`                                              |
| Sui        | 66-char hex with 0x prefix | `0x7d2f...`                                                |
| Sei        | Bech32 with sei prefix     | `sei1...`                                                  |

## Endpoint Availability

Not all endpoints support all chains. See the [API Reference](../api-reference/introduction) for endpoint-specific chain support.

<Card title="Supported Blockchains Guide" icon="link-horizontal" href="../essentials/supported-blockchains">
  Complete chain support matrix with endpoint availability
</Card>
