Schemas
Define a claim once. Read it everywhere.
A schema names the fields of a claim, an optional resolver that adds rules, and whether attestations under it can be revoked. Its UID is derived from those inputs, so every app agrees on it.
Deterministic UIDs
The same definition, resolver and revocability always give the same UID, computed off chain byte for byte like the contract.
Borsh-encoded data
bool, u8 to u128, i8 to i128, string, account_id, bytes, bytes32 and lists. Compact on chain, decodable in Rust and TypeScript.
Resolvers that add rules
Whitelist, fee, token gate, token reward, or a pipeline of them. The resolver accepts the schema first, and you administer its settings.
Large definitions on chain
Definitions up to 256 KB are stored once as a content-addressed blob with NEP-145 storage, then registered by hash.
All or nothing
Registration is a promise chain: resolver check, then sync to the attestations contract. If either refuses, the schema is removed and its storage refunded.
// The UID is known before you register
import { computeSchemaUid, SchemaEncoder } from '@attestra/sdk';
const definition = 'string name, u8 level, bool verified, string[] skills';
computeSchemaUid(definition, null, true);
// "3f0c...": sha256(borsh(("attestra:schema:v1", definition, None, true)))
// Data is Borsh: any Rust contract can decode it
const data = new SchemaEncoder(definition).encode({
name: 'Bob', level: 3, verified: true, skills: ['rust', 'near'],
});Well-known schemas
Every deployment registers these.
Agent identity
string name, account_id owner, string model, string[] capabilities, string endpoint, string description
Agent review
u8 score, string comment, string job_ref
Private AI check
string rule_id, string claim, bool result, bytes32 evidence_hash, string model, bytes32 request_id, u64 checked_at
Cross-chain event
string chain, bytes32 tx_id, u64 block_number, bytes emitter, bytes32[] topics, bytes data, u64 log_index
Wallet link
string chain, string address, string caip10
Membership
string organization, string role, u64 since