FlexLease - A decentralized peer-to-peer equipment and vehicle rental protocol built on the Stacks blockchain.
FlexLease aims to democratize access to expensive equipment and vehicles by enabling fractional ownership, transparent rental agreements, and trustless peer-to-peer transactions. By leveraging blockchain technology, we eliminate intermediaries, reduce costs, and create new revenue opportunities for asset owners.
- High capital requirements prevent individuals and small businesses from accessing expensive equipment
- Traditional rental platforms charge high intermediary fees (20-40%)
- Lack of transparency in ownership verification and maintenance history
- Limited liquidity for equipment owners who want to monetize idle assets
- Trust issues in peer-to-peer rentals without proper escrow mechanisms
- Difficulty in establishing fractional ownership of high-value assets
FlexLease provides a decentralized protocol that:
- Tokenizes physical assets into verifiable on-chain representations
- Enables fractional ownership through token splits
- Facilitates trustless rentals via smart contract escrow
- Distributes rental revenue automatically to token holders
- Builds transparent reputation systems for both owners and renters
- Integrates decentralized insurance mechanisms
- Create a seamless asset tokenization process for equipment owners
- Build a secure P2P rental marketplace with automated escrow
- Enable fractional ownership to lower entry barriers
- Implement fair revenue distribution based on ownership stakes
- Establish reputation and insurance systems to minimize risk
- Achieve <5% platform fee (compared to 20-40% in traditional platforms)
- Equipment Owners: Individuals or businesses with underutilized assets
- Renters: Individuals or businesses needing temporary equipment access
- Investors: Users seeking fractional ownership opportunities
- Validators: Community members who verify asset condition and resolve disputes
- Insurance Providers: Third-party entities offering coverage options
Transform physical equipment into verifiable digital tokens representing ownership rights.
- Asset Registration: Owners submit equipment details, photos, and documentation
- NFT Minting: Each asset becomes a unique SIP-009 compliant NFT
- Metadata Storage: IPFS stores images, manuals, and verification documents
- Ownership Proof: Blockchain record of asset ownership and transfer history
- Asset Categories: Heavy machinery, vehicles, construction equipment, tech equipment, agricultural tools
- Owners provide asset information including make, model, year, serial number, purchase price
- Upload multiple images showing current condition from various angles
- Attach ownership documents, purchase receipts, or lease agreements
- Set initial valuation and depreciation schedule
- Define maintenance history and service records
- Smart contract mints NFT with IPFS hash references
- Token becomes tradeable and fractionizable immediately upon minting
Connect equipment owners with renters through a trustless marketplace with automated escrow.
- Listing Management: Owners set rental terms, pricing, and availability
- Search and Discovery: Renters browse available equipment by category, location, price
- Booking System: Calendar-based availability with instant or owner-approved bookings
- Smart Contract Escrow: Automated payment holding and release
- Rental Agreements: On-chain rental terms with dispute resolution clauses
- Owners list assets with daily/weekly/monthly rates
- Set minimum rental periods and advance booking requirements
- Define geographic restrictions and delivery options
- Renters search with filters for category, price range, location, ratings
- Submit rental requests with desired dates and use case
- Security deposit held in escrow (20-40% of rental value)
- Rental payment locked in contract until completion
- Automatic fund release upon successful return
- Dispute mechanism if issues arise
Enable multiple investors to co-own expensive equipment and share rental revenue.
- Token Fractionalization: Split single asset NFT into fungible tokens (SIP-010)
- Ownership Percentage: Each fraction represents proportional ownership
- Governance Rights: Token holders vote on rental terms and major decisions
- Secondary Market: Trade fractional tokens on DEX or internal marketplace
- Buyout Mechanism: Majority token holders can force buyout of minority holders
- Original owner decides fractionalization ratio (e.g., 1 NFT = 1000 tokens)
- Minimum investment threshold set per asset (e.g., minimum 10 tokens)
- Each token represents voting power in asset governance
- Owners vote on: rental pricing, asset sale, major repairs, insurance coverage
- Fractional tokens tradeable on secondary market
- Price discovery through supply and demand
- Liquidity pools can be created for high-value assets
- Majority holders (>66%) can initiate asset sale with fair price determined by oracle
Automatically distribute rental income to all token holders proportional to ownership stakes.
- Revenue Collection: Smart contract receives rental payments
- Platform Fee Deduction: Protocol takes small fee (3-5%)
- Proportional Distribution: Revenue split based on token holdings
- Automatic Payouts: Funds distributed immediately after rental completion
- Reinvestment Options: Token holders can auto-compound earnings
- Rental payment flows to revenue distribution contract
- Platform deducts fee (e.g., 4% to treasury)
- Maintenance reserve fund set aside (e.g., 10% of revenue)
- Remaining 86% distributed to token holders
- Distribution calculated: (user_tokens / total_tokens) × available_revenue
- Instant STX payment to each holder's wallet
- Optional: Auto-stake earnings for compound growth
- Transparent revenue history viewable on-chain
- Monthly/quarterly revenue reports generated automatically
Build trust through transparent performance tracking for both owners and renters.
- Rating Mechanism: 5-star rating system post-rental
- Review System: Written feedback stored on-chain
- Performance Metrics: On-time delivery, asset condition, communication
- Reputation Score: Algorithmic calculation based on history
- Badge System: Achievement badges for milestone completions
- Both parties rate each other after rental completion
- Ratings immutable once submitted (prevents manipulation)
- Reviews include: asset condition, cleanliness, owner responsiveness, renter care
- Reputation score calculated from: total rentals, average rating, dispute history
- Badges earned for: 10/50/100 successful rentals, zero disputes, perfect 5.0 rating
- High reputation users get: priority listings, lower insurance premiums, rental discounts
- Low reputation triggers: mandatory insurance, higher deposits, restricted access
Protect both owners and renters from damage, theft, or disputes through pooled risk mechanisms.
- Damage Insurance: Covers accidental damage during rental period
- Theft Protection: Compensation if asset is stolen while rented
- Liability Coverage: Protection against third-party claims
- Insurance Pool: Community-funded reserve for claims
- Risk Assessment: Premium calculation based on asset value and renter reputation
- Mandatory insurance for all rentals
- Premium calculated: base_rate × asset_value × risk_multiplier
- Risk factors: renter reputation, asset category, rental duration, location
- Insurance payment added to rental cost automatically
- Claims submitted through dispute resolution system
- Validator network assesses damage and approves claims
- Payouts processed automatically from insurance pool
- Pool replenished through premiums and staking rewards
- Optional: Third-party insurance provider integration for high-value assets
FlexLease will consist of six primary Clarity smart contracts, each handling specific protocol functionality. All contracts will be deployed on the Stacks blockchain and interact with each other through contract calls.
Purpose: Central registry for all tokenized assets, manages asset creation, metadata, and ownership tracking.
Responsibilities:
- Mint asset NFTs (SIP-009 compliant)
- Store asset metadata and IPFS hash references
- Track ownership and transfer history
- Manage asset status (available, rented, maintenance, retired)
- Handle asset verification and validation
Data Maps:
assets: Maps asset-id to asset details (owner, category, valuation, status, mint-date)asset-metadata: Maps asset-id to IPFS hashes (images, documents, certifications)asset-categories: Maps category-id to category name and requirementsowner-assets: Maps principal to list of owned asset-idsasset-verification: Maps asset-id to verification status and validator
Data Variables:
asset-counter: uint tracking total assets mintedplatform-fee: uint representing platform fee percentage (default 400 basis points = 4%)contract-owner: principal of contract administratorpaused: boolean for emergency pause functionality
Public Functions Needed:
mint-asset: Create new asset NFT with metadataupdate-asset-metadata: Modify IPFS hash referencestransfer-asset: Transfer ownership to new principalfractionalize-asset: Convert NFT to fractional tokensupdate-asset-status: Change status (available/rented/maintenance)set-asset-valuation: Update current market valueretire-asset: Mark asset as permanently removed
Read-Only Functions Needed:
get-asset-details: Retrieve complete asset informationget-asset-owner: Return current owner principalget-asset-metadata: Return IPFS hashesget-assets-by-category: List all assets in categoryget-owner-assets: List all assets owned by principalget-asset-count: Return total assets minted
Purpose: Manages the fractionalization of assets into fungible tokens (SIP-010 compliant) and handles governance.
Responsibilities:
- Convert asset NFTs into fractional tokens
- Manage token distribution and transfers
- Implement governance voting mechanisms
- Handle buyout procedures
- Track ownership percentages
Data Maps:
fractional-assets: Maps asset-id to fractionalization details (total-supply, active-tokens)token-balances: Maps (asset-id, principal) to token balancegovernance-proposals: Maps proposal-id to proposal details and voting resultsvotes: Maps (proposal-id, principal) to vote choicebuyout-offers: Maps asset-id to active buyout offer details
Data Variables:
minimum-fractionalization: uint representing minimum tokens per asset (default 100)governance-threshold: uint representing voting threshold percentage (default 6600 = 66%)proposal-counter: uint tracking total governance proposals
Public Functions Needed:
fractionalize: Split asset NFT into fungible tokensdistribute-tokens: Allocate tokens to initial investorstransfer-tokens: SIP-010 transfer implementationcreate-proposal: Submit governance proposalcast-vote: Vote on active proposalexecute-proposal: Execute approved proposalinitiate-buyout: Start buyout process for minority holdersaccept-buyout: Minority holder accepts buyout offer
Read-Only Functions Needed:
get-token-balance: Return user's token balance for assetget-ownership-percentage: Calculate percentage ownedget-fractional-details: Return fractionalization informationget-proposal-status: Check proposal state and resultsget-voting-power: Calculate user's voting poweris-fractionalized: Check if asset is fractionalized
Purpose: Core rental functionality including listings, bookings, escrow, and rental execution.
Responsibilities:
- Manage asset listings and availability
- Process rental bookings and reservations
- Handle escrow for rental payments and deposits
- Execute rental agreements
- Track rental history and current rentals
Data Maps:
listings: Maps listing-id to listing details (asset-id, daily-rate, terms, status)bookings: Maps booking-id to booking details (listing-id, renter, dates, payment)rental-agreements: Maps agreement-id to active rental termsescrow-balances: Maps agreement-id to escrowed funds (payment + deposit)rental-calendar: Maps (asset-id, date) to availability statusrental-history: Maps asset-id to list of completed rental-ids
Data Variables:
listing-counter: uint tracking total listingsbooking-counter: uint tracking total bookingsminimum-rental-period: uint minimum rental days (default 1)maximum-advance-booking: uint maximum days in advance (default 365)deposit-percentage: uint deposit as percentage of rental value (default 3000 = 30%)
Public Functions Needed:
create-listing: List asset for rent with termsupdate-listing: Modify rental rates or availabilitydeactivate-listing: Remove listing from marketplacecreate-booking: Renter submits rental requestapprove-booking: Owner approves rental requestreject-booking: Owner rejects rental requeststart-rental: Execute rental agreement and lock escrowcomplete-rental: End rental and release fundscancel-booking: Cancel before rental startextend-rental: Extend active rental period
Read-Only Functions Needed:
get-listing-details: Return listing informationget-available-assets: List all available assetscheck-availability: Verify dates available for assetget-booking-details: Return booking informationget-active-rentals: List ongoing rentalsget-rental-history: Return completed rentals for assetcalculate-rental-cost: Compute total cost for dates
Purpose: Automatically distribute rental income to all stakeholders based on ownership and protocol rules.
Responsibilities:
- Receive rental payments from marketplace contract
- Calculate and deduct platform fees
- Distribute revenue to token holders proportionally
- Manage maintenance reserve funds
- Track revenue history and payments
Data Maps:
revenue-pools: Maps asset-id to accumulated revenuedistributions: Maps distribution-id to distribution detailspayout-history: Maps (asset-id, principal) to total earningsmaintenance-reserves: Maps asset-id to reserved maintenance fundspending-withdrawals: Maps principal to withdrawable balance
Data Variables:
platform-fee-percentage: uint platform fee (default 400 = 4%)maintenance-reserve-percentage: uint maintenance reserve (default 1000 = 10%)treasury-address: principal receiving platform feesdistribution-counter: uint tracking total distributions
Public Functions Needed:
receive-rental-payment: Accept payment from marketplace contractdistribute-revenue: Calculate and distribute earnings to holderswithdraw-earnings: User withdraws accumulated earningsallocate-maintenance-fund: Set aside funds for repairswithdraw-maintenance-fund: Owner withdraws for approved repairscompound-earnings: Auto-reinvest earnings into more tokens
Read-Only Functions Needed:
get-revenue-pool: Return accumulated revenue for assetget-user-earnings: Calculate pending earnings for userget-distribution-history: Return past distributionsget-maintenance-reserve: Return reserved funds for assetcalculate-distribution: Preview distribution amountsget-total-distributed: Return lifetime distributions for asset
Purpose: Track and manage reputation scores, ratings, and reviews for all platform participants.
Responsibilities:
- Record ratings and reviews post-rental
- Calculate reputation scores algorithmically
- Award achievement badges
- Track performance metrics
- Manage reputation-based privileges
Data Maps:
user-reputation: Maps principal to reputation score and statsratings: Maps (agreement-id, principal) to rating detailsreviews: Maps review-id to review content and IPFS hashbadges: Maps (principal, badge-type) to badge earned statusdispute-history: Maps principal to list of dispute-ids
Data Variables:
minimum-reputation-score: uint minimum score to participate (default 0)excellent-reputation-threshold: uint score for premium status (default 8500 = 4.25/5)review-counter: uint tracking total reviews
Public Functions Needed:
submit-rating: Rate counterparty after rental (1-5 stars)submit-review: Write review with IPFS hashcalculate-reputation: Update user's reputation scoreaward-badge: Grant achievement badgerevoke-badge: Remove badge for policy violationflag-user: Report suspicious behavior
Read-Only Functions Needed:
get-reputation-score: Return user's current reputationget-user-stats: Return rental count, average rating, completion rateget-ratings: Return all ratings received by userget-reviews: Return review history for userget-badges: Return all badges earned by usercheck-reputation-requirement: Verify if user meets threshold
Purpose: Manage insurance premiums, claims, and payouts for rental protection.
Responsibilities:
- Calculate insurance premiums based on risk factors
- Collect premiums and build reserve pool
- Process damage and theft claims
- Execute payouts for approved claims
- Integrate with validator network for claim assessment
Data Maps:
insurance-policies: Maps agreement-id to policy details and coverageclaims: Maps claim-id to claim details, evidence, and statuspool-reserves: Maps asset-category to available insurance fundspremium-history: Maps principal to total premiums paidclaim-history: Maps principal to list of past claims
Data Variables:
base-premium-rate: uint base insurance rate (default 300 = 3%)pool-balance: uint total funds in insurance poolclaim-counter: uint tracking total claimsmaximum-claim-amount: uint per-claim limit
Public Functions Needed:
calculate-premium: Compute insurance cost for rentalcollect-premium: Receive premium paymentfile-claim: Submit damage or theft claimsubmit-claim-evidence: Upload supporting documentation (IPFS)approve-claim: Validator approves claim payoutreject-claim: Validator rejects fraudulent claimprocess-payout: Execute approved claim paymentcontribute-to-pool: Users stake into insurance pool for yield
Read-Only Functions Needed:
get-premium-quote: Preview insurance costget-policy-details: Return coverage informationget-claim-status: Check claim progressget-pool-balance: Return available insurance fundsget-claim-history: Return user's past claimscalculate-risk-score: Compute user's risk profile
Asset Creation Flow:
- User calls
mint-asseton Asset Registry Contract - Contract validates inputs and mints SIP-009 NFT
- Metadata stored with IPFS hash reference
- Owner can call
fractionalize-asseton Asset Registry - Asset Registry calls Fractional Ownership Contract to create tokens
- Tokens distributed to initial investors
Rental Flow:
- Owner calls
create-listingon Rental Marketplace Contract - Renter calls
create-bookingwith desired dates - Owner calls
approve-booking - Marketplace calls Insurance Pool to
calculate-premium - Renter calls
start-rentalwith payment + deposit + premium - Funds locked in escrow, premium sent to Insurance Pool
- Upon completion, renter/owner calls
complete-rental - Marketplace calls Revenue Distribution to
distribute-revenue - Both parties call
submit-ratingon Reputation Contract - Escrow released based on rental outcome
Claim Flow:
- User calls
file-claimon Insurance Pool Contract - Uploads evidence via
submit-claim-evidence(IPFS) - Validator network reviews claim (off-chain coordination)
- Validator calls
approve-claimorreject-claim - If approved, Insurance Pool calls
process-payout - Funds transferred from pool to claimant
Rationale: React chosen for its mature ecosystem, excellent Stacks integration libraries, and large developer community.
Key Libraries:
- React 18+: Core framework
- Vite: Build tool and dev server
- @stacks/connect: Wallet connection and authentication
- @stacks/transactions: Transaction building and broadcasting
- @stacks/network: Network configuration
- @stacks/storage: Gaia storage integration (if needed)
- React Router: Client-side routing
- Zustand or Jotai: Lightweight state management
- TanStack Query: Server state and caching
- Tailwind CSS: Utility-first styling with green/black theme
- ipfs-http-client: IPFS interaction
- date-fns: Date manipulation for bookings
- react-hook-form: Form handling and validation
flexlease-frontend/
├── public/
│ ├── assets/
│ │ ├── logo.svg
│ │ ├── icons/
│ │ └── images/
│ └── favicon.ico
├── src/
│ ├── components/
│ │ ├── common/
│ │ │ ├── Button.jsx
│ │ │ ├── Card.jsx
│ │ │ ├── Input.jsx
│ │ │ ├── Modal.jsx
│ │ │ ├── Spinner.jsx
│ │ │ └── Toast.jsx
│ │ ├── layout/
│ │ │ ├── Header.jsx
│ │ │ ├── Footer.jsx
│ │ │ ├── Sidebar.jsx
│ │ │ └── Layout.jsx
│ │ ├── asset/
│ │ │ ├── AssetCard.jsx
│ │ │ ├── AssetDetails.jsx
│ │ │ ├── AssetForm.jsx
│ │ │ ├── AssetGallery.jsx
│ │ │ └── FractionalizationPanel.jsx
│ │ ├── rental/
│ │ │ ├── RentalCard.jsx
│ │ │ ├── BookingForm.jsx
│ │ │ ├── RentalCalendar.jsx
│ │ │ ├── RentalAgreement.jsx
│ │ │ └── ActiveRentals.jsx
│ │ ├── marketplace/
│ │ │ ├── SearchBar.jsx
│ │ │ ├── FilterPanel.jsx
│ │ │ ├── ListingGrid.jsx
│ │ │ └── CategoryFilter.jsx
│ │ ├── reputation/
│ │ │ ├── RatingStars.jsx
│ │ │ ├── ReviewForm.jsx
│ │ │ ├── ReputationScore.jsx
│ │ │ └── BadgeDisplay.jsx
│ │ ├── revenue/
│ │ │ ├── EarningsCard.jsx
│ │ │ ├── RevenueChart.jsx
│ │ │ └── WithdrawPanel.jsx
│ │ ├── insurance/
│ │ │ ├── PremiumCalculator.jsx
│ │ │ ├── ClaimForm.jsx
│ │ │ └── ClaimStatus.jsx
│ │ └── wallet/
│ │ ├── ConnectWallet.jsx
│ │ ├── WalletInfo.jsx
│ │ └── TransactionStatus.jsx
│ ├── pages/
│ │ ├── Home.jsx
│ │ ├── Marketplace.jsx
│ │ ├── AssetDetail.jsx
│ │ ├── CreateAsset.jsx
│ │ ├── MyAssets.jsx
│ │ ├── MyRentals.jsx
│ │ ├── Dashboard.jsx
│ │ ├── Profile.jsx
│ │ └── NotFound.jsx
│ ├── hooks/
│ │ ├── useWallet.js
│ │ ├── useContract.js
│ │ ├── useIPFS.js
│ │ ├── useAssets.js
│ │ ├── useRentals.js
│ │ ├── useReputation.js
│ │ └── useRevenue.js
│ ├── services/
│ │ ├── stacksService.js
│ │ ├── ipfsService.js
│ │ ├── contractService.js
│ │ └── validationService.js
│ ├── store/
│ │ ├── walletStore.js
│ │ ├── assetStore.js
│ │ └── uiStore.js
│ ├── utils/
│ │ ├── formatters.js
│ │ ├── validators.js
│ │ ├── constants.js
│ │ └── helpers.js
│ ├── contracts/
│ │ ├── asset-registry.ts
│ │ ├── fractional-ownership.ts
│ │ ├── rental-marketplace.ts
│ │ ├── revenue-distribution.ts
│ │ ├── reputation.ts
│ │ └── insurance-pool.ts
│ ├── styles/
│ │ ├── global.css
│ │ └── theme.js
│ ├── App.jsx
│ ├── main.jsx
│ └── router.jsx
├── .env.example
├── .gitignore
├── index.html
├── package.json
├── tailwind.config.js
├── vite.config.js
└── README.md
Button Component
- Variants: primary, secondary, danger, ghost
- Sizes: small, medium, large
- States: default, loading, disabled
- Green accent on hover for primary buttons
Card Component
- Consistent container for content sections
- Dark background with light border
- Hover effects with subtle green glow
Modal Component
- Overlay backdrop with blur effect
- Centered dialog on dark background
- Close button and escape key handling
Input Component
- Text, number, date input variants
- Validation states and error messages
- Green focus border
- Light text on dark background
Header Component
- FlexLease logo and branding
- Navigation menu (Home, Marketplace, My Assets, Dashboard)
- Wallet connection button
- User profile dropdown
- Responsive mobile menu
Footer Component
- Platform links and resources
- Social media connections
- Network status indicator
- Copyright information
Sidebar Component
- Dashboard navigation
- Asset management links
- Rental management
- Profile settings
AssetCard Component
- Thumbnail image from IPFS
- Asset name and category
- Daily rental rate
- Availability status indicator
- Quick action buttons (View, Rent)
- Ownership badge if user owns tokens
AssetDetails Component
- Full image gallery with IPFS images
- Comprehensive specifications
- Current owner information
- Fractionalization status and ownership distribution
- Revenue history chart
- Available rental dates calendar
AssetForm Component
- Multi-step form for asset creation
- Basic information step
- Image upload to IPFS
- Document upload (ownership proof)
- Pricing and terms configuration
- Confirmation and minting
FractionalizationPanel Component
- Token supply input
- Price per token setting
- Investor allocation interface
- Preview of ownership distribution
- Execute fractionalization button
RentalCard Component
- Asset thumbnail
- Rental dates and duration
- Rental status (pending, active, completed)
- Total cost breakdown
- Action buttons based on status
BookingForm Component
- Date range picker with calendar
- Rental cost calculator
- Insurance premium display
- Deposit requirement
- Terms acceptance checkbox
- Submit booking button
RentalCalendar Component
- Month/year navigation
- Available/unavailable date highlighting
- Selected date range display
- Price variations by date
- Holiday/peak season indicators
ActiveRentals Component
- List of ongoing rentals
- Countdown to return date
- Contact owner/renter button
- Extend rental option
- Complete rental button
SearchBar Component
- Text search input with autocomplete
- Search button with loading state
- Recent searches dropdown
- Clear search button
FilterPanel Component
- Category checkboxes
- Price range slider
- Location radius selector
- Availability date filter
- Rating filter
- Sort options (price, rating, distance)
ListingGrid Component
- Responsive grid layout (1-4 columns based on screen size)
- Asset cards with lazy loading
- Pagination or infinite scroll
- Empty state message
- Loading skeletons
RatingStars Component
- Interactive star display for rating input
- Read-only star display for showing ratings
- Half-star support
- Color coding (green for high ratings)
ReviewForm Component
- Star rating selector
- Text area for written review
- Photo upload option (IPFS)
- Submit and cancel buttons
- Character count indicator
ReputationScore Component
- Large score display (out of 5.0)
- Breakdown of rating categories
- Total rental count
- Completion rate percentage
- Badge display section
EarningsCard Component
- Total earnings display
- Pending earnings
- Withdrawn earnings
- Asset-wise breakdown
- Withdraw button
RevenueChart Component
- Line chart showing earnings over time
- Asset comparison view
- Time period selector (week, month, year, all)
- Export data option
WithdrawPanel Component
- Available balance display
- Withdrawal amount input
- Transaction fee estimate
- Withdrawal history list
- Confirm withdrawal button
Wallet Store
- Connected wallet address
- Network (mainnet/testnet)
- STX balance
- Connection status
Asset Store
- User's owned assets
- User's fractional holdings
- Recently viewed assets
UI Store
- Theme settings (already dark with green accents)
- Modal states
- Toast notifications
- Loading states
Asset Queries
- All assets list with caching
- Single asset details
- User's asset portfolio
- Marketplace listings
Rental Queries
- Active rentals
- Rental history
- Booking requests
- Availability calendar
Reputation Queries
- User reputation data
- Ratings and reviews
- Badges earned
Revenue Queries
- Earnings data
- Distribution history
- Pending withdrawals
Initial Connection:
- User clicks "Connect Wallet" button
- Detect available Stacks wallets (Hiro, Leather, Xverse)
- Show wallet selection modal
- User selects preferred wallet
- Wallet prompts for authentication
- Store session and address in wallet store
- Fetch user data (assets, rentals, reputation)
Session Persistence:
- Store authentication token in localStorage
- Auto-reconnect on page reload
- Session expiry handling
Transaction Signing:
- Build transaction using @stacks/transactions
- Call wallet to sign transaction
- User approves in wallet popup
- Broadcast transaction to network
- Poll for confirmation
- Update UI with transaction status
- Show success/error notifications
Network Switching:
- Support both mainnet and testnet
- Clear indication of current network
- Warning when switching networks
- Separate contract addresses per network
IPFS (InterPlanetary File System) serves as the decentralized storage layer for all multimedia and document content in FlexLease. This ensures censorship resistance, content permanence, and reduces on-chain storage costs.
Asset Images:
- Primary equipment photo
- Multiple angle shots (front, back, sides)
- Detail shots of important features
- Condition documentation photos
- Before/after rental photos
Documents:
- Ownership certificates
- Purchase receipts
- Maintenance records
- User manuals and specifications
- Insurance policies
- Inspection reports
Review Media:
- Photos attached to reviews
- Damage documentation for claims
- Proof of maintenance work
Asset Metadata JSON:
- Comprehensive asset information
- Specifications and features
- Historical data
- Links to all related IPFS content
Step 1: File Selection
- User selects files through file input or drag-and-drop
- Frontend validates file types and sizes
- Image compression and optimization (max 2MB per image)
- Generate thumbnails for faster loading
Step 2: IPFS Upload
- Connect to IPFS node (Infura, Pinata, or local node)
- Upload file to IPFS network
- Receive Content Identifier (CID)
- Pin content to ensure availability
- Store CID temporarily in component state
Step 3: Metadata Aggregation
- Collect all uploaded file CIDs
- Create metadata JSON object
- Upload metadata JSON to IPFS
- Receive metadata CID
Step 4: Blockchain Storage
- Include metadata CID in smart contract transaction
- Call contract function with CID parameter
- CID stored in contract data map
- Permanent link between blockchain record and IPFS content
Step 1: Fetch CID from Contract
- Query contract read-only function
- Retrieve IPFS CID for asset
- Parse CID string
Step 2: Fetch Content from IPFS
- Construct IPFS gateway URL (ipfs.io or Cloudflare IPFS gateway)
- Fetch content via HTTP GET request
- Implement retry logic for gateway failures
- Cache content in browser for repeat views
Step 3: Display Content
- Parse JSON metadata if applicable
- Render images in gallery components
- Display document links
- Lazy load images for performance
Storage Pattern:
- CIDs stored as string-ascii in Clarity contracts
- Maximum length: 100 characters (sufficient for CIDv1)
- Each asset has primary metadata CID
- Additional CIDs for updates/modifications
Contract Storage Example:
Asset Metadata Map Structure:
{
asset-id: u1,
metadata-cid: "QmX7g8...",
image-cids: ["QmY2h3...", "QmZ4k9..."],
document-cids: ["QmA8m5..."],
last-updated: u1234567890
}
Update Mechanism:
- Owner can update metadata CID
- Historical CIDs preserved in update log
- Prevents content manipulation disputes
- Immutable history of all versions
Primary Gateway: Cloudflare IPFS Gateway
- Fast global CDN
- High availability
- HTTPS support
- URL format:
https://cloudflare-ipfs.com/ipfs/{CID}
Backup Gateway: IPFS.io
- Official IPFS gateway
- Fallback if primary fails
- URL format:
https://ipfs.io/ipfs/{CID}
Local Node Option:
- Power users can run local IPFS nodes
- Direct IPFS protocol access
- Faster retrieval for pinned content
- URL format:
http://localhost:8080/ipfs/{CID}
Pinning Services:
- Pinata: Primary pinning service for reliability
- Infura: Backup pinning service
- Web3.Storage: Additional redundancy
Pinning Logic:
- Automatically pin all uploaded content to at least 2 services
- Critical content (asset images, ownership docs) pinned to 3 services
- Monitor pin status and re-pin if unpinned
- Paid pinning plans for guaranteed availability
Cost Optimization:
- Free tier usage for development/testing
- Paid tiers for production
- Estimate: $10-50/month for 10GB storage with redundancy
Content Verification:
- Verify CID matches content hash
- Detect content tampering attempts
- Validate file types before display
- Scan for malicious content
Privacy Considerations:
- All IPFS content is public by default
- Sensitive documents should be encrypted before upload
- Personal information redacted from public images
- Option for private IPFS networks for sensitive data
Content Moderation:
- Report mechanism for inappropriate content
- Community validators review flagged content
- Ability to update CID if content violates terms
- Legal compliance for DMCA takedowns
Principle: Store only essential, verifiable data on-chain. Minimize storage costs while ensuring data integrity.
On-Chain:
- Asset ID (uint)
- Owner principal (address)
- Asset category (uint mapped to enum)
- Current valuation (uint in micro-STX)
- Status (uint: 0=available, 1=rented, 2=maintenance, 3=retired)
- Metadata CID (string-ascii)
- Mint block height (uint)
- Fractional status (bool)
- Verification status (bool)
- Validator principal (optional)
Off-Chain (IPFS):
- Asset name and description
- Detailed specifications
- Images (multiple URLs)
- Purchase receipts
- Ownership documents
- Maintenance history
- Serial numbers
- Manufacturer information
On-Chain:
- Asset ID (uint)
- Total token supply (uint)
- Token symbol (string-ascii)
- Token balances per principal (map)
- Governance proposal details
- Voting records
- Proposal execution status
Off-Chain (IPFS):
- Detailed proposal descriptions
- Supporting documents
- Discussion threads
- Vote explanations
On-Chain:
- Listing ID (uint)
- Asset ID (uint)
- Daily rate (uint in micro-STX)
- Minimum rental period (uint days)
- Security deposit percentage (uint)
- Listing status (uint: active/paused/closed)
- Booking ID (uint)
- Renter principal
- Start date (uint timestamp)
- End date (uint timestamp)
- Total payment (uint)
- Escrow balance (uint)
- Rental status (uint: pending/active/completed/disputed)
Off-Chain (IPFS):
- Detailed rental terms and conditions
- Usage restrictions
- Location details and coordinates
- Delivery/pickup instructions
- Additional photos
- Rental agreement PDF
On-Chain:
- Asset ID (uint)
- Revenue pool balance (uint)
- Maintenance reserve (uint)
- Distribution ID (uint)
- Distribution amount per token (uint)
- Timestamp (uint)
- User withdrawal balances (map: principal -> uint)
- Total distributed (uint)
Off-Chain (IPFS):
- Detailed revenue reports
- Expense breakdowns
- Maintenance receipts
- Distribution history exports
On-Chain:
- User principal (address)
- Reputation score (uint: 0-10000, representing 0.00-5.00)
- Total rentals (uint)
- Successful completions (uint)
- Average rating (uint)
- Rating details (map: agreement-id -> uint)
- Review CIDs (list of string-ascii)
- Badge list (list of uint badge-type)
- Dispute count (uint)
- Last updated (uint timestamp)
Off-Chain (IPFS):
- Full review text
- Review photos
- Detailed performance metrics
- Communication quality ratings
- Badge images and descriptions
On-Chain:
- Policy ID (uint)
- Agreement ID (uint)
- Premium amount (uint)
- Coverage amount (uint)
- Policy status (uint)
- Claim ID (uint)
- Claim amount (uint)
- Claim status (uint: pending/approved/rejected)
- Evidence CIDs (list)
- Validator approvals (map)
- Payout amount (uint)
- Pool balance (uint per category)
Off-Chain (IPFS):
- Claim descriptions
- Damage photos
- Repair estimates
- Third-party assessment reports
- Communication logs
IPFS Content Structure:
Asset Metadata JSON:
{
"name": "CAT 320 Excavator",
"description": "2020 Caterpillar 320 excavator...",
"category": "heavy-machinery",
"specifications": {
"make": "Caterpillar",
"model": "320",
"year": 2020,
"serialNumber": "CAT0320WXYZ",
"operatingWeight": "20000 kg",
"enginePower": "121 kW"
},
"images": [
"QmImageCID1",
"QmImageCID2",
"QmImageCID3"
],
"documents": {
"ownership": "QmOwnershipCID",
"purchase": "QmPurchaseCID",
"manual": "QmManualCID"
},
"location": {
"city": "Denver",
"state": "CO",
"coordinates": "39.7392,-104.9903"
},
"maintenanceHistory": [
{
"date": "2024-03-15",
"type": "routine",
"description": "Oil change and filter replacement",
"receipt": "QmMaintenanceCID1"
}
]
}Review JSON:
{
"rating": 5,
"reviewText": "Excellent equipment, well maintained...",
"categories": {
"condition": 5,
"cleanliness": 5,
"communication": 5,
"valueForMoney": 4
},
"photos": ["QmReviewPhoto1", "QmReviewPhoto2"],
"timestamp": 1701234567,
"verified": true
}Blockchain as Source of Truth:
- Smart contract state is canonical
- IPFS content referenced by on-chain CIDs
- Frontend caches both blockchain and IPFS data
- Periodic sync to ensure consistency
Frontend Caching:
- TanStack Query caches contract reads (5-minute stale time)
- IPFS content cached in browser (1-day stale time)
- IndexedDB for offline support (optional)
- Service Worker for asset images (optional)
Real-Time Updates:
- Subscribe to blockchain events for owned assets
- WebSocket connection for rental status changes
- Push notifications for important events
- Automatic UI refresh on state changes
Primary Responsibilities:
- Create and manage asset listings
- Set rental terms and pricing
- Approve or reject booking requests
- Maintain asset condition
- Handle renter communications
- Process insurance claims for damage
Permissions:
- Mint new asset NFTs
- Fractionalize owned assets
- Create rental listings
- Approve/reject bookings
- Update asset metadata and pricing
- Withdraw rental revenue
- Submit maintenance fund requests
- Rate and review renters
- Initiate dispute resolution
Restrictions:
- Cannot rent own assets
- Cannot manipulate reputation scores
- Cannot withdraw escrowed funds prematurely
- Must maintain minimum reputation for premium features
Primary Responsibilities:
- Search and discover available equipment
- Submit rental booking requests
- Pay rental fees and deposits
- Use equipment responsibly per terms
- Return equipment on time and in good condition
- Report damages immediately
Permissions:
- Browse marketplace
- Submit booking requests
- Pay for rentals
- Extend active rentals
- Complete rental checkout
- Rate and review owners
- File insurance claims for disputes
- View rental history
Restrictions:
- Must have minimum reputation score to rent high-value assets
- Cannot cancel rental after start without penalty
- Cannot sublease rented equipment
- Must comply with usage restrictions
- Limited to maximum concurrent rentals based on reputation
Primary Responsibilities:
- Purchase fractional tokens of assets
- Participate in governance voting
- Monitor asset performance
- Earn passive income from rentals
Permissions:
- Buy/sell fractional tokens
- Vote on governance proposals
- Receive proportional rental revenue
- View detailed asset analytics
- Propose asset sale or major changes
- Withdraw accumulated earnings
Restrictions:
- Voting power proportional to tokens held
- Cannot unilaterally make asset decisions
- Subject to lockup periods (optional)
- Must hold minimum tokens to vote
- Cannot force sale without majority approval
Primary Responsibilities:
- Verify asset authenticity and condition
- Review insurance claims
- Mediate disputes between parties
- Ensure platform policy compliance
- Provide expert assessments
Permissions:
- Access to all asset documentation
- Approve/reject asset verifications
- Approve/reject insurance claims
- Issue reputation penalties
- Access dispute resolution system
- Earn validation rewards
Requirements:
- Staked collateral (e.g., 10,000 STX)
- Proven expertise in asset category
- High reputation score (4.5+)
- Community election or platform appointment
- Regular activity requirements
Restrictions:
- Cannot validate own assets or rentals
- Cannot participate in rentals while validating
- Collateral slashed for fraudulent decisions
- Term limits and performance reviews
Primary Responsibilities:
- Maintain platform infrastructure
- Update smart contracts (via governance)
- Manage emergency situations
- Handle legal compliance
- Moderate content
- Resolve critical disputes
Permissions:
- Pause/unpause contracts in emergencies
- Update platform fee parameters
- Add/remove validator approvals
- Remove illegal content
- Access all platform data for audits
- Implement governance decisions
Restrictions:
- Cannot access user funds directly
- Cannot manipulate user reputations
- Subject to multi-sig requirements
- Actions logged and auditable
- Term limits via governance
| Action | Owner | Renter | Investor | Validator | Admin |
|---|---|---|---|---|---|
| Mint Asset | ✅ | ❌ | ❌ | ❌ | ❌ |
| Create Listing | ✅ | ❌ | ❌ | ❌ | |
| Book Rental | ✅ | ✅ | ❌ | ❌ | |
| Approve Booking | ✅ | ❌ | ❌ | ❌ | |
| Complete Rental | ✅ | ✅ | ❌ | ❌ | ❌ |
| Rate User | ✅ | ✅ | ❌ | ❌ | ❌ |
| File Claim | ✅ | ✅ | ✅ | ❌ | ❌ |
| Approve Claim | ❌ | ❌ | ❌ | ✅ | |
| Vote on Proposal | ❌ | ✅ | ❌ | ❌ | |
| Fractionalize Asset | ✅ | ❌ | ❌ | ❌ | ❌ |
| Buy Tokens | ✅ | ✅ | ✅ | ✅ | ✅ |
| Withdraw Revenue | ✅ | ❌ | ✅ | ❌ | ❌ |
| Verify Asset | ❌ | ❌ | ❌ | ✅ | ✅ |
| Pause Contract | ❌ | ❌ | ❌ | ❌ | ✅ |
*If holding fractional tokens of the asset **Cannot rent own assets ***Only in emergency situations
Tier 1: New User (0-3.0 rating)
- Limited to assets under $500 value
- Maximum 1 active rental
- Higher insurance premiums (+50%)
- Higher security deposits (+50%)
- Cannot participate in governance
Tier 2: Established User (3.0-4.0 rating)
- Access to assets up to $2,500
- Maximum 3 active rentals
- Standard insurance premiums
- Standard security deposits
- Can vote on governance (minimum tokens required)
Tier 3: Trusted User (4.0-4.5 rating)
- Access to assets up to $10,000
- Maximum 5 active rentals
- Reduced insurance premiums (-20%)
- Reduced security deposits (-20%)
- Enhanced governance voting power (1.5x)
- Eligible for validator role
Tier 4: Premium User (4.5-5.0 rating)
- Unlimited asset value access
- Unlimited active rentals
- Reduced insurance premiums (-40%)
- Reduced security deposits (-40%)
- Enhanced governance voting power (2x)
- Priority listing placement
- Validator role eligibility
- Platform fee discounts (-25%)
Step 1: Asset Creation
- Owner clicks "List Equipment" button
- Connects wallet if not already connected
- Selects asset category from dropdown
- Fills out asset information form:
- Name (e.g., "2020 CAT 320 Excavator")
- Description (detailed text)
- Specifications (make, model, year, serial number)
- Purchase price and current valuation
- Location (city, state)
Step 2: Image Upload
- Clicks "Add Photos" button
- Selects multiple images from device (min 3, max 10)
- Frontend compresses images to max 2MB each
- Images uploaded to IPFS sequentially
- Progress bar shows upload status
- IPFS CIDs stored temporarily in form state
- Thumbnail previews displayed
Step 3: Document Upload
- Clicks "Add Documents" section
- Uploads ownership certificate (required)
- Uploads purchase receipt (optional)
- Uploads maintenance records (optional)
- Documents uploaded to IPFS
- CIDs stored in form state
Step 4: Create Metadata
- Frontend aggregates all form data
- Creates JSON metadata object
- Uploads metadata JSON to IPFS
- Receives metadata CID
Step 5: Blockchain Transaction
- User reviews summary of asset details
- Clicks "Mint Asset" button
- Frontend builds Clarity transaction calling
mint-asset - Transaction includes metadata CID
- Wallet prompts for signature
- User approves transaction
- Transaction broadcast to Stacks network
- Frontend shows "Transaction Pending" status
- Polls for transaction confirmation
- Success notification displayed
- Asset appears in "My Assets" page
Step 6: Create Rental Listing (Optional)
- From asset detail page, click "Create Listing"
- Set daily rental rate (STX)
- Set minimum rental period (days)
- Set security deposit percentage (15-50%)
- Define availability calendar
- Set geographic restrictions (optional)
- Add special terms (IPFS)
- Review and confirm
- Sign transaction calling
create-listing - Listing appears in marketplace
Step 1: Discovery
- Renter visits marketplace page
- Uses search bar or filters
- Filters by category, price, location, dates
- Browses asset cards in grid
- Clicks asset for details
Step 2: Asset Review
- Views full image gallery
- Reads specifications and description
- Checks owner reputation and reviews
- Reviews available dates on calendar
- Reads rental terms
Step 3: Booking Request
- Clicks "Book Now" button
- Selects start and end dates from calendar
- System calculates:
- Base rental cost (days × daily rate)
- Security deposit (% of rental cost)
- Insurance premium (based on risk factors)
- Platform fee (4% of rental cost)
- Total amount due
- Reviews cost breakdown
- Reads and accepts rental agreement
- Clicks "Submit Booking"
Step 4: Payment Processing
- Frontend builds transaction calling
create-booking - Transaction includes total payment amount
- Wallet prompts showing exact STX amount
- User approves and signs transaction
- Funds transferred to escrow contract
- Booking created with "Pending Owner Approval" status
- Owner receives notification
Step 5: Owner Approval
- Owner reviews booking request
- Checks renter reputation
- Confirms availability
- Clicks "Approve" or "Reject"
- If approved:
- Calls
approve-bookingfunction - Booking status changes to "Approved"
- Calendar updated to block dates
- Both parties receive confirmation
- Calls
- If rejected:
- Calls
reject-bookingfunction - Escrow funds returned to renter
- Booking canceled
- Calls
Step 6: Rental Start
- On start date, renter clicks "Start Rental"
- Calls
start-rentalfunction - Rental status changes to "Active"
- Owner provides equipment access details
- Renter confirms receipt of equipment
- Timer starts for rental duration
Step 1: Return Process
- Renter returns equipment on or before end date
- Owner inspects equipment condition
- Compares to pre-rental photos
- Documents any damages with photos (uploaded to IPFS)
Step 2: Condition Assessment
- If equipment in good condition:
- Owner clicks "Complete Rental - No Issues"
- Calls
complete-rentalfunction - Full security deposit returned to renter
- Rental payment released to revenue distribution
- If equipment damaged:
- Owner clicks "Complete Rental - Damage Claim"
- Submits damage details and photos
- Initiates insurance claim
- Partial deposit withheld pending claim
Step 3: Payment Distribution
- Revenue Distribution Contract triggered automatically
- Platform fee deducted (4%)
- Maintenance reserve set aside (10%)
- Remaining amount distributed:
- If single owner: 100% to owner
- If fractionalized: proportional to token holdings
- Funds instantly available for withdrawal
Step 4: Reputation Update
- Both parties prompted to rate each other
- Rating form with 5-star scale for categories:
- Equipment condition (owner rates renter)
- Timeliness (both parties)
- Communication (both parties)
- Overall experience (both parties)
- Optional written review
- Reviews submitted to Reputation Contract
- Reputation scores recalculated automatically
- Badges awarded if milestones reached
Step 1: Dispute Initiation
- Party (owner or renter) believes rental terms violated
- Clicks "File Dispute" from active rental page
- Selects dispute type:
- Equipment damage
- Late return
- Unauthorized use
- Equipment malfunction
- Communication breakdown
- Provides detailed description
- Uploads supporting evidence (photos, messages) to IPFS
- Submits dispute
Step 2: Validator Assignment
- System selects 3 random validators with relevant expertise
- Validators notified of new dispute
- Validators review:
- Original rental agreement
- Both parties' accounts
- Evidence from both sides
- Rental history and reputation
- 48-hour review period
Step 3: Validator Decision
- Each validator submits decision:
- Favor owner
- Favor renter
- Split decision (partial refund/payment)
- Majority decision prevails
- If 2-1 split, additional validator called
- Final decision binding
Step 4: Resolution Execution
- Smart contract executes decision automatically:
- Funds released according to ruling
- Security deposit distributed per decision
- Insurance claim approved/rejected
- Both parties notified of outcome
- Reputation impacts applied:
- Losing party receives minor negative mark
- False dispute filing penalized more heavily
- Case closed and archived
Step 1: Decision to Fractionalize
- Asset owner views asset detail page
- Clicks "Fractionalize Asset" button
- Reviews benefits and implications
- Confirms intent to proceed
Step 2: Configuration
- Sets total token supply (e.g., 1000 tokens)
- Defines price per token (e.g., 10 STX)
- Chooses allocation method:
- Public sale (anyone can buy)
- Private sale (whitelist only)
- Combination
- Sets vesting schedule (optional)
- Defines minimum purchase amount
- Reviews token economics
Step 3: Governance Setup
- Configures voting parameters:
- Quorum requirement (% of tokens must vote)
- Approval threshold (% to pass proposal)
- Voting period duration
- Lists votable decisions:
- Rental pricing changes
- Asset sale
- Major repairs
- Insurance coverage
- Reviews and confirms
Step 4: Fractionalization Execution
- Clicks "Execute Fractionalization"
- Signs transaction calling
fractionalizefunction - Asset NFT locked in Fractional Ownership Contract
- Fungible tokens (SIP-010) created
- Tokens allocated to owner initially
- Listing created on internal marketplace or DEX
Step 5: Token Distribution
- Investors browse fractional opportunities
- View asset details, revenue projections, terms
- Purchase tokens via
buy-tokensfunction - Tokens transferred to buyer
- Payment sent to seller (original owner or secondary seller)
- Ownership percentage updated automatically
- Buyer gains governance rights immediately
Step 1: Proposal Creation
- Token holder clicks "Create Proposal"
- Selects proposal type:
- Change rental pricing
- Sell asset
- Approve major repair (>$X)
- Update insurance coverage
- Other
- Provides proposal title and detailed description
- Uploads supporting documents to IPFS
- Sets voting duration (default 7 days)
- Requires minimum tokens to submit (e.g., 5%)
Step 2: Proposal Submission
- Reviews proposal summary
- Signs transaction calling
create-proposal - Proposal ID assigned
- Voting period begins immediately
- All token holders notified
Step 3: Voting Period
- Token holders view active proposals
- Read proposal details and discussion
- Cast vote: For, Against, or Abstain
- Voting power = number of tokens held
- Can change vote before period ends
- Votes recorded on-chain immutably
Step 4: Proposal Resolution
- Voting period expires
- System calculates results:
- Total votes cast
- For vs Against percentage
- Quorum met? (minimum participation)
- Threshold met? (approval percentage)
- Proposal status updated: Passed or Failed
- If passed, enters execution queue
Step 5: Proposal Execution
- Authorized party (owner or admin) clicks "Execute"
- Calls
execute-proposalfunction - Smart contract implements decision:
- Updates rental pricing
- Initiates asset sale process
- Releases maintenance funds
- Updates insurance coverage
- Proposal marked as "Executed"
- All token holders notified of changes
Transaction Flow:
- Frontend prepares transaction parameters
- Uses @stacks/transactions library to build transaction object
- Specifies contract address, function name, and arguments
- Sets network (mainnet/testnet)
- Includes appropriate fee estimation
- Requests wallet signature via @stacks/connect
- User approves in wallet extension
- Signed transaction broadcast to network
- Transaction ID returned immediately
Code Pattern (Conceptual):
1. Import required functions from @stacks/transactions
2. Define contract address and function name
3. Prepare function arguments in Clarity format
4. Build PostConditions for security
5. Create transaction options object
6. Call openContractCall from @stacks/connect
7. Handle success/error callbacks
8. Update UI with transaction status
Fee Estimation:
- Query recent transaction fees via Stacks API
- Calculate based on transaction complexity
- Provide user with fee estimate before signing
- Allow advanced users to adjust fee manually
- Default to recommended fee for optimal confirmation time
Read-Only Calls:
- No transaction required
- Free and instant
- Query contract state
- Used for: checking balances, fetching asset details, viewing listings
- Pattern: call read-only function via Stacks API
- Cache results with TanStack Query
- Refresh on relevant state changes
Public Function Calls:
- Requires transaction and wallet signature
- Costs gas fees
- Modifies contract state
- Used for: minting assets, creating bookings, voting
- Pattern: build transaction → sign → broadcast → wait for confirmation
- Show pending state in UI immediately
- Poll for confirmation every 3-5 seconds
- Update UI on confirmation
Contract Events: Clarity contracts can emit print events that frontends can listen to for real-time updates.
Key Events to Monitor:
asset-minted: New asset createdlisting-created: New rental listingbooking-created: New rental requestrental-started: Rental became activerental-completed: Rental finishedpayment-distributed: Revenue sent to ownersreputation-updated: User score changedproposal-created: New governance voteclaim-filed: Insurance claim submitted
Listening Strategy:
- Subscribe to WebSocket connection with Stacks node
- Filter events by contract address
- Parse event data from print statements
- Update frontend state reactively
- Show toast notifications for important events
- Refresh relevant queries in TanStack Query
Polling Fallback:
- WebSocket may not always be available
- Implement polling as fallback (every 10-30 seconds)
- Poll specific read-only functions for critical data
- More frequent polling for time-sensitive operations
Purpose: Enforce safety constraints on transactions to prevent unexpected outcomes.
Common Post Conditions:
**STX