Overview
The Warranty contract (identipay::warranty) implements on-chain warranties as NFTs that are minted atomically with receipts during settlement.
Warranties are:
- Linked to receipts: Each warranty references its associated receipt
- Encrypted: Warranty terms are AES-256-GCM ciphertext
- Expirable: Plaintext expiry timestamp for on-chain enforcement
- Optionally transferable: Can be marked transferable for resale scenarios
Source Code
Location:contracts/sources/warranty.move:6
Data Structures
WarrantyObject
On-chain warranty NFT minted during atomic settlement.Sui object identifier (unique warranty ID)
Reference to the associated receipt object
Merchant who issued the warranty
Intent hash binding this warranty to a specific transaction
AES-256-GCM ciphertext of warranty terms (duration, exclusions, service endpoints)
12-byte GCM nonce for terms decryption
Ephemeral public key E = e*G (same as receipt, for ECDH decryption)
Warranty expiry timestamp in epoch milliseconds (plaintext for on-chain enforcement)
Whether this warranty can be transferred (e.g., on resale)
Events
WarrantyMinted
Emitted when a warranty is minted.Unique object ID of the warranty
Associated receipt ID
Merchant who issued the warranty
Intent hash
Warranty expiration timestamp
Whether warranty is transferable
WarrantyTransferred
Emitted when a warranty is transferred.Warranty object ID
Previous owner
New owner
Public Functions
mint_warranty
Mint a new warranty. Called by the settlement module during atomic execution. Function Signature:Object ID of the associated receipt
Merchant’s Sui address
Intent hash
AES-256-GCM ciphertext of warranty terms
12-byte GCM nonce (must be exactly 12 bytes)
Ephemeral X25519 public key (must be exactly 32 bytes)
Warranty expiration timestamp (epoch ms, must be > 0)
Whether the warranty can be transferred
The minted warranty object
EInvalidNonceLength(2): Nonce is not 12 bytesEInvalidEphemeralPubkey(3): Ephemeral pubkey is not 32 bytesEEmptyTerms(4): Encrypted terms are emptyEInvalidExpiry(5): Expiry is 0
public(package) — only callable by the settlement module.
Location: warranty.move:65-103
transfer_warranty
Transfer a warranty to a new address. Only allowed if the warranty is marked as transferable and has not expired. Function Signature:Warranty object to transfer (consumed by this function)
New owner’s address
EWarrantyNotTransferable(0): Warranty hastransferable = falseEWarrantyExpired(1): Current time exceeds warranty expiry
warranty.move:107-122
Example:
Accessors
receipt_id
merchant
expiry
is_transferable
is_expired
warranty.move:149-155
Warranty Terms Format
The encrypted terms are a JSON object:Usage Example
Transferability Scenarios
Non-Transferable Warranties (Soulbound)
For services or items that shouldn’t be resold:- Software licenses (personal, non-transferable)
- Service warranties tied to original purchaser
- Medical products with liability concerns
Transferable Warranties
For physical goods that may be resold:- Electronics (phones, laptops)
- Appliances (refrigerators, washing machines)
- Vehicles
- Collectibles with authenticity guarantees
Warranty Claims
Warranty claims happen off-chain using the decrypted terms:Merchant Verifies
Merchant verifies:
- Warranty has not expired (check
expiryon-chain) - Receipt is authentic (check
receipt_idmatches on-chain) - Claim falls under coverage (check decrypted terms)
Privacy Guarantees
Terms Privacy
Terms Privacy
Warranty terms (coverage, exclusions, process) are encrypted on-chain. Only buyer and merchant can decrypt.
Expiry Transparency
Expiry Transparency
Expiry is plaintext for on-chain enforcement. This prevents expired warranties from being transferred.
Transferability Transparency
Transferability Transparency
Transferability flag is plaintext so buyers know if they can resell the item with warranty.
Buyer Anonymity
Buyer Anonymity
Warranty is owned by a stealth address. On-chain observers cannot link it to buyer identity.
Security Considerations
Receipt Linkage: Each warranty references its receipt via
receipt_id. This enables verification that the warranty is authentic and corresponds to a real purchase.Merchant Decryption: Merchants can decrypt all warranties they issued (for claim processing). This is necessary for warranty fulfillment.
Related Modules
Settlement
Mints warranties during atomic settlement
Receipt
Associated receipt linked via receipt_id
Trust Registry
Provides merchant public key for encryption
