Skip to main content

Smart Contracts

Sphyre’s on-chain layer lives in fortro-contract-dev/hardhat/contracts and is consumed by Fortro Engine through ABI files copied into fortro-engine/src/blockchain/abis.

Network

Target: Base Sepolia
Chain ID: 84532
Client: ethers via Fortro Engine

Backend Contract Client

fortro-engine/src/blockchain/client.rs binds to SSIRegistry.json and calls the aggregate registry contract.

Contract Inventory

Roles

SphyreAccessControl defines these role constants:
Credential and schema write operations require issuer authority. Admins manage issuer, holder, verifier, and relayer role assignments.

Registry Operations

Fortro Engine Routes

The active blockchain API is implemented in fortro-engine/src/api/blockchain_new.rs:
/api/blockchain-legacy remains mounted for older flows and meta-transaction helper endpoints.

Configuration

Fortro Engine reads blockchain configuration from environment variables:
BLOCKCHAIN_CHAIN_ID must match the connected RPC chain. The code validates the chain ID before constructing the contract client.

Data Anchoring Model

  • Credential issuance anchors credential_hash against the subject DID.
  • Credential revocation checks and revokes the same DID/hash pair.
  • Schema creation anchors schema IDs to schema hash/URI values.
  • Consent grants and revocations are keyed by holder DID, verifier DID, and purpose.
  • Verification flows use on-chain credential registration and revocation checks as one layer of validation.

Operational Notes

  • Backend database state remains the source for rich credential metadata; contracts anchor integrity, status, role, and consent facts.
  • Smart-contract calls can fail independently from MongoDB/IPFS writes. Backend handlers log blockchain failure and may continue for selected issuance and revocation flows.
  • ABI files must be regenerated and copied into fortro-engine/src/blockchain/abis whenever Solidity function signatures change.