This content originally appeared on Level Up Coding - Medium and was authored by Vitalii Shevchuk
đ„ Building HOA DAO application with Web 3 Stack: NextJs, ChakraUI, and Thirdweb
You will finally understand what DAO is and will be able to build web 3Â yourself
Content
- What you will learn?
- Glossary
- Intro
- Proof of Concept
- Creating your own cryptocurrency
- Building your DAO smart contract
- Coding the HOA DAO web 3 application
- Github Link
- Conclusion
- Learn More
What you will learn?
- How to create your own cryptocurrency;
- How to build your DAO web 3 application powered with your cryptocurrency;
- How to build Jamstack application using NextJs;
- How easy to create layouts without CSS using ChakraUI;
Join Medium with my referral link - Vitalii Shevchuk
Glossary
- HOAâââis the Homeowners Association. In other words, the group of homeowners took responsibility for managing the community. They provide the restrictions and rules in the community and own the budget to address community needs.
- DAOâââDecentralized Autonomous Organization. The blockchain application automates decisions through the consensus between participants. Usually owns the treasury in cryptocurrency value.
- NextJsâââThe js framework that allows you to build server-side rendering and static web applications using React.
- ChakraUIâââcomponent library gives you the building blocks for constructing React applications.
- ThirdwebâââSDK for building smart contracts, has plenty of ready-to-use contracts like NFT collections, tokens, and of course DAO.
Intro
Recently I have received a notification from my HOA:
Your monthly HOA payment was increased 20$ to cover the community project needs
My heart was broken đ because of multiple reasons:
- I have no idea what exactly the projects we have;
- There is no transparency on the budget and how it is split among the projects;
- And I was not even asked if I am ok with that;
- But the most horrible reason is 20$ more, it is minus 240$ a year, or 24000$ in 100 years, that is a lot. Especially when you plan to live long đ€·ââïž.
Of course, you can be more active, join the board and discuss the proposals and decisions. Sure, it may work, but there is still a lack of transparency, as money is charged from all the homeowners. As a result, all of them have to participate in decision-making, or even in making proposals, in a pure democracy.
Wait a minute, there is such a thing as DAO. The Decentralized Autonomous Organization has:
- Treasury with crypto;
- The consensus decision-making process with the ability to set a vote value (which could be higher for board participants);
- Everyone can make a proposal;
- If the proposal is accepted the funding can be allocated automatically through the blockchain transaction;
Proof of Concept
I have dived deep to discover the possibilities and features that our HOA DAO has to have, letâs list a couple of them:
- Everyone should be able to create a proposal;
- A proposal has to have an expiration date;
- There will be 3 votes types: For, Against, and Abstained;
- After voting, the user can not vote using the same wallet id;
- If consensus is archived, the proposal can be executed automatically;
Letâs take a look at how the final product will look like:
Letâs start to build this beauty đ§
Creating your own cryptocurrency
If you haven't set up your metamask, do it first. We will use the Rinkeby test network, so don't forget to get some faucet (test ETH).
Letâs get some money đ°
Would be so cool if you could make real money in the same way.
Now, letâs go to the thirdweb and deploy our first contractâââwhich will be the governance token. It is simply a cryptocurrency that participants will use to manage our HOA DAO treasury (budget), and it will be used for voting. Go to the dashboard and click deploy new contract.
Find the contract named token, and hit Deploy now button
Now letâs tune some settings
- Name and SymbolâââHOA_COIN
- Description: This is a governance coin for HOAÂ Dao
- Network: Rinkeby
Now pull the trigger and click Deploy
Our HOA_COIN was created
And we can Mint our first crypto, letâs start with 1000Â đ
Congrats đ we are rich now, and we can even see our crypto in metamask wallet. Click on import token:
Here we need to paste the HOA_COIN token address, we can copy it from the contract settings:
Cool, magic happens and we can see the amount of our cryptocurrency in our wallet
We wrapped up the cryptocurrency and own some assets now. In the next step, we will launch our DAO project and use the coin as the currency of the web 3 application.
Building your DAO smart contract
We have some virtual money now, it is the time to spend them a bit. We are going to create the HOA DAO where we will manage our HOA_COINÂ budget.
Letâs open the third web dashboard again and create a vote contract. ClickCreate new contract
And Deploy Now
In order to proceed with vote contract creation, we need to copy the token contract address. You can find it when you open the Code tab
Now letâs make some settings in our vote contract:
- Name: HOAÂ DAO;
- Description: The DAO of your HOA;
- Governance token address: (the address of the token contract);
- Network Rinkeby (Ethereum test network);
- Voting periodâââ6570. How long do members have to vote on a proposal when itâs created? We will set it to 1 day = 6570Â blocks
- Voting Delayâââ0. After a proposal is created, when can members start voting? For now, we set this to 0âââimmediately.
- Voting Quorumâââ0. The minimum % of the total supply that needs to vote for the proposal to be valid after the time for the proposal has ended.
- Proposal token thresholdâââ1. Whatâs the minimum # of tokens a user needs to be allowed to create a proposal? If set it to 0. Meaning no tokens are required for a user to be allowed to create a proposal.
Sweet we created our HOA DAO, and in the next step, we will start to code our web 3 application.
Coding the HOA DAO web 3 application
We are at the most interesting part of development now. Here we start to build the application using NextJs, React, and ChakraUI. First, we are setting up the project.
yarn create next-app --typescript
>What is your project named? next-hoa-dao
Then letâs add a couple of dependencies
yarn add @thirdweb-dev/react @thirdweb-dev/sdk ethers @chakra-ui/react @emotion/react@^11 @emotion/styled@^11 framer-motion@^6 react-icons
It includes Thirdweb SDK and ChakraUI packages.
Alright, coding time, letâs go đ
We can start with creating 2 config files that will store our constants, including contract addresses
next-hoa-dao-app/pages/config/constants.ts
/Users/vitaliishevchuk/Documents/projects/next-hoa-dao-app/pages/config/contracts.ts
Looks good, next we start to work on our components
next-hoa-dao-app/pages/_app.tsx
We don't have MainLayout yet, letâs create components folder and set it up there:
next-hoa-dao-app/pages/components/MainLayout.tsx
We still missing CreateProposalButton and ConnectMetamaskButton, letâs create it:
next-hoa-dao-app/pages/components/CreateProposalButton.tsx
next-hoa-dao-app/pages/components/ConnectMetamaskButton.tsx
The next we need to work on is our proposals component, which we will call it ProposalList.
next-hoa-dao-app/pages/components/ProposalList.tsx
And finally, our main page, which is located here
next-hoa-dao-app/pages/index.tsx
That is pretty much it, you are a hero if you went through the tutorial and reached this point. You can download and play with the project yourself with the Github link below:
Github Link
GitHub - Vitashev/next-hoa-dao-app
Conclusion
Hope it was not too overwhelming. The key takeaway here is that blockchain could be used in decision making process which enrich management and democracy. And you learned about the tools that will help you to build your own autonomous organization. If you want to give a credit to the efforts that were spent on this tutorial, share some love â€ïž with the clapđ and follow me for the future content.
Get an email whenever Vitalii Shevchuk publishes.
Learn More
- đ„ș Building the NFT Instagram app with React and Thirdweb
- Top Web3 Architecture Layers Explained: Frontend, Backend, and Data
- đ„ Top 18 Web 3.0 Trends Every Frontend Developer Has to Follow in 2022
Building HOA DAO application with Web 3 Stack: NextJs, ChakraUI, and Thirdweb was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Level Up Coding - Medium and was authored by Vitalii Shevchuk
Vitalii Shevchuk | Sciencx (2022-06-05T12:36:47+00:00) Building HOA DAO application with Web 3 Stack: NextJs, ChakraUI, and Thirdweb. Retrieved from https://www.scien.cx/2022/06/05/building-hoa-dao-application-with-web-3-stack-nextjs-chakraui-and-thirdweb/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.