# Gas Saver Agent Authentication & Registration Guide

Welcome AI Agent. This document defines how automated agents, MCP servers, and programmatic clients can authenticate and interact with the **Gas Saver TRON Energy Delegation Infrastructure**.

---

## 1. Overview
- **Service Name**: Gas Saver
- **Primary Domain**: https://gassaver.in
- **API Base URL**: https://beta-api.gassaver.in
- **Protocol**: HTTP/2 & REST with JSON payloads, WebMCP in-browser tools, and MCP Server Card

---

## 2. Authentication Methods

### Method A: API Key / Bearer Token
1. **Registration**:
   - Automated registration endpoint: `POST https://beta-api.gassaver.in/api/v1/users/register`
   - Required fields:
     ```json
     {
       "email": "agent@your-domain.com",
       "password": "StrongRandomPassword123!",
       "tronAddress": "T..."
     }
     ```
2. **Obtaining Access Token**:
   - Endpoint: `POST https://beta-api.gassaver.in/api/v1/users/login`
   - Response includes a Bearer JWT in `data.token`.
3. **Using the Token**:
   - Provide the token in the `Authorization` header:
     `Authorization: Bearer <YOUR_JWT_TOKEN>`

---

## 3. Core Agent Endpoints

### 3.1 Check Pricing & Savings
- **Endpoint**: `POST /api/v1/pricing/transaction-usdt-cost`
- **Payload**: `{ "numberOfTransactions": 5 }`
- **Output**: Estimated cost in USDT and fee reduction percentage (up to 80% cheaper than burning TRX).

### 3.2 Validate TRON Address
- **Endpoint**: `POST /api/v1/validation/address`
- **Payload**: `{ "address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", "checkOnChain": true }`

### 3.3 Delegate Energy
- **Endpoint**: `POST /api/v2/energy/delegate`
- **Headers**: `Authorization: Bearer <TOKEN>`
- **Payload**:
  ```json
  {
    "receiverAddress": "T...",
    "energyAmount": 65000
  }
  ```

---

## 4. Discovery Standards Supported
- **API Catalog (RFC 9727)**: `/.well-known/api-catalog`
- **OAuth Protected Resource (RFC 9728)**: `/.well-known/oauth-protected-resource`
- **OAuth Authorization Server**: `/.well-known/oauth-authorization-server`
- **MCP Server Card (SEP-1649)**: `/.well-known/mcp/server-card.json`
- **Agent Skills Discovery (RFC v0.2.0)**: `/.well-known/agent-skills/index.json`
- **ARD Manifest**: `/.well-known/ai-catalog.json`
