Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Digital Art Authentication Smart Contract

A comprehensive Clarity smart contract for authenticating, registering, and tracking digital artworks on the Stacks blockchain. This contract provides immutable provenance tracking, artist verification, and secure ownership management for digital art.

Features

🎨 Art Registration & Management

  • Register Artworks: Artists can register digital art with metadata including title, IPFS hash, and edition information
  • Limited Editions: Support for tracking individual editions (e.g., 1 of 10)
  • Metadata Storage: Store artwork metadata URIs and IPFS hashes for decentralized storage
  • Automatic Artist Registration: Artists are automatically registered upon their first artwork submission

🔐 Authentication & Verification

  • Artwork Verification: Contract owner can verify authentic artworks with certificate hashes
  • Artist Verification: Official verification system for legitimate artists
  • Authenticity Certificates: Each verified artwork receives a certificate hash and verification timestamp
  • Verification Status Tracking: Query verification status for any artwork or artist

📜 Provenance Tracking

  • Complete Transfer History: Immutable record of all ownership transfers
  • Price Recording: Track sale prices for each transfer
  • Transfer Counting: Automatic counting of transfers per artwork
  • Timestamp Recording: Block height timestamps for all transactions

🛡️ Security Features

  • Contract Pause: Emergency pause functionality for contract-wide suspension
  • Artwork Suspension: Ability to suspend specific artworks with documented reasons
  • Authorization Checks: Strict owner verification for all transfers
  • Self-Transfer Prevention: Users cannot transfer artworks to themselves
  • Input Validation: All user inputs are validated to prevent malicious data

⚙️ Platform Management

  • Configurable Fees: Platform fee system (capped at 10%)
  • Owner-Only Functions: Administrative functions restricted to contract owner
  • Artist Registry: Centralized registry tracking all registered artists

Contract Structure

Constants

  • contract-owner: The deployer of the contract
  • Error codes: u100-u107 for various error conditions

Data Variables

  • art-id-nonce: Auto-incrementing counter for artwork IDs
  • platform-fee: Platform fee in basis points (default: 250 = 2.5%)
  • contract-paused: Global pause state

Data Maps

  • artworks: Core artwork data and metadata
  • artwork-ownership: Current ownership records
  • provenance-history: Complete transfer history
  • transfer-count: Number of transfers per artwork
  • artist-registry: Registered artists and their stats
  • artwork-authenticity: Verification certificates
  • suspended-artworks: Suspension status and reasons

Public Functions

For Artists

register-artist

Register yourself as an artist in the platform.

(contract-call? .contract register-artist)

Returns: (ok true) on success

register-artwork

Register a new artwork with metadata.

(contract-call? .contract register-artwork 
  "Artwork Title" 
  "QmHash..." 
  u1 
  u10 
  "ipfs://metadata-uri")

Parameters:

  • title: Artwork title (max 100 chars)
  • ipfs-hash: IPFS content hash (max 64 chars)
  • edition-number: Current edition number
  • total-editions: Total editions available
  • metadata-uri: URI to metadata (max 256 chars)

Returns: (ok artwork-id) with the new artwork ID

transfer-artwork

Transfer artwork ownership to another user.

(contract-call? .contract transfer-artwork u1 'SP2... u1000000)

Parameters:

  • art-id: Artwork ID
  • recipient: New owner's principal
  • price: Transfer price in microSTX

Returns: (ok true) on success

For Contract Owner

verify-artwork

Verify an artwork's authenticity with a certificate.

(contract-call? .contract verify-artwork u1 "certificate-hash")

verify-artist

Verify an artist's legitimacy.

(contract-call? .contract verify-artist 'SP2...)

suspend-artwork

Suspend an artwork with a reason.

(contract-call? .contract suspend-artwork u1 "Copyright violation")

unsuspend-artwork

Remove suspension from an artwork.

(contract-call? .contract unsuspend-artwork u1)

update-platform-fee

Update the platform fee (max 1000 basis points = 10%).

(contract-call? .contract update-platform-fee u300)

toggle-contract-pause

Pause or unpause the entire contract.

(contract-call? .contract toggle-contract-pause)

Read-Only Functions

get-artwork

Retrieve complete artwork information.

(contract-call? .contract get-artwork u1)

get-artwork-owner

Get current owner of an artwork.

(contract-call? .contract get-artwork-owner u1)

get-provenance

Get specific transfer record from history.

(contract-call? .contract get-provenance u1 u0)

get-transfer-count

Get total number of transfers for an artwork.

(contract-call? .contract get-transfer-count u1)

get-artist-info

Get artist registration information.

(contract-call? .contract get-artist-info 'SP2...)

get-authenticity-certificate

Get verification certificate for an artwork.

(contract-call? .contract get-authenticity-certificate u1)

is-artwork-suspended

Check if an artwork is suspended.

(contract-call? .contract is-artwork-suspended u1)

get-platform-fee

Get current platform fee.

(contract-call? .contract get-platform-fee)

is-contract-paused

Check if contract is paused.

(contract-call? .contract is-contract-paused)

Error Codes

Code Error Description
u100 err-owner-only Function restricted to contract owner
u101 err-not-found Artwork or artist not found
u102 err-already-exists Artist already registered
u103 err-unauthorized User not authorized for this action
u104 err-invalid-transfer Transfer validation failed
u105 err-not-verified Artwork not verified
u106 err-suspended Contract or artwork suspended
u107 err-invalid-input Invalid input data

Deployment

  1. Deploy the contract to Stacks blockchain
  2. The deployer becomes the contract-owner
  3. Artists can immediately begin registering
  4. Owner should verify legitimate artists and artworks

Best Practices

  1. IPFS Storage: Store actual artwork files on IPFS and reference the hash
  2. Metadata Standards: Use standardized metadata formats (e.g., JSON)
  3. Verification: Get artworks verified by contract owner for authenticity
  4. Transfer Records: Always include accurate prices for provenance value
  5. Regular Checks: Verify artwork isn't suspended before transfers

Security Considerations

  • All user inputs are validated for length and content
  • Only artwork owners can transfer their pieces
  • Contract owner has emergency pause capability
  • Provenance records are immutable once created
  • No self-transfers allowed to prevent manipulation

Use Cases

  • Digital Art Marketplaces: NFT platforms for buying/selling authenticated art
  • Artist Portfolios: Verified artist collections
  • Provenance Tracking: Historical ownership and pricing data
  • Limited Editions: Managing and tracking edition releases
  • Authentication Services: Third-party verification of digital artworks

About

The Digital Art Authentication Smart Contract is a robust, production-ready Clarity smart contract designed for the Stacks blockchain that provides comprehensive authentication, registration, and provenance tracking for digital artworks.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors