Overview
The Trust Registry contract (identipay::trust_registry) maintains a shared on-chain database of verified merchants. Wallets query this registry to verify merchant legitimacy before signing payment intents.
Per the whitepaper section 6, the registry stores each merchant’s:
- Decentralized Identifier (DID)
- Human-readable name
- Sui payment address
- X25519 public key for ECDH encryption
- Hostname for URI resolution
- Active/inactive status
Source Code
Location:contracts/sources/trust_registry.move:5
Data Structures
TrustRegistry
Shared registry object holding all merchant records.Sui object identifier
Admin address authorized to register merchants
Maps DID to merchant entry
MerchantEntry
Represents a registered merchant’s verified identity.Decentralized Identifier (e.g., “did:identipay:shop.example.com:merchant123”)
Human-readable merchant name for wallet display
Merchant’s Sui address for receiving payments
X25519 public key (32 bytes) for ECDH artifact encryption
Merchant’s hostname for URI resolution
Whether the merchant is currently active
Events
MerchantRegistered
Emitted when a new merchant is registered.Merchant’s DID
Merchant’s display name
Payment address
Merchant’s hostname
MerchantDeactivated
Emitted when a merchant is deactivated.Deactivated merchant’s DID
Entry Functions
register_merchant
Register a new merchant in the trust registry. Only callable by admin. Function Signature:Mutable reference to the trust registry
Unique decentralized identifier for the merchant
Human-readable merchant name
Merchant’s Sui address for receiving payments
X25519 public key (must be exactly 32 bytes)
Merchant’s hostname
ENotAdmin(0): Caller is not the registry adminEEmptyDID(4): DID is empty stringEEmptyName(5): Name is empty stringEInvalidPublicKeyLength(3): Public key is not 32 bytesEMerchantAlreadyExists(1): DID already registered
trust_registry.move:84-116
Example:
deactivate_merchant
Deactivate a merchant (soft delete). Only callable by admin. Function Signature:Mutable reference to the trust registry
DID of merchant to deactivate
ENotAdmin(0): Caller is not the registry adminEMerchantNotFound(2): DID not found in registry
trust_registry.move:119-131
update_merchant_key
Rotate a merchant’s public key. Only callable by admin. Function Signature:Mutable reference to the trust registry
DID of merchant to update
New X25519 public key (must be exactly 32 bytes)
ENotAdmin(0): Caller is not the registry adminEInvalidPublicKeyLength(3): Public key is not 32 bytesEMerchantNotFound(2): DID not found in registry
trust_registry.move:134-146
Public Functions
lookup_merchant
Look up a merchant by DID. Aborts if not found.Reference to the trust registry
Merchant’s DID
Reference to the merchant’s entry
trust_registry.move:151-154
is_merchant_active
Check if a merchant exists and is active.Reference to the trust registry
Merchant’s DID
Returns
true if merchant exists and is activetrust_registry.move:157-163
MerchantEntry Accessors
The following functions extract fields from aMerchantEntry:
trust_registry.move:167-172
Usage Example
Security Considerations
DID Format: The DID format is not enforced on-chain. Off-chain systems should validate DID structure before registration.
Key Rotation: Merchants can rotate public keys via
update_merchant_key. Wallets should fetch fresh merchant data before each transaction to ensure they use the latest key.DID Format
identiPay uses the following DID format:did:identipay:shop.example.com:merchant123did:identipay:acme.corp:store-sf-downtowndid:identipay:coffee.local:barista-alice
Related Modules
Settlement
Uses merchant address for payment routing
Receipt
Uses merchant public key for ECDH encryption
