The Problem I Hit Building Glamora
I’m building Glamora, a decentralized fashion marketplace on Stacks that uses sBTC for payments. While writing the smart contracts, I had to implement security patterns from scratch.
Access control for admin functions? Wrote it myself across three contracts.
Input validation for every user action. Wrote it myself.
Authorization checks? Wrote it myself.
Then I realized every Clarity developer is doing this same work.
We all write our own access control. We all write our own input validation. We all write our own authorization logic. And some of us get it wrong.
This creates problems:
- Duplicated work - Everyone writes the same security code over and over
- Inconsistent security - My access control implementation isn’t the same as yours
- More bugs - Custom security code = more surface area for vulnerabilities
- Steeper learning curve - New devs need to understand security before they can build anything
- Expensive audits - Auditors review the same basic patterns in every contract instead of focusing on business logic
What I’m Proposing
Create standardized security traits for Clarity the same way SIP-009 standardized NFTs and SIP-010 standardized tokens.
Here’s What It Looks Like
Today (what I actually wrote for Glamora):
;; From my glamora-nft.clar contract - access control I had to write myself
(define-data-var authorized-caller principal tx-sender)
(define-data-var admin principal tx-sender)
(define-public (set-authorized-caller (new-caller principal))
(begin
;; Manual authorization check I wrote
(asserts! (is-eq tx-sender (var-get admin)) ERR-NOT-AUTHORIZED)
(var-set authorized-caller new-caller)
(ok true)
)
)
(define-public (create-fashion-collection ...)
(begin
;; Authorization check I have to write in every function
(asserts! (is-eq contract-caller (var-get authorized-caller)) ERR-NOT-AUTHORIZED)
;; ... rest of function
)
)
What I want (standardized trait):
;; Just implement the standard
(impl-trait .sip-security.ownable)
(define-public (create-fashion-collection ...)
(begin
;; Security handled by the trait
(try! (assert-owner))
;; I just write my marketplace logic
)
)
Same security, less code, already audited.
Which Security Patterns Matter
From my experience building Glamora (and planning for mainnet launch):
1. Access Control
I implemented this across glamora-nft.clar, storage.clar, and main.clar. Every contract has owner/admin checks. Almost every production contract needs “only the owner can call this function” but we all write it differently.
2. Input Validation
I validate tip amounts, collection sizes, category numbers, listing prices throughout Glamora. Each validation is custom-written. Everyone writing (asserts! (>= amount MIN-AMOUNT) ERR-INVALID-INPUT) in slightly different ways.
3. Pausable Contracts
Emergency stop mechanism. If something breaks in production, I need to pause operations. Right now, I’d have to redeploy everything. Any contract handling real money needs this.
4. Reentrancy Guards
Prevent functions from being called before they finish executing. I’m not sure if Clarity’s design already prevents this (maybe someone can clarify?), but every Solidity DeFi protocol has reentrancy guards. If Clarity needs them, they should be standardized.
5. Rate Limiting
Stop spam. Right now, nothing prevents someone from calling my mint function repeatedly in one transaction. As Glamora scales, I’ll need rate limiting on minting, tipping, and marketplace operations.
Why these 5? Because they’re not optional for production contracts handling real value. Every project building toward mainnet will need them.
Why Solidity Already Solved This (OpenZeppelin)
Professional Solidity developers stopped writing security primitives from scratch years ago. They use OpenZeppelin the library powering nearly every onchain application on Ethereum.
What OpenZeppelin does:
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyContract is ReentrancyGuard, Ownable {
function withdraw() public onlyOwner nonReentrant {
// Security handled by OpenZeppelin
}
}
Why it works:
- 26,888 GitHub stars one of the most-used Solidity libraries
- Used by major protocols (Coinbase, Uniswap, Aave, etc.)
- Handles billions of dollars in smart contracts
- Audited by security experts, not individual developers
- Industry publications call it “the gold standard of Solidity contracts”
The result: Every serious developer leans on OpenZeppelin instead of rolling their own security code.
Clarity should have the same thing.
We Already Have the Foundation
Clarity already does this for tokens and NFTs:
- SIP-009 - NFT trait standard (everyone implements this)
- SIP-010 - Fungible token standard (everyone implements this)
These work. Contracts that implement SIP-009 are composable. Wallets know how to interact with them. It’s the right pattern.
Security traits are the next logical step.
Instead of:
(impl-trait .sip-009-nft-trait.nft-trait)
We’d also have:
(impl-trait .sip-security.ownable)
(impl-trait .sip-security.pausable)
Same pattern. Same benefits.
What This Actually Fixes
For developers like me:
- Stop writing the same security code in every contract
- Build faster (import security, write business logic)
- Ship with more confidence (traits are audited, my custom code might not be)
For auditors:
- See
(impl-trait .sip-security.ownable)and move on - Spend time on actual business logic vulnerabilities
- Cheaper, faster audits
For the ecosystem:
- Fewer bugs (everyone uses the same vetted implementation)
- Better composability (contracts using the same security traits work together cleanly)
- Easier onboarding (new devs don’t need to be security experts to build safely)
What I’m Not Sure About
I’ve been building on Clarity for 2 years, but I’m still learning. Here’s what I don’t know:
-
Does Clarity’s design already prevent some of these issues? Maybe reentrancy isn’t as dangerous in Clarity as it is in Solidity? I’d love to hear from folks who know the language internals better than me.
-
Should these be separate SIPs or one umbrella proposal? Like “SIP-XXX: Security Traits” with multiple sub-traits?
-
Who would maintain the reference implementations? Community? Hiro? Stacks Foundation?
-
What am I missing? Is there a reason this hasn’t been done yet that I’m not seeing?
Real questions. I’m posting this to learn as much as to propose.
Why I’m Posting This
I’m building Glamora, a fashion marketplace on Stacks with sBTC payments. I’m a Stacks Ascent member and contributed to AMM security research through LearnWeb3’s Stacks Course 2.
When I needed access control and input validation for Glamora, I wrote them myself and hoped I didn’t mess up. As I iterate toward mainnet, I’ll need to add pausable contracts and rate limiting - and I’ll write those from scratch too.
If I’m doing this, other builders are too. And if we’re all writing our own versions, we’re all introducing different bugs.
This feels like something that should already exist.
I’m not trying to dictate how this should work I’m asking if the community thinks this is worth building. If yes, I’m happy to help make it happen.
Timothy Chimbiv
Building from Jos, Nigeria ![]()
Project: https://glamora-gold.vercel.app
GitHub: Terese678 (Timothy Terese Chimbiv) · GitHub
X: https://x.com/ter_chimbiv