A very common word in the blockchain space is "trustless". We identified that for cryptocurrency to further reach mass adoption, there must be tools that will further promote transactions between individuals who do not necessarily have to trust each other. We developed DEXCROWS as a scalable, autonomous escrows creation ethereum dApp that enables users to exchange their ethereum for bitcoin using chainlink oracle to verify transaction data. Escrow contract is specific to the transaction being made, it is deployed only after both parties agree to its terms and the service charge is paid after finalizing the escrow.
We believe the functionality can be extended in many ways to further promote usability of cryptocurrency.
What it does
Dexcrows facilitates the exchange of ethereum for bitcoin by generating unique escrow smart contracts with details specific to the transaction agreed to by the two parties involved.
How we built it
The Client The web client is built with NextJS and styled with tailwindcss. It provides an interface for users to connect their metamask wallet and create or join a transaction using a sessionID which is generated upon initialization of a new escrow. It also provides dynamic feedback on the state of the escrow to both parties at different stages from initialization to deployment.
The Backend Escrow transaction information is exchanged between peers using firebase realtime DB. At its core, Dexcrows has two smart contracts - the factory and escrow contracts. The factory takes all the necessary information that is required to create a new escrow from the peers (ethereum addresses of both parties, locktime, amount of bitcoin expected, bitcoin address expected to be funded) and through the use of the new ethereum create2 method, creates an escrow address specific to the terms of that transaction. It is also in charge of providing the escrow contract the needed chainlink token to make oracle calls. The factory replicates this action for individual escrows being created with Dexcrows thereby securing users' data and promoting transactional reliability. Everything at this point occurs off-chain.
The escrow contract is deployed at the convenience of either parties involved. This keeps interaction with the blockchain to barest minimum and cheap since deployment to the blockchain is the only time gas is required. When deployed, the chainlink oracle queries the balance of the BTC address attached to the contract and if it contains expected amount, transfers the escrowed ethereum fund to the the desired party. If the lock time specified in the contract is exceeded and the BTC address is not funded as expected, the initiator of the escrow gets refunded.
The application is deployed on IPFS and owns the dexcrows.eth domain name which is resolving to https://dexcrows.eth.link
Challenges we ran into
The implementation of p2p communication between peers involved in the transaction. We tried out webrtc which works fine on local networks but requires a centralized turn server for peers on different networks. The team settled for Google's firebase realtime DB for the purpose of simplicity.
Accomplishments that we are proud of
The dexcrow team is proud to have successfully built an autonomous escrow service. Dexcrows has a personal and business use-cases and has its own revenue generating model.
What's next for Dexcrows
The team will explore making Dexcrows more decentralized by making it fully p2p. We want to achieve this by replacing the firebase realtime DB with a much better solution or technology that is based on blockchain. We look forward to getting Dexcrows audited and deployed to ethereum main. We will also extend the functionality to enable exchange of other digital assets. This will hopefully make Dexcrows a go-to solution for trustless digital assets exchange and business integration in the future.
What we learned
The team learned about decentralized and peer to peer communication, some of the limitations of webrtc and importantly, application of chainlink oracle to solve real life solution.