Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stamp ownership issue #674

Open
babalicious-io opened this issue Jan 25, 2025 · 3 comments
Open

Stamp ownership issue #674

babalicious-io opened this issue Jan 25, 2025 · 3 comments

Comments

@babalicious-io
Copy link
Collaborator

babalicious-io commented Jan 25, 2025

Clarify and Implement Stamp Ownership vs Issuer Address Distinction

Overview

Currently, our codebase doesn't properly distinguish between different types of stamp-related addresses:

  1. Issuer Address (1A)

    • The mint/stamp service address that technically issues/mints the stamp
    • Currently stored in creator field in our database
    • Example: "1GPfBjHemZayEHkPFuMTQsPUPDSdv86oHf"
  2. Ownership Address (1B)

    • The artist/creator address that owns the stamp (copyright holder)
    • Currently not properly tracked in our system
    • Example: "183kq...1CCBV"
    • Can transfer ownership to another address (ownership transfer)
  3. Edition Owners

    • Addresses that own editions/copies of the stamp
    • Currently tracked via transfers/balances
    • Can transfer editions to other addresses
    • Can create dispensers to sell editions

Current Issues

Code Locations Using Incorrect Address Types

  1. islands/stamp/details/StampInfo.tsx:
const creatorDisplay = stamp.creator_name
? stamp.creator_name
: abbreviateAddress(stamp.creator, 8);
// Using issuer address (1A) instead of ownership address (1B)
  1. islands/Wallet/details/WalletDispenserDetails.tsx (plus another two similar wallet details files in the works):
function StampStats({
dispensers,
walletData,
}) {
// ... creator display using issuer address instead of ownership address
const creatorDisplay = (
<span>
<span className="hidden mobileMd:block mobileLg:hidden desktop:block">
{stampData.creator_name || stampData.creator} // Using issuer address (1A)
</span>
</span>
);
}
  1. server/db/tables/stamp.ts:
// Current schema missing ownership tracking

Proposed Solution

1. New Types

interface StampOwnership {
stampId: string;
issuerAddress: string; // 1A - Mint service address
ownerAddress: string; // 1B - Current copyright owner
ownershipTransferHistory: {
fromAddress: string;
toAddress: string;
timestamp: Date;
txHash: string;
}[];
}
interface OwnershipTransfer {
stampId: string;
currentOwnerAddress: string; // Current copyright holder
newOwnerAddress: string; // New copyright holder
txHash: string;
}
// Update existing StampRow interface
interface StampRow {
// ... existing fields ...
issuerAddress: string; // 1A - Mint service address (rename from creator)
ownerAddress: string; // 1B - Current copyright owner (new field)
}

2. Database Changes

sql
-- Rename creator column to issuer_address for clarity
ALTER TABLE stamps RENAME COLUMN creator TO issuer_address;
-- Add owner_address column
ALTER TABLE stamps ADD COLUMN owner_address TEXT NOT NULL;
-- Create ownership transfer history table
CREATE TABLE stamp_ownership_transfers (
id SERIAL PRIMARY KEY,
stamp_id TEXT NOT NULL,
from_address TEXT NOT NULL,
to_address TEXT NOT NULL,
tx_hash TEXT NOT NULL,
timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (stamp_id) REFERENCES stamps(stamp_id)
);
-- Add indexes
CREATE INDEX idx_stamps_owner_address ON stamps(owner_address);
CREATE INDEX idx_ownership_transfers_stamp_id ON stamp_ownership_transfers(stamp_id);

3. New API Endpoints

// GET /api/v2/stamp/[id]/ownership
interface StampOwnershipResponse {
stampId: string;
issuerAddress: string;
ownerAddress: string;
transferHistory: {
fromAddress: string;
toAddress: string;
timestamp: string;
txHash: string;
}[];
}
// POST /api/v2/stamp/[id]/transfer-ownership
interface TransferOwnershipRequest {
newOwnerAddress: string;
signature: string; // Signed message proving ownership
}
interface TransferOwnershipResponse {
success: boolean;
txHash: string;
}

Implementation Tasks

  1. Database:

    • Update stamps table schema
    • Add ownership transfer history table
    • Migrate existing data (set initial owner_address = issuer_address)
    • Add necessary indexes
  2. API Layer:

    • Add ownership endpoints
    • Update stamp details endpoint
    • Add ownership transfer validation
    • Add signature verification
  3. UI Updates:

    • Update StampInfo to show both issuer and owner
    • Add ownership transfer UI for stamp owners
    • Update WalletDispenserDetails
    • Add ownership history view
  4. Documentation:

    • Update API docs
    • Add ownership transfer documentation
    • Update UI component docs

Migration Plan

  1. Database updates:

    • Add new columns as nullable
    • Backfill data
    • Make columns required
    • Add new tables
    • Add indexes
  2. API updates:

    • Add new endpoints behind feature flag
    • Update existing endpoints to include new data
    • Test thoroughly
    • Enable feature flag
  3. UI updates:

    • Add new components behind feature flag
    • Update existing components
    • Test thoroughly
    • Enable feature flag

Questions

  • How to handle initial ownership assignment for existing stamps?
  • What signature verification method should we use?
  • Should we implement a dispute resolution process?
  • Should we add ownership transfer fees?

Related Issues

  • #XXX UI Components for Stamp Details
  • #XXX API Endpoints Documentation
  • #XXX Database Schema Updates

/label enhancement
/label breaking-change
/priority high

@babalicious-io
Copy link
Collaborator Author

A6951416103960996784

Image
Image

issuer - 1GPfBjHemZayEHkPFuMTQsPUPDSdv86oHf - red
ownership - 183kqceNg8nYFLuxQEHN9oj2XqY8F1CCBV - yellow - missing in stampchain

Image
I believe it's stampchains addy aka the issuer not the creator with ownership rights

@babalicious-io
Copy link
Collaborator Author

All the code suggestions are complimentary of Claude - so please review and improve !

@reinamora137
Copy link
Contributor

reinamora137 commented Jan 27, 2025

Will investigate yes the owner field should be the artist/creator by design🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants