What are Resolvers?
Resolvers are smart contracts that define custom validation rules for attestations. When you attach a resolver to a schema, every attestation must pass through the resolver’s validation logic before being created.Schemas and attestations are permissionless by default. Resolvers are how you add access control, fees, or custom rules when you need them.
Why Use Resolvers?
By default, anyone can attest to any schema. This permissionless model is intentional — it enables open, composable attestations. But sometimes you need control: Resolvers let you:- Control access — Only allow specific addresses to attest
- Collect fees — Require payment before attestation creation
- Distribute rewards — Incentivize attestation with token rewards
- Enforce rules — Implement custom business logic
Resolver Interface
All resolvers implement the same interface, making them pluggable and interchangeable:Hook Functions
Attestation Data
Resolvers receive complete attestation data for validation:Resolver Types
Default Resolver
The simplest resolver — validates basic rules without economic requirements.- Development and testing
- Schemas without special requirements
- Base implementation for custom resolvers
Fee Collection Resolver
Requires payment before attestation creation.- Monetizing attestation services
- Spam prevention through economic cost
- Revenue generation for attestation providers
Token Reward Resolver
Distributes token rewards for attestation creation.- Incentivizing attestation creation
- Community engagement programs
- Protocol growth mechanics
Authority Resolver
Permission-based access control with verification.- Restricted attestation environments
- Verified issuer programs
- Credentialed attestation systems
Creating a Custom Resolver
Step 1: Implement the Interface
Step 2: Build the Contract
Step 3: Deploy to Stellar
Step 4: Attach to a Schema
Binding Resolvers to Schemas
When you create a schema, you can optionally attach a resolver:Once a schema is created, its resolver cannot be changed. Choose your resolver carefully before deploying to production.
Error Handling
Resolvers use a standard error enum:Security Considerations
Best Practices
- Always require auth — Call
require_auth()on the attester - Validate all inputs — Don’t trust data from the protocol
- Handle failures gracefully — Return proper error codes
- Avoid state dependencies — Don’t rely on external state that can be manipulated
- Test edge cases — Expired attestations, revocations, etc.
Common Pitfalls
Testing Resolvers
Built-in Resolvers
The protocol provides pre-built resolvers you can use:Next Steps
Authorities
Understand the trust layer for attestation issuers
Schemas
Define attestation structures with resolver bindings
Stellar Overview
Deep dive into Stellar contract architecture
GitHub
Browse resolver source code