TiP Stacks is a decentralized tipping platform built on the Stacks blockchain built with AI. It enables users to send and receive tips seamlessly, with advanced features like user statistics, rewards, identity verification, and platform fee handling. Designed for efficiency and transparency, this smart contract promotes decentralized financial interaction.
https://explorer.hiro.so/txid/0x3cd2275570b99fc8df9168c917ae65c05f44494ef05f8c8ab438e150923badf8?chain=testnet ST3P8GST1CH1QTD2W8VQ9BT60EPBQFWDN9DRGBR64.STX-TIPPPS
- Decentralized Tipping: Enables users to tip others directly on the Stacks blockchain.
- Platform Fees: A percentage fee is deducted from each tip for platform sustainability.
- Reward System: Users earn reward points for tipping amounts exceeding a threshold.
- User Statistics:
- Total tips sent and received.
- Accumulated reward points.
- Identity Management: Links user addresses to usernames and verification status.
- Transaction History: Maintains a detailed log of tipping activities.
- Error Handling: Comprehensive error codes to handle edge cases and ensure contract integrity.
Firstly, you have to connect wallet, then you would join community and then you can view your dashboard


CONTRACT_OWNER
: The owner's principal address.PLATFORM_FEE_PERCENTAGE
: Fee percentage (default: 5%).MAX_TIP_AMOUNT
: Maximum allowable tip amount (default: 1,000 STX).REWARD_THRESHOLD
: Minimum tip amount to qualify for rewards (default: 1 STX).REWARD_RATE
: Points earned per qualifying tip (default: 10 points).
user-tip-stats
: Tracks individual user statistics.{ total-tips-sent: uint, total-tips-received: uint, reward-points: uint }
tip-history
: Logs transactions.{ sender: principal, recipient: principal, timestamp: uint, amount: uint, fee: uint, token-type: string }
user-identity
: Stores user profiles.{ username: string, verified: bool }
-
tip
:- Transfers a tip to a recipient, deducting a platform fee.
- Updates user stats and logs the transaction.
- Example:
(tip 'SP123456789' u1000 "STX")
-
set-user-identity
:- Registers or updates a user's username.
- Example:
(set-user-identity "Alice")
-
update-user-reward-points
:- Updates reward points for a user manually.
- Example:
(update-user-reward-points 'SP123456789' u20)
-
Read-Only Functions:
get-user-tip-stats
: Retrieve a user's tipping statistics.get-user-identity
: Fetch a user's identity information.get-transaction-logs
: Access logs of a specific transaction.

process-tip-transfer
: Handles the actual fund transfer and fee deduction.calculate-platform-fee
: Computes the platform fee from the tip amount.update-sender-stats
&update-recipient-stats
: Updates user statistics after a successful tip.update-reward-points
: Grants reward points to eligible users.
-
Environment Setup: Ensure you have:
- Clarity development tools installed.
- A connected Stacks wallet.
-
Deploy: Deploy the contract using the Stacks CLI or your preferred IDE:
stacks deploy ./tip-stacks-enhanced.clar
-
Configuration:
- Update the constants to match your platform's settings.
- Ensure the
CONTRACT_OWNER
address is correct.
-
For Users:
- Use the
tip
function to send tips. - Query
get-user-tip-stats
for your statistics. - Link your identity using
set-user-identity
.
- Use the
-
For Platform Owners:
- Monitor platform fees and reward points.
- Handle user verification through
user-identity
.
ERR_INSUFFICIENT_FUNDS
(u1): Tip amount exceeds sender's balance.ERR_INVALID_AMOUNT
(u2): Tip amount is invalid (e.g., zero or exceeds maximum).ERR_TRANSFER_FAILED
(u3): Fund transfer failed due to network or balance issues.ERR_REWARD_UPDATE_FAILED
(u4): Reward points update failed.

- Multi-token Support: Extend tipping functionality to include other tokens.
- Advanced Identity Verification: Integrate with decentralized identity solutions.
- Dynamic Reward Rates: Implement tiered reward mechanisms based on user activity.