Inspiration
There are several platforms where creators - people who create designs, art, music, and so on - can sign up and earn an income. But one of the main problems with these platforms is their centralized nature. Sometimes it's difficult to sign up for a platform and be approved. Other times, it's impossible to support a creator without revealing your personal data, whether that's towards the creator, the platform's host, or payment processors.
Stacks Creator Platform was made to offer a decentralized platform where anyone can sign up to become a creator and offer products and services, and where any user can freely explore and find creators to support.
What it does
Users can sign up to the platform with their Stacks wallet and create a profile page to share with others. They can then add products to their page, edit them, or remove products they no longer offer. Other users can visit a creator's page and browse the products offered.
How we built it
The creator platform is divided into a Next.js frontend, and a Clarity backend.
Frontend
The frontend is a Next.js app using the Stacks.js library. It allows users with a Stacks wallet to connect to the app and interact with the backend through form submissions. When visiting a creator's page or the home page, the app calls read-only functions to fetch the data for the user or creator.
Backend
The backend is managed by two Clarity smart contracts, a creators-platform contract, and a creators-data-storage contract.
The creators-data-storage contract is a contract that manages all the data for the platform. It implements a trait defined in the creators-platform contract for managing users and products, and has read-only functions for fetching this data. Some of the data for creators and products are stored as a sha256 hash instead of as separate fields, which was done in order to allow changes (e.g. new fields) to the data while still keeping the data integrity. The frontend, or another client, can then check this hash against its own offchain data to verify if anything has changed.
The creators-platform contract is the privileged contract that can make data-changing calls to the storage contract. Its functions use dynamic dispatching to allow for changing the data storage contract in the future, if it ever needs to be upgraded.
Challenges we ran into
Being a beginner with Clarity, it took me most of the first half of the hackathon to learn the basics of the language, especially coming from using object-oriented languages. Figuring out what should be stored onchain and what data types to use, along with writing proper unit tests for contract functions, was very challenging.
The frontend with Stacks.js was also challenging to set up. Making contract calls with the correctly-formatted function arguments, and dealing with the (as of now) slow confirmation times for transactions meant I had to think more carefully about how to handle requests and responses from within the app.
Accomplishments that we're proud of
I'm proud to have learned how to create Clarity contracts that actually work. Clarity is a very different language than what I'm used to, so it was fun to learn. I'm also proud of learning how to do dynamic dispatches of contract calls. Since contracts are immutable, figuring out how one can upgrade a contract was a concern I had, so after I learned about traits and how to implement them, I was happy to see the app working.
What we learned
I learned the Clarity language and how to set up a frontend with Next.js and Stacks.js to interact with smart contracts. I also learned more about how to think of data design when it comes to onchain data storage, and how to write unit tests for Clarity contracts.
What's next for Stacks Creator Platform
Making buy requests for a product, accepting them, and paying out to creators are some of the key features missing in this prototype. The original data for the data hashes in the contracts are also currently not saved anywhere, so the offchain storage feature is missing too. I'd also like to add a search feature to let users look for different creators.
Stacks Wallet
SP2S5QJBSS7GRPDCPG12XW28W8G7TC99WCNR84NJY
Log in or sign up for Devpost to join the conversation.