Skip to main content
Research Preview — The SDK is under active development.

Compute module

The ComputeModule provides geospatial operations designed to run in a trusted execution environment, so the computation can be verified independently. Each operation returns a signed result (a delegated attestation that can be submitted to EAS). Note that the TEE makes the computation verifiable, not the input locations truthful, and continuous attested operation is not yet funded — see the trust model.

Input types

All compute methods accept flexible input types:

Examples

Raw GeoJSON is not verified for authenticity. The inputRefs will contain a keccak256 hash of the geometry rather than a UID.

Compute options

All spatial methods require options:

Schema requirements

Use the correct schema type — Compute operations encode data differently than location attestations. Using the wrong schema UID causes a data/schema mismatch where the attestation is stored but cannot be decoded correctly.
See Schemas for schema definitions and default UIDs.

Numeric operations

distance()

Calculate the geodesic distance between two geometries.

area()

Calculate the area of a polygon.

length()

Calculate the length of a LineString.

Boolean operations

contains()

Check if a container geometry contains another geometry.

within()

Check if a geometry is within a specified radius of a target.

intersects()

Check if two geometries intersect.

Submission methods

submit()

Submit a delegated attestation to EAS. Accepts two input formats:

estimate()

Estimate gas for attestation submission.

health()

Check the compute service health status.

Return types

NumericComputeResult

BooleanComputeResult

DelegatedAttestation


How delegated attestations work

This pattern means:
  • Astral does not need to pay gas for every computation
  • Developers control when/whether to submit onchain
  • Smart contracts can verify attestations came from Astral

Signature expiry

Delegated attestation signatures have a deadline:

Complete example

Next: EAS integration

Learn how the SDK integrates with EAS