# Developers: Guide

### Quick Guide

\
**Step 1: Access Project Data**

Use [api.ecotoken.earth](https://api.ecotoken.earth) to retrieve active projects, their details, and associated wallet addresses.

**Step 2: Prepare and Send Tokens**

Programmatically send tokens to the project’s blockchain wallet for the credit you wish to retire.

**Step 3: Done! Retrieve Proof of Retirement**

Send the Transaction Hash to the API using the "tx" parameter:\
[api.ecotoken.earth/?tx=0x5ef73bf47311c4f92416f874f00723c48e9a2ff9e500e0245e5f15937471bda6](https://api.ecotoken.earth/?tx=0x5ef73bf47311c4f92416f874f00723c48e9a2ff9e500e0245e5f15937471bda6)

***

### **Detailed Guide**

## Step 1: Access Project & Credit Metadata

### Objective

Retrieve essential information about the Regen Credit and its associated project using the EcoToken Projects API.

1. **Access the Projects Endpoint**\
   **Endpoint URL**: `https://api.ecotoken.earth`
2. **Retrieve Metadata**\
   Make a GET request to the endpoint to obtain a list of active projects and their associated metadata.

**Sample Response:**

```json
{
  "projects": [
    {
      "ID": "4",
      "active": true,
      "batch": "BT01-001-20210309-20231212-001",
      "description": "El Globo is located in the 'Cuchilla Jardín-Támesis' Integrated Management District (DMI)...",
      "celo_wallet": "0x614bA28f42A89a56dDdA6C002bbFFf14C0fd2c27"
    }
  ]
}
```

3. **Select the Desired Project**\
   Identify the project you wish to support and ensure it is active (`"active": true`).
4. **Extract Wallet Information**\
   Obtain the wallet address from the project metadata for the desired blockchain.

***

## Step 2: Execute Token Transaction

### Objective

Transfer tokens (e.g., CELO, cUSD) to the project-specific wallet to retire the desired credit.

1. **Choose Transaction Method**
   * **Direct Transfer**: Use your blockchain wallet to send tokens directly to the project’s wallet.
   * **User Interface (Optional)**: Utilize platforms like Regen Atlas for a streamlined process.
2. **Prepare the Transaction**
   * **Recipient Address**: Use the wallet address retrieved in Step 1.
   * **Amount**: Specify the token amount corresponding to the credits you wish to retire.
3. **Confirm Transaction**\
   Review details carefully to ensure the recipient address and amount are correct.
4. **Send Payment**\
   Initiate the transfer. Transaction confirmation may take a few moments, depending on network conditions.

***

## Step 3: Obtain Proof of Retirement (Optional)

### Objective

Secure verifiable proof that the Regen Credit has been successfully retired.

1. **Retrieve Transaction Hash**\
   After transaction confirmation, obtain the unique transaction hash from your wallet.
2. **Submit to API Endpoint**\
   Send the transaction hash to the ecoToken Retirement API.\
   **Endpoint URL**: `https://api.ecotoken.earth/?tx=123`

**Sample Successful Response:**

```json
{
  "validationResult": {
    "isValid": true,
    "status": "Delivered",
    "description": "3.0000 GLOUSD",
    "creditsRetired": "0.12",
    "retirementHash": "4E6A42BBA776B708E6427A91C28D2C044952CC0A0F94269497D30550C345BEF4"
  }
}
```

**Sample Failed Response:**

```json
{
  "validationResult": {
    "isValid": false,
    "message": "Transaction not found"
  }
}
```

***

## Troubleshooting Tips

* Allow 3-5 seconds before retrieving a retirement hash.
* **`isValid` is false**: Likely due to network congestion. Poll the endpoint.
* **`retirementHash` is empty**: If the status is "pending," poll the endpoint.
* **`usdValue` < 2**: Transactions below $2 will not generate a retirement hash immediately.

***

**Blockchain Explorers**

* **ecoToken Scan**: [scan.ecotoken.earth](https://scan.ecotoken.earth)
* **Regen Mintscan Explorer**: [mintscan.io](https://mintscan.io)

For assistance or inquiries, contact our support team: `support@ecotoken.earth`.
