Skip to main content
Research Preview — This API is under development.

Area

Calculate the area of a polygon in square meters.
POST /compute/v0/area

Request body

chainId
number
required
Target chain ID (e.g., 84532 for Base Sepolia).
geometry
Input
required
The polygon geometry to measure. See Input types for accepted formats.
schema
string
EAS schema UID. The server uses a default schema if not provided.
recipient
string
Ethereum address to receive the attestation. Defaults to the zero address.

Example request

curl -X POST https://api.astral.global/compute/v0/area \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-api-key" \
  -d '{
    "chainId": 84532,
    "geometry": "0xpolygon...",
    "recipient": "0xdef456..."
  }'

Response

Returns a NumericComputeResponse.
result
number
required
Area in square meters (e.g., 5432.10).
units
string
required
Always "square_meters".
operation
string
required
Always "area".
timestamp
number
required
Unix timestamp of computation.
inputRefs
string[]
required
Array of input references.
attestation
AttestationData
required
Signed EAS attestation. See AttestationData.
delegatedAttestation
DelegatedAttestationData
required
Signature for delegated onchain submission. See DelegatedAttestationData.

Example response

{
  "result": 5432.10,
  "units": "square_meters",
  "operation": "area",
  "timestamp": 1706400000,
  "inputRefs": [
    "0xpolygon..."
  ],
  "attestation": {
    "schema": "0x...",
    "attester": "0x590fdb53ed3f0B52694876d42367192a5336700F",
    "recipient": "0xdef456...",
    "data": "0x...",
    "revocable": true,
    "refUID": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "signature": "0x..."
  },
  "delegatedAttestation": {
    "signature": "0x...",
    "attester": "0x590fdb53ed3f0B52694876d42367192a5336700F",
    "deadline": 1706403600,
    "nonce": 0
  }
}

Notes

  • Uses PostGIS ST_Area with geodetic calculation
  • Result is in square meters with square centimeter precision
  • The onchain attested value is scaled to square centimeters (integer) for EVM compatibility
  • Only valid for polygon geometries

SDK Method

See astral.compute.area()