Development preview — The SDK is under active development.
SDK overview
The Astral SDK is the official TypeScript client for the Astral Protocol. It provides a unified interface for working with location attestations, multi-factor location proofs, and verifiable geospatial computations.
Design philosophy
Namespaced API : Clear separation between location, compute, stamps, proofs, and plugin operations
Workflow-oriented : Distinct offchain and onchain workflows for location attestations
Plugin-extensible : Register location proof plugins; collect signals, create location stamps, and compose multifactor location evidence bundles
Multidimensional verification : No single “confidence score” — applications apply their own weighting to a CredibilityVector
Type-safe : Full TypeScript support with comprehensive types
Batteries included : Handles signing, encoding, EAS integration, and plugin orchestration
Package structure
import { AstralSDK } from '@decentralized-geo/astral-sdk' ;
// Initialize with unified configuration
const astral = new AstralSDK ({
chainId: 84532 ,
signer: wallet ,
apiUrl: 'https://staging-api.astral.global' ,
apiKey: 'your-api-key'
});
// Location module — offchain workflow
astral . location . offchain . create ( input );
astral . location . offchain . sign ( unsigned );
astral . location . offchain . verify ( attestation );
astral . location . offchain . publish ( attestation );
// Location module — onchain workflow
astral . location . onchain . create ( input );
astral . location . onchain . register ( unsigned );
astral . location . onchain . verify ( attestation );
astral . location . onchain . revoke ( attestation );
// Location module — common operations
astral . location . build ( input );
astral . location . encode ( attestation );
astral . location . decode ( data );
// Compute module — spatial operations
astral . compute . distance ( from , to , options );
astral . compute . area ( geometry , options );
astral . compute . length ( geometry , options );
astral . compute . contains ( container , containee , options );
astral . compute . within ( geometry , target , radius , options );
astral . compute . intersects ( a , b , options );
// Compute module — submission
astral . compute . submit ( delegatedAttestation );
astral . compute . estimate ( delegatedAttestation );
astral . compute . health ();
// Stamps module — evidence collection
astral . stamps . collect ( options );
astral . stamps . create ( options , signals );
astral . stamps . sign ( options , stamp , signer );
astral . stamps . verify ( stamp , options );
// Proofs module — proof construction + verification
astral . proofs . create ( claim , stamps );
astral . proofs . verify ( proof , options );
// Plugins module — plugin registration + discovery
astral . plugins . register ( plugin );
astral . plugins . get ( name );
astral . plugins . list ();
Quick start
import { AstralSDK } from '@decentralized-geo/astral-sdk' ;
import { ethers } from 'ethers' ;
const provider = new ethers . JsonRpcProvider ( 'https://sepolia.base.org' );
const wallet = new ethers . Wallet ( process . env . PRIVATE_KEY , provider );
const astral = new AstralSDK ({
chainId: 84532 ,
signer: wallet ,
apiUrl: 'https://staging-api.astral.global'
});
// Create an offchain location attestation
const attestation = await astral . location . offchain . create ({
location: {
type: 'Point' ,
coordinates: [ 2.2945 , 48.8584 ]
},
memo: 'Eiffel Tower'
});
console . log ( 'Attestation UID:' , attestation . uid );
// Compute distance between two locations
const distance = await astral . compute . distance (
attestation . uid ,
landmarkUID ,
{ schema: SCHEMA_UID }
);
console . log ( 'Distance:' , distance . result , distance . units );
Configuration
interface AstralConfig {
// Required
chainId : number ; // Target chain ID (e.g., 84532 for Base Sepolia)
// Recommended
signer ?: Signer ; // For signing attestations and transactions
provider ?: Provider ; // For read-only blockchain operations
apiUrl ?: string ; // Defaults to 'https://staging-api.astral.global'
apiKey ?: string ; // Required for TEE verification and hosted endpoints
// Advanced
debug ?: boolean ; // Enable debug logging
schemas ?: RuntimeSchemaConfig []; // Pre-register custom schemas
defaultSchema ?: RuntimeSchemaConfig ; // Override default schema
strictSchemaValidation ?: boolean ; // Throw on schema validation errors
}
Chain Chain ID Base Sepolia 84532 Base Mainnet 8453 Ethereum Sepolia 11155111 Ethereum Mainnet 1 Celo 42220 Arbitrum 42161 Optimism 10
Module architecture
AstralSDK
├── location: LocationModule (offchain + onchain attestation workflows)
│ ├── offchain: OffchainWorkflow
│ │ ├── create() — build + sign in one step
│ │ ├── sign() — sign unsigned attestation
│ │ ├── verify() — verify signature
│ │ └── publish() — store to IPFS/storage
│ ├── onchain: OnchainWorkflow
│ │ ├── create() — build + register in one step
│ │ ├── register() — register unsigned attestation
│ │ ├── verify() — verify onchain attestation
│ │ └── revoke() — revoke attestation
│ ├── build() — build unsigned attestation
│ ├── encode() — encode for EAS
│ └── decode() — decode from EAS
├── compute: ComputeModule (verifiable geospatial operations)
│ ├── distance() — distance between geometries
│ ├── area() — area of polygon
│ ├── length() — length of line
│ ├── contains() — containment check
│ ├── within() — proximity check
│ ├── intersects() — intersection check
│ ├── submit() — submit delegated attestation
│ ├── estimate() — estimate gas
│ └── health() — service health check
├── stamps: StampsModule (evidence collection orchestration)
│ ├── collect() — collect raw signals from plugins
│ ├── create() — process signals into unsigned stamp
│ ├── sign() — sign a stamp
│ └── verify() — verify stamp validity
├── proofs: ProofsModule (proof construction + verification)
│ ├── create() — bundle claim + stamps into proof
│ └── verify() — verify proof (local or TEE mode)
└── plugins: PluginRegistry (plugin registration + discovery)
├── register() — register a plugin
├── get() — get plugin by name
├── has() — check if plugin exists
├── list() — list plugin metadata
├── all() — get all plugins
└── withMethod() — find plugins with a specific method
Key concepts
Namespaced modules Clear separation: location.offchain.*, location.onchain.*, compute.*, stamps.*, proofs.*, and plugins.*
Flexible inputs Accept UIDs, raw GeoJSON, or attestation objects interchangeably.
Delegated attestations SDK handles the delegated attestation pattern — you pay gas, Astral is attester.
Plugin extensibility Register proof-of-location plugins for multifactor evidence collection and verification.
Pages