Skip to content

Phase 4: Transaction Types - IPFS Writes (SDK + Node) #595

@tcsenpai

Description

@tcsenpai

Implement on-chain transaction types for IPFS write operations.

⚠️ SDK DEPENDENCY: Transaction types must be defined in ../sdks FIRST.
After SDK changes, user must manually publish new SDK version and update node package.json.

Tasks (SDK - ../sdks)

  1. Define IPFS transaction type constants in SDK
  2. Create transaction payload interfaces
  3. Add transaction builder functions
  4. Publish new SDK version (USER ACTION)
  5. Update SDK in node package.json (USER ACTION)

Tasks (Node)

  1. Implement IPFS_ADD transaction handler
  2. Implement IPFS_PIN transaction handler
  3. Implement IPFS_UNPIN transaction handler
  4. Add transaction validation logic
  5. Update account state on successful transactions
  6. Emit events for indexing

Design

Transaction Types

enum IPFSTransactionType {
  IPFS_ADD = 'IPFS_ADD',      // Upload + auto-pin
  IPFS_PIN = 'IPFS_PIN',      // Pin existing CID
  IPFS_UNPIN = 'IPFS_UNPIN',  // Remove pin
}

Transaction Payloads

interface IPFSAddPayload {
  content: string;  // base64 encoded
  filename?: string;
  metadata?: Record<string, unknown>;
}

interface IPFSPinPayload {
  cid: string;
  duration?: number;  // blocks or time
}

interface IPFSUnpinPayload {
  cid: string;
}

Handler Flow

  1. Validate transaction
  2. Calculate cost (tokenomics)
  3. Deduct from sender balance
  4. Execute IPFS operation
  5. Update account state
  6. Emit event

Notes

BLOCKING: User must publish SDK and update node before node-side implementation can begin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions