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.
- 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
- 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
- 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
- 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
- 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-owner: The deployer of the contract- Error codes:
u100-u107for various error conditions
art-id-nonce: Auto-incrementing counter for artwork IDsplatform-fee: Platform fee in basis points (default: 250 = 2.5%)contract-paused: Global pause state
artworks: Core artwork data and metadataartwork-ownership: Current ownership recordsprovenance-history: Complete transfer historytransfer-count: Number of transfers per artworkartist-registry: Registered artists and their statsartwork-authenticity: Verification certificatessuspended-artworks: Suspension status and reasons
Register yourself as an artist in the platform.
(contract-call? .contract register-artist)Returns: (ok true) on success
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 numbertotal-editions: Total editions availablemetadata-uri: URI to metadata (max 256 chars)
Returns: (ok artwork-id) with the new artwork ID
Transfer artwork ownership to another user.
(contract-call? .contract transfer-artwork u1 'SP2... u1000000)Parameters:
art-id: Artwork IDrecipient: New owner's principalprice: Transfer price in microSTX
Returns: (ok true) on success
Verify an artwork's authenticity with a certificate.
(contract-call? .contract verify-artwork u1 "certificate-hash")Verify an artist's legitimacy.
(contract-call? .contract verify-artist 'SP2...)Suspend an artwork with a reason.
(contract-call? .contract suspend-artwork u1 "Copyright violation")Remove suspension from an artwork.
(contract-call? .contract unsuspend-artwork u1)Update the platform fee (max 1000 basis points = 10%).
(contract-call? .contract update-platform-fee u300)Pause or unpause the entire contract.
(contract-call? .contract toggle-contract-pause)Retrieve complete artwork information.
(contract-call? .contract get-artwork u1)Get current owner of an artwork.
(contract-call? .contract get-artwork-owner u1)Get specific transfer record from history.
(contract-call? .contract get-provenance u1 u0)Get total number of transfers for an artwork.
(contract-call? .contract get-transfer-count u1)Get artist registration information.
(contract-call? .contract get-artist-info 'SP2...)Get verification certificate for an artwork.
(contract-call? .contract get-authenticity-certificate u1)Check if an artwork is suspended.
(contract-call? .contract is-artwork-suspended u1)Get current platform fee.
(contract-call? .contract get-platform-fee)Check if contract is paused.
(contract-call? .contract is-contract-paused)| 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 |
- Deploy the contract to Stacks blockchain
- The deployer becomes the
contract-owner - Artists can immediately begin registering
- Owner should verify legitimate artists and artworks
- IPFS Storage: Store actual artwork files on IPFS and reference the hash
- Metadata Standards: Use standardized metadata formats (e.g., JSON)
- Verification: Get artworks verified by contract owner for authenticity
- Transfer Records: Always include accurate prices for provenance value
- Regular Checks: Verify artwork isn't suspended before transfers
- 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
- 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