Inspiration
I attended a course on how to create smart contracts with Clarity and wanted to create one that was usable and combined some of the ideas I learned in the course. I used the following two examples as inspiration:
https://book.clarity-lang.org/ch08-03-multi-signature-vault.html
https://docs.hiro.so/example-apps/billboard
What it does
It allows certain wallet addresses, which in this case are city officials, to update a message on a smart contract in emergency situations. Ideally, residents of that city would have some sort of client-side app or device that would check for updated messages and alert users if there is an emergency. Since this message was published to a smart contract by trusted wallet addresses, users can be confident in knowing that the emergency message is authentic since the contract also requires more than one trusted address to approve the message.
Since this contract is not meant to be deployed on the mainnet, I left a lot of comments in the actual contract explaining in detail what each line or function does.
How to run
- Go to this link in order to get instructions on how to install all the necessary tools.
- Once all the tools have been installed, navigate to the root directory of this project and type clarinet console in the command line.
- You can open the sample_clarinet_console_commands.txt file and copy and paste commands one by one to test the functionality.
How I built it
Using the Clarity smart contract language and the Clarinet Console REPL to test.
Challenges I ran into
Clarity is a new language so there are not a lot of learning resources or examples available. For example, I wanted to create a frontend to display the message but had trouble running a local devnet node. Since I was not familiar with the typescript testing library, I was not able to implement the unit tests and had to test manually using the clarinet console command and the REPL. Also, I had never programmed in a LISP like language before I attended the course so the syntax took some getting used to.
Accomplishments that we're proud of
This was my first hackathon and I am proud I was able to submit something that works, especially in a language that is not the most beginner friendly.
What I learned
I learned a new programming language to create smart contracts as well as the potential for the Stacks and City Coins projects.
What's next for Emergency Message Clarity Smart Contract
Implement a frontend that can display messages as well as another interface that allows trusted addresses to create and approve new messages. Also, implement the typescript tests.
Log in or sign up for Devpost to join the conversation.