Build a Location-Gated Smart Contract
Create a smart contract that triggers actions when a geospatial policy check passes — “is the user within 500m of the Eiffel Tower?”About location verification: This guide uses location data as input, but doesn’t verify where that data came from. GPS is spoofable. We’re working on the first Location Proof plugins to provide evidence-backed location claims — these are still in development and will integrate with the flow shown here.
What You’ll Learn
1
Register a reference location
Create a location attestation for the Eiffel Tower
2
Check the geospatial policy
Use Astral to verify proximity
3
Gate the smart contract
Use EAS resolvers to trigger onchain actions based on the policy result
Prerequisites
- A wallet with testnet ETH (Base Sepolia)
- Basic TypeScript and Solidity knowledge
Step 1: Initialize the SDK
Step 2: Register the Eiffel Tower
Create a location attestation for the Eiffel Tower that can be referenced by UID.Location attestations follow the Location Protocol v0.2 schema (verification in progress — see Location Records).
Anyone can now reference the Eiffel Tower by UID instead of hardcoding coordinates.
Step 3: Check the Geospatial Policy
Prerequisite: Before running this step, you need to deploy your resolver contract and register your schema with EAS. See the Prerequisite section below — the
RESOLVER_SCHEMA_UID from that step is required here.The service runs inside EigenCompute’s TEE, providing verifiable execution. The signed attestation proves the computation was performed correctly.
Step 4: The Smart Contract (EAS Resolver)
So far, we’ve performed a geospatial policy check in a verifiable computing environment. How do we connect this to smart contracts? EAS Resolvers are smart contracts that receive callbacks when attestations are submitted to the EAS contract. When you submit a Policy Attestation to EAS with a schema that has a resolver attached, EAS automatically calls your resolver’sonAttest function with the attestation data. This is where you implement your business logic.
Here’s an example resolver that gates an action based on the policy result:
Prerequisite: Deploy Resolver and Register Schema
The Complete Flow
Alternative: Offchain Location Attestations
If you don’t need onchain location records, use offchain attestations to save gas:Next Steps
Core Concepts
Understand the building blocks
Use Cases
Explore what you can build
SDK Reference
Full SDK documentation
API Reference
Dive into the API details