# Verify Ethereum Asset

## Ethereum Asset Verification API

The Ethereum Asset Verification API allows developers to verify whether a user holds specific assets on the Ethereum mainnet, including ERC20 tokens and NFTs (ERC721). This API is crucial for integrating asset verification into decentralized applications (dApps) and services built on Ethereum, enabling secure and reliable checks for asset ownership directly on the Ethereum blockchain.

**Asset Verification API**

This API allows you to verify if a user holds a specific asset on the Ethereum mainnet, including ERC20 and ERC721 tokens.

**Endpoint**:

```plaintext
POST https://alpha.gr1d.network/api/ccq-evm
```

**Headers**:

* `Authorization`: `<GR1D_API_KEY>` (Contact <z@1kin.io> to get early access)
* `Content-Type`: `application/json`

**Request Body**:

```json
{
    "user_address": "0x29469395eaf6f95920e59f858042f0e28d98a20b",
    "contract_address": "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d"
}
```

* **`user_address`**: The Ethereum address of the user whose asset holdings are being verified.
* **`contract_address`**: The address of the ERC20 or ERC721 contract.

**Sample Response**:

```json
{
    "status": 200,
    "message": "Assets Fetched Successfully",
    "data": {
        "user_address": "0x29469395eaf6f95920e59f858042f0e28d98a20b",
        "asset": {
            "balance": 183,
            "QueryResult": "0x00000000000000000000000000000000000000000000000000000000000000b7"
        }
    }
}
```

* **`status`**: HTTP status code (200 indicates success).
* **`message`**: A message indicating the result of the query.
* **`data`**:
  * **`user_address`**: The Ethereum address queried.
  * **`asset.balance`**: The number of tokens the user holds.
  * **`asset.QueryResult`**: A hexadecimal string representing the encoded query result.

**Error Handling**

In the event of an error, the API will return a response with the appropriate HTTP status code and an error message. Common error codes include:

* **400**: Bad Request - The request parameters are invalid.
* **401**: Unauthorized - The `GR1D_API_KEY` is missing or invalid.
* **404**: Not Found - The specified `contract_address` or `user_address` is invalid.
* **500**: Internal Server Error - An unexpected error occurred on the server.

**Security Considerations**

* **API Key Management**: Ensure that the `GR1D_API_KEY` is kept secure and never exposed in client-side code or public repositories.
* **Data Integrity**: The query results are signed by Wormhole guardians, ensuring data integrity across chains.
* **Rate Limiting**: Be aware of any rate limits imposed on the API to prevent abuse and ensure fair usage.

**Examples and Edge Cases**

* **ERC20 Token Verification**:

  ```json
  {
      "user_address": "0x1234567890abcdef1234567890abcdef12345678",
      "contract_address": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef"
  }
  ```

  Expected response: The `balance` field will indicate the number of ERC20 tokens held by the user.
* **ERC721 Token Verification**:

  ```json
  {
      "user_address": "0x1234567890abcdef1234567890abcdef12345678",
      "contract_address": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef"
  }
  ```

  Expected response: The `balance` field will indicate the number of ERC721 tokens (or assets) held by the user.
* **No Asset Held**:

  ```json
  {
      "user_address": "0x1234567890abcdef1234567890abcdef12345678",
      "contract_address": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcdef"
  }
  ```

  Expected response: The `balance` field will be `0`, and the `QueryResult` will reflect that no assets were found.
