A decentralized platform built on the Stacks blockchain for registering, managing, and reviewing commercial enterprises. This smart contract enables transparent business registration with built-in reputation management through customer feedback.
The Commercial Registry allows entrepreneurs to register their businesses on-chain, customers to leave verified reviews, and administrators to certify legitimate entities. All data is stored immutably on the blockchain, ensuring transparency and trust.
- Entity Registration: Register commercial entities with comprehensive details (name, description, sector, contact info)
- Profile Management: Update entity information at any time
- Status Control: Activate or deactivate entities as needed
- Ownership Transfer: Transfer entity ownership to another principal
- Feedback System: Submit ratings (1-5 stars) and reviews for entities
- One Review Per Entity: Each user can only review an entity once
- Public Ratings: All reviews are permanently recorded on-chain
- Entity Certification: Verify legitimate businesses
- Fee Management: Adjust registration fees (capped at 100 STX)
- Quality Control: Revoke certifications when necessary
- Admin: Contract deployer (immutable)
- Registration Fee: 1 STX (adjustable by admin)
- Maximum Fee: 100 STX hard cap
| Code | Constant | Description |
|---|---|---|
| u100 | err-admin-only | Only admin can perform this action |
| u101 | err-not-found | Entity or feedback not found |
| u102 | err-already-exists | User has already reviewed this entity |
| u103 | err-unauthorized | Caller is not the entity owner |
| u104 | err-invalid-score | Rating must be between 1-5 |
| u105 | err-entity-inactive | Entity is not operational |
| u106 | err-invalid-input | Invalid input parameters |
| u107 | err-invalid-fee | Invalid fee amount |
Register a new commercial entity on the platform.
Parameters:
title(string-ascii 100): Entity namedetails(string-ascii 500): Business descriptionsector(string-ascii 50): Business category/industryaddress(string-ascii 200): Physical locationphone(string-ascii 100): Contact numberurl(string-ascii 200): Website URL
Returns: Entity ID (uint)
Fee: Current registration fee in STX
Update entity information (owner only).
Parameters:
entity-id(uint): ID of entity to updatetitle,details,address,phone,url: New values
Requirements: Must be entity owner and entity must be operational
Activate or deactivate an entity (owner only).
Parameters:
entity-id(uint): Entity to toggle
Leave a review for an entity.
Parameters:
entity-id(uint): Entity being reviewedscore(uint): Rating from 1-5message(string-ascii 500): Review text
Requirements:
- Entity must be operational
- User hasn't reviewed this entity before
- Score must be 1-5
Mark an entity as verified (admin only).
Parameters:
entity-id(uint): Entity to certify
Remove verification status (admin only).
Parameters:
entity-id(uint): Entity to decertify
Change the registration fee (admin only).
Parameters:
new-fee(uint): New fee in microSTX
Constraints: Must be > 0 and ≤ 100 STX
Transfer entity ownership to another user.
Parameters:
entity-id(uint): Entity to transfernew-proprietor(principal): New owner address
fetch-entity: Get entity details by IDfetch-feedback: Get feedback details by IDfetch-entity-score: Calculate average rating for an entityfetch-entities-by-proprietor: List all entities owned by a principalfetch-entities-by-sector: List all entities in a specific sectorcheck-certification: Check if an entity is verifiedfetch-registration-fee: Get current registration feefetch-entity-counter: Get total number of registered entitiescheck-customer-feedback: Check if a user has reviewed an entity
{
proprietor: principal,
title: (string-ascii 100),
details: (string-ascii 500),
sector: (string-ascii 50),
address: (string-ascii 200),
phone: (string-ascii 100),
url: (string-ascii 200),
operational: bool,
score-total: uint,
score-count: uint,
registered-at: uint
}{
entity-id: uint,
author: principal,
score: uint,
message: (string-ascii 500),
posted-at: uint
};; Register a new business
(contract-call? .commercial-registry enroll-entity
"Mike's Coffee Shop"
"Artisanal coffee and fresh pastries in downtown"
"Food & Beverage"
"123 Main Street, Lagos"
"+234-123-4567"
"https://mikescoffee.com"
)
;; Submit a review
(contract-call? .commercial-registry submit-feedback
u1 ;; entity-id
u5 ;; 5-star rating
"Amazing coffee and friendly service!"
)
;; Check entity rating
(contract-call? .commercial-registry fetch-entity-score u1)- All monetary transactions are handled through native STX transfers
- Entity ownership is verified for all update operations
- Reviews are immutable once submitted
- Admin privileges are limited to certification and fee management
- Input validation prevents empty or oversized strings
- One review per user per entity prevents spam
- Deploy the contract to Stacks blockchain
- The deploying address becomes the admin
- Initial registration fee is set to 1 STX
- Users can immediately start registering entities