# Blockchain APIs

## Certificate Verification

### Verify by Token ID

```http
GET /blockchain/verify/{tokenId}
```

**Response**
```json
{
  "valid": true,
  "token": {
    "id": "0x1234567890abcdef",
    "licenseNumber": "GOA/TRADE/2026/00001",
    "holder": "ABC Enterprises",
    "issuedAt": "2026-02-09T10:00:00Z",
    "validUntil": "2027-02-08T23:59:59Z",
    "status": "ACTIVE"
  },
  "blockchain": {
    "contractAddress": "0xContract...",
    "transactionHash": "0xTx...",
    "blockNumber": 12345,
    "timestamp": "2026-02-09T10:00:00Z"
  }
}
```

### Verify by License Number

```http
GET /blockchain/verify?licenseNumber=GOA/TRADE/2026/00001
```

## Transaction History

### Get Token History

```http
GET /blockchain/tokens/{tokenId}/history
```

**Response**
```json
{
  "tokenId": "0x1234...",
  "events": [
    {
      "event": "MINTED",
      "timestamp": "2026-02-09T10:00:00Z",
      "transactionHash": "0xMint...",
      "data": { "to": "0xHolder..." }
    },
    {
      "event": "RENEWED",
      "timestamp": "2027-02-01T10:00:00Z",
      "transactionHash": "0xRenew...",
      "data": { "newExpiry": "2028-02-08" }
    }
  ]
}
```

## Smart Contract ABI

```solidity
interface ILicenseNFT {
    function mint(address to, string licenseNumber, bytes32 documentHash) returns (uint256);
    function verify(uint256 tokenId) returns (bool valid, LicenseData data);
    function revoke(uint256 tokenId, string reason);
    function renew(uint256 tokenId, uint256 newExpiry);
}
```

## Block Explorer

View transactions on the block explorer:
```
https://explorer.license.gov.in/tx/{transactionHash}
```
