A decentralized tipping platform built on the Stacks blockchain that enables supporters to send tips directly to content creators with transparent fee structures and secure fund management.
The Creator Tip Jar contract provides a trustless infrastructure for tipping creators. Creators register their profiles, receive tips from supporters, and withdraw their earnings at any time. The platform charges a small fee (default 2.5%) to sustain operations.
- Profile Management: Register with a username and bio, update profile information
- Status Control: Toggle active/inactive status to control tip acceptance
- Balance Tracking: Real-time balance tracking with complete transaction history
- Flexible Withdrawals: Withdraw specific amounts or entire balance
- Statistics: Track total tips received and number of supporters
- Easy Tipping: Send tips with optional personalized messages (up to 280 characters)
- Transparent Fees: Platform fee automatically calculated and displayed
- Tip History: All tips are recorded on-chain with timestamps
- Minimum Threshold: Minimum tip of 0.00001 STX ensures meaningful transactions
- Fee Management: Adjust platform fee (0-10% maximum)
- Revenue Collection: Withdraw accumulated platform fees
- Platform Analytics: View total tips processed and platform statistics
(register-creator (username (string-ascii 50)) (bio (string-utf8 200)))Register as a creator with username and bio.
(update-profile (bio (string-utf8 200)))Update creator bio information.
(toggle-active-status)Enable or disable tip acceptance.
(withdraw (amount uint))Withdraw specified amount from creator balance.
(withdraw-all)Withdraw entire creator balance.
(send-tip (creator principal) (amount uint) (message (optional (string-utf8 280))))Send a tip to a creator with optional message.
(set-platform-fee (new-fee-bps uint))Update platform fee (admin only). Fee in basis points (250 = 2.5%).
(withdraw-platform-fees (amount uint))Withdraw platform fees (admin only).
(get-creator-info (creator principal))Retrieve creator profile and statistics.
(get-creator-balance (creator principal))Get current balance for a creator.
(get-tip (tip-id uint))Retrieve details of a specific tip transaction.
(calculate-fee (amount uint))Calculate platform fee for a given tip amount.
(calculate-net-amount (amount uint))Calculate net amount creator receives after fees.
(is-creator (address principal))Check if an address is a registered creator.
(get-platform-fee)Get current platform fee percentage.
(get-platform-balance)Get accumulated platform fees.
(get-total-tips-processed)Get total value of all tips processed.
| Code | Constant | Description |
|---|---|---|
| u100 | err-owner-only | Only contract owner can perform this action |
| u101 | err-not-creator | Address is not a registered creator |
| u102 | err-invalid-amount | Invalid tip amount (too low or zero) |
| u103 | err-creator-exists | Creator already registered |
| u104 | err-creator-not-found | Creator does not exist |
| u105 | err-insufficient-balance | Insufficient balance for withdrawal |
| u106 | err-withdrawal-failed | Withdrawal transaction failed |
| u107 | err-invalid-fee | Invalid fee percentage (exceeds 10%) |
| u108 | err-creator-inactive | Creator has disabled tip acceptance |
(contract-call? .creator-tip-jar register-creator "alice-creates" u"Digital artist creating NFT collections")(contract-call? .creator-tip-jar send-tip 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM u1000000 (some u"Love your work!"))(contract-call? .creator-tip-jar withdraw u5000000)- Default Platform Fee: 2.5% (250 basis points)
- Maximum Platform Fee: 10% (1000 basis points)
- Minimum Tip Amount: 0.00001 STX (10,000 micro-STX)
The platform fee is deducted from each tip and accumulated in the platform balance for operational costs.
- All STX transfers are handled through secure contract mechanisms
- Balance checks prevent overspending
- Input validation on all user-provided data
- Creator verification before operations
- Admin functions restricted to contract owner
- Safe arithmetic operations prevent overflows
The contract maintains:
- Creator profiles: Username, bio, statistics, and status
- Balance ledger: Individual creator balances
- Tip records: Complete history with sender, recipient, amount, message, and timestamp
- Platform metrics: Total tips processed and accumulated fees
Deploy the contract to Stacks blockchain using Clarinet or Stacks CLI. The deployer becomes the contract owner with admin privileges.