Inspiration

A bit of background

I would like to tell you a little about my journey, but please feel free to skip this section!

I found out about blockchain technologies back in December 2021, right in my last academic year. I spent a lot of time reading, to actually understand what it is, and took a keen interest in web development as well. As I was a student in Music Production, I took this as an opportunity to redefine the scope of my research paper, and wrote about immersive audio in virtual worlds, and how it could be included in a future metaverse. This was an even greater opportunity to try myself at web development, as I decided to build a web-based virtual world in which I could integrate 3D Audio, to demonstrate how powerful it could be in the "metaverse". I was halted after a month, when my lack of JavaScript knowledge became too much of a problem. But let's move on a little more quickly, as it is not about making my own biography.

I decided to take a full-stack JavaScript curriculum, to be able to actually achieve building that virtual space. In addition, I felt it was essential to first learn about web development, before diving into blockchain development. Getting into this new environment was an incredible breakthrough for me, as I had - and have - never been so passionate and confident about anything

Fast-forward to the end of September, after being done with the curriculum, completing my research paper and starting to do anything with my newfound skills, now that I had some time. Finally, I got to really dive into blockchain, beginning with Patrick Collins' 32 hours course. I won't go overboard with compliments, but I'll just say it was an absolute delight following it, and learning about Solidity, Hardhat, and all kind of really decentralized technologies. One month later, I completed the course, right the day the hackathon started.

I think you can appreciate how thrilling it was for me to build this application, as it is my first personal project, and a way to practice everything I've learned in the past few months.

Promise

Being involved with blockchain technologies inevitably involves keeping a watchful eye on NFTs. And so, it implies helplessly witnessing the frequent schemes, disappointments, promising projects that run away with the users' funds...

I thought I could try to build an application that addresses this challenge, at least to some extent, especially since it requires exactly what blockchain and decentralization have to offer. Also, because of my own convictions, as well as a result of taking Patrick Collins' course, I have become obsessed with trust-minimized agreements and true decentralized applications.

This is how I came up with this application. I attempted to stick to these standards as much as possible, although you will see that it is not always fully in line with these standards. I hope you will enjoy it as much as I did, and that it will be a good starting point for a more ambitious project.

What it does

It is an end-to-end decentralized application, that allows users to create, manage and explore promises, as well as to involve other users in them (Learn more). As a self functioning component, but also an essential aspect of promises, users can verify that they own a Twitter account, and associate it to their Ethereum address, in a completely non-intrusive way (Learn more).

Each action is recorded on the blockchain, and files attached to a promise are stored both on IPFS and (optionally) Arweave. This is done in a way that the application can reliably assess whether the integrity and persistence of the files can be guaranteed, which is true when the promise was created using the application (Learn more). This is achieved through the use of a Chainlink Node and External Adapters.

Essentially, the purpose of a promise can be abstracted from two perspectives:

  • A founder can associate a promise to a project, supporting it with any relevant files (roadmap, letter of intent, white paper...) and invite other users to join it. They can:

    • approve the promise (meaning verifying their address, and approving its content & other participants) ;
    • verify their Twitter account associated with that address ;
    • lock the promise once it is approved by everyone involved, to make it immutable.
  • A "regular" user can explore promises and verified Twitter accounts, and learn about:

    • projects shaped as promises, along with the addresses and Twitter accounts of their founders, knowing whether they have been verified or not, and the materials supporting the initiative, being confident of their integrity and permanence ;
    • Twitter accounts associated with Ethereum addresses, in a transparent and verifiable way.

In everything gravitating around blockchain, among other things, Twitter has become a corporate medium, used for business and marketing. A Twitter account, as well as an Ethereum address, can be crucial to the reputation of a person, a brand, a community, a product or a service.

By putting them at stake in a promise, in a transparent and verifiable process, it might provide a lucid picture, and an uncensorable record, of the reliability of a person or a group - or at least, of their willingness to be held accountable for their actions.

How I built it

Contracts

The contracts are written in Solidity, and are compiled, tested and deployed using Hardhat. The tests are written using Mocha and Chai. The core contracts are:

  • PromiseFactory.sol, which is the main contract, and is responsible, among others, for creating and managing promises ;
  • PromiseContract.sol, which is the contract that represents a promise, and is responsible for managing its state, and for storing the data attached to it ;
  • VerifyTwitter.sol, which is the contract that is responsible for verifying Twitter accounts, and for storing the data associated with them. It is an implementation of the ChainlinkClient contract, and is used to make requests to the External Adapter.
  • VerifyStorage.sol, which is the contract that is responsible for verifying the integrity the IPFS and Arweave hashes that were provided in the promise creation parameters. It is an implementation of the ChainlinkClient contract, and is used to make requests to the External Adapter.

Solidity JavaScript Hardhat Chainlink Chai

Storage

The files attached to a promise are sent to IPFS, using the Web3 Storage client. The service also takes the responsability of securing deals through the Filecoin network (Learn more).

The user can also choose to send the files permanently to Arweave, using Bundlr, which is a Layer 2 on Arweave (Learn more).

IPFS Web3Storage Filecoin Arweave Bundlr

Infrastructure

The contracts are deployed on Polygon Mumbai, and their events are caught by a subgraph on The Graph, then queried by the application using the Apollo Client. The External Adapters are hosted as serverless functions on AWS Lambda, and are leveraging Node.js and Express to handle requests.

Polygon TheGraph ApolloGraphQL AWS NodeJS Express

Interaction with contracts

The interactions with the contracts are done through Wagmi and Ethers.js, and the wallet connection is handled by Rainbowkit. All requests to the blockchain are made through a Quicknode RPC.

Rainbow Wagmi EthersJS Quicknode

Frontend

The UI is built using React and Next.js. Multiple components are based on Ant Design customizations.

NextJS Antd

Challenges I ran into

The most challenging task, which made me struggle for many long days, was to learn everything about Chainlink Nodes, External Adapters, oracles and operators, and to implement them in the project.

I honestly thought at first that it would be too overwhelming for me, and that I needed to find another approach. A couple of times I started to read the documentation, watch some videos, then gave up after a few hours.

At some point, I decided to give it a real try, thinking that it was really worth it, even if it meant "wasting" a few days on it. I watched a video explaining how to set up a Node on Google Cloud Platform, struggled to make it work, and again for the External Adapter, then for the function, all from the same platform. I did not want to do it locally because I wanted everything to be available and testable quickly, and I suppose that ultimately I enjoy this kind of challenge.

After I understood my free credit would run out before my project could get a change to be judged, I moved the Node to NaaS.link, which doesn't need any setup, and is free to use. I also moved the External Adapter to AWS Lambda, which is also free for this amount of traffic. I'm glad I started with GCP though because it helped me understand the concepts better, and forced me to learn using - and struggling with - Docker.

Patrick Collins' course taught me everything I needed to further explore with Hardhat, the subgraph on The Graph, and the Chainlink VRF section gave me enough knowledge to understand how to actually leverage Chainlink in my project.

It was sometimes tricky to test the contracts, especially when many of them were interacting with each other. It also took me some time to create mocks for the Chainlink implementations, getting familiar with the process, writing staging tests that listen to events from multiple contracts... I'm sure there are way better optimized ways to do it, but ultimately, I was able to get a 100% coverage, without restricting my needs or my creativity.

Accomplishments that I'm proud of

It's tough to say precisely while still in the heat, but stepping back over the last few days, I really felt like I did a good job. I still have plenty of ideas to implement - one more occurred as I was writing this (long) project story - but I'm happy with what I've done so far. I think I've been able to create something interesting and actually useful, and I hope it can become a real tool for people to use.

I have never been as confident in my life as in this life/career shift, but to be able to progress so much in such a short period of time, while having so much pleasure, makes me very excited about the future.

What I learned

I believe I went a bit overboard with the other sections regarding what I've learned. I'm not sure if I can even list everything here, since almost everything I've done was new to me.

I learned how to:

  • build a Full-Stack decentralized and trust-minimized (at least to some extent) application ;
  • deploy interoperable smart contracts, using Chainlink oracles, nodes and external adapters ;
  • leverage IPFS and Arweave to provide a robust and reliable distributed storage solution ;

I found that I could create an application that might prove helpful to the community and the ecosystem.

I also learned a lot about myself, how I work and what I can achieve, and I'm really happy with the results.

What's next for Promise

There are many more steps for Promise - which will be expanded shortly on another branch of the GitHub repository - before going mainnet. To name a couple of them:

  • short-term improvements:
    • create Chainlink Automations & an External Adapters to:
    • automatically verify promises contracts, provided their constructor arguments ;
    • perform the storage hashes verification after the contract is created, so it can be requested again if it fails ;
  • refator the structure so it can be based on upgradable contracts ;
  • deploy on other chains (e.g. Arbitrum) ;
  • add other verification methods (e.g. Lens) ;
  • allow versioning of promises ;
  • implement a relay system to take care of the gas fees ;
  • issue tokens to reputable actors, so they can report on promises ;
  • and more ideas to make it more interactive and collaborative...

Final thoughts

I'm deeply grateful for this opportunity, as the deadline and rules kept me focused on delivering a finished product.

Once again, a sincere thank you to Patrick Collins, should he ever read this. I've been passionate about this for months, but he's done a lot to fuel that enthusiasm - merely by sharing his passion, his expertise, and his beliefs, all of which are reflected in a truly outstanding educational approach.

I hope this was not too long, I tried to make it worth your time, and I had much to say. I hope you found it interesting, and you'll enjoy using Promise as much as I enjoyed building it.

Built With

Share this project:

Updates