# Blockchain Support

#### Supported Blockchains

| Blockchain   | Status            | Signature Standard       |
| ------------ | ----------------- | ------------------------ |
| **Cardano**  | ✅ Fully Supported | CIP-30 / CIP-8           |
| **Ethereum** | 🔜 Coming Soon    | EIP-191 (personal\_sign) |
| **Solana**   | 🔜 Coming Soon    | Ed25519                  |

> **Note:** We are currently only supporting **Cardano**. Ethereum and Solana support will be available in the coming days.

***

#### Cardano

**Supported Wallets**

| Wallet     | ID          | Status        |
| ---------- | ----------- | ------------- |
| Eternl     | eternl      | ✅ Recommended |
| Nami       | nami        | ✅ Supported   |
| Flint      | flint       | ✅ Supported   |
| Yoroi      | yoroi       | ✅ Supported   |
| Lace       | lace        | ✅ Supported   |
| Typhon     | typhoncip30 | ✅ Supported   |
| GeroWallet | gerowallet  | ✅ Supported   |
| NuFi       | nufi        | ✅ Supported   |

**Signature Standard: CIP-30**

TAGBASE uses the [CIP-30](https://cips.cardano.org/cip/CIP-30) standard for wallet communication and [CIP-8](https://cips.cardano.org/cip/CIP-8) for message signing.

**Signing Process:**

```javascript
// 1. Enable wallet
const api = await window.cardano.eternl.enable();

// 2. Get address (hex-encoded)
const addresses = await api.getUsedAddresses();
const addressHex = addresses[0];

// 3. Convert message to hex
const messageHex = Buffer.from(message).toString('hex');

// 4. Sign using signData (returns COSE_Sign1)
const { signature, key } = await api.signData(addressHex, messageHex);
```

**Response Format:**

| Field     | Description                 |
| --------- | --------------------------- |
| signature | COSE\_Sign1 signature (hex) |
| key       | COSE\_Key public key (hex)  |

**Address Formats**

TAGBASE accepts both formats and normalizes automatically:

| Format | Example                 |
| ------ | ----------------------- |
| Bech32 | addr1qx2kd28nq8ac5pr... |
| Hex    | 019bd6451e65b9f5...     |

**Token Holder Verification**

For Cardano native tokens, TAGBASE verifies:

1. **Signature validity** — Cryptographic proof the wallet signed the message
2. **Token ownership** — The wallet (or any address under the same stake key) holds the token

**Stake Key Matching:**

Cardano wallets often use multiple payment addresses under a single stake key. TAGBASE handles this by:

1. Looking up the stake address for the signing address
2. Fetching all payment addresses linked to that stake key
3. Checking if any of those addresses hold the required token

```
Signing Address → Stake Key → All Payment Addresses → Token Holder Check
```

**Token Data Requirements**

For holder verification, tokens must have:

| Field       | Required | Description                  |
| ----------- | -------- | ---------------------------- |
| asset\_id   | Yes      | Policy ID + Asset Name (hex) |
| policy\_id  | Optional | Token policy ID              |
| fingerprint | Optional | CIP-14 asset fingerprint     |

> **Note:** Blockfrost API is used for on-chain token holder lookups.

***

#### Ethereum (Coming Soon)

**Planned Wallet Support**

* MetaMask
* WalletConnect
* Coinbase Wallet
* Rainbow
* Trust Wallet

**Signature Standard: EIP-191**

```javascript
// personal_sign message signing
const signature = await ethereum.request({
  method: 'personal_sign',
  params: [message, address]
});
```

**Token Standards**

Planned support for:

* ERC-721 (NFTs)
* ERC-1155 (Multi-tokens)
* ERC-20 (Fungible tokens)

***

#### Solana (Coming Soon)

**Planned Wallet Support**

* Phantom
* Solflare
* Backpack

**Signature Standard**

Ed25519 message signing via Solana wallet adapters.

***

#### Verification Message Format

All blockchains use the same message structure:

```
Tagbase Ownership Verification

Verification ID: VRF_abc123def456
Nonce: 7a9c3f2e-1234-5678-abcd-ef0123456789
Expires: 2024-01-15T10:35:00.000Z
```

| Component       | Purpose                             |
| --------------- | ----------------------------------- |
| Verification ID | Links signature to specific product |
| Nonce           | Prevents replay attacks             |
| Expires         | 5-minute validity window            |

***

#### Security Model

**What Gets Verified**

| Check              | Description                           |
| ------------------ | ------------------------------------- |
| Signature validity | Cryptographic proof of wallet control |
| Message integrity  | Signed message matches challenge      |
| Expiry check       | Challenge not older than 5 minutes    |
| Token ownership    | Wallet holds the required token       |

**What's NOT Required**

* No transaction fees (signing is free)
* No private key exposure
* No on-chain transactions
* No token transfers

**Privacy**

* Wallet addresses are **masked** in public responses (e.g., addr1q...x7k4)
* Full addresses stored securely for verification
* No wallet balances or other assets are accessed

***

#### Network Requirements

| Blockchain | Network           |
| ---------- | ----------------- |
| Cardano    | **Mainnet only**  |
| Ethereum   | Mainnet (planned) |
| Solana     | Mainnet (planned) |

> Testnet signatures are not accepted for production verifications.

***

#### Troubleshooting

| Issue                           | Cause                                 | Solution                            |
| ------------------------------- | ------------------------------------- | ----------------------------------- |
| "Token not in wallet"           | Token held by different address       | Use wallet containing the token     |
| "Signature verification failed" | Message mismatch or invalid signature | Retry with fresh challenge          |
| "Challenge expired"             | More than 5 minutes elapsed           | Request new challenge               |
| Wallet not detected             | Extension not installed/enabled       | Install and enable wallet extension |
| Wrong network                   | Connected to testnet                  | Switch wallet to mainnet            |

***

#### API Endpoints Summary

| Endpoint                           | Blockchain | Purpose               |
| ---------------------------------- | ---------- | --------------------- |
| POST /verifications/{id}/challenge | All        | Get signing challenge |
| POST /verifications/{id}/proof     | Cardano    | Submit CIP-30 proof   |
| POST /verifications/{id}/proof     | Ethereum   | Submit EIP-191 proof  |
