Skip to content

Premium Publishing (SDK/Contracts)

This guide describes the current premium flow using SDK/contract integrations.

sage personal is not a stable CLI surface today. Treat any older sage personal ... examples as historical/roadmap syntax.

What This Guide Covers

  • Publishing encrypted content for personal creator flows
  • Setting prices and enabling purchases
  • Verifying license ownership for decrypt access

Scope Rule

Premium encrypted listings are personal/creator-scoped.

For rationale, see Personal-Only Premium Policy.

Prerequisites

  • Wallet connected on target network
  • Access to contract addresses for:
  • PersonalMarketplace
  • PersonalLicenseReceipt
  • Encryption client setup (Lit + local AES workflow)
  • IPFS upload capability for encrypted payload and manifest

Flow Overview

  1. Prepare plaintext prompt content locally.
  2. Encrypt plaintext with local symmetric key.
  3. Store encrypted payload on IPFS.
  4. Build premium manifest including encrypted CID + Lit access conditions.
  5. Register listing/price on PersonalMarketplace.
  6. Buyer purchases listing and receives PersonalLicenseReceipt token.
  7. Buyer decrypts by proving receipt ownership through Lit access conditions.

Step 1: Encrypt Content Locally

Use AES-256-GCM (or equivalent authenticated encryption) before upload.

Keep plaintext out of shared storage and logs.

Step 2: Upload Encrypted Payload and Manifest

Upload encrypted payload JSON and manifest JSON to IPFS.

Manifest should include:

  • listing key
  • creator address
  • encrypted content CID
  • receipt ID fields
  • Lit condition payloads needed for key release

Step 3: Register Listing

Use SDK/contract calls to set listing price and metadata pointers on PersonalMarketplace.

At this stage, content remains encrypted and non-readable without license ownership.

Step 4: Purchase Flow

Buyer performs marketplace purchase transaction.

Expected outcomes:

  • payment transfer according to protocol economics
  • receipt mint on PersonalLicenseReceipt
  • indexed purchase/listing events for discovery surfaces

Step 5: Access and Decryption

Access client checks:

  • balanceOf(buyer, receiptId) > 0 on PersonalLicenseReceipt

If true, Lit condition can release decryption key material and the client decrypts locally.

Integration Checklist

  • Verify address book values from deployment source files before publish
  • Validate manifest structure before registration
  • Confirm receipt ID encoding/format used by your Lit condition payload
  • Verify post-purchase ownership with direct contract read before attempting decrypt

Operational Notes

  • Treat subgraph/worker discovery as eventually consistent after purchase/listing transactions.
  • Keep encrypted payload and manifest immutable by CID; publish new CIDs for updates.
  • Use conservative error handling around key retrieval/decrypt because network/index lag can mimic auth failures.