On-chain Order Book

On-chain Order Book

This on-chain order book for Flow is a decentralized exchange allowing limit orders and market order. Trustless, quick and low-fee trading.

The problem On-chain Order Book solves

This on-chain order book for Flow is the first of its kind on the network. It's a secure and transparent platform for trading tokens, which eliminates intermediaries and provides a trustless environment for trading. This feature makes it much more secure than centralized exchanges, which are vulnerable to hacks and data breaches.

Running on the Flow network, this order book benefits from low transaction fees, which make it a cost-effective alternative to centralized exchanges. This feature is particularly useful for small investors, who may be deterred from trading due to high transaction costs.

Moreover, since there was no order book available on the Flow network before, my on-chain order book is a valuable resource for traders and investors alike. It helps to improve the liquidity of the Flow network, making it easier for traders to buy and sell tokens without relying on centralized exchanges.

Users can place limit orders and market orders, which provides them with a more informed trading experience. This feature helps users to make better trading decisions, which can potentially increase their returns.

Finally, the system is automated, which makes the trading process much more efficient and secure, as there is no room for manual errors or fraud.

Challenges I ran into

During the development of my on-chain order book for Flow, I faced several challenges.

Firstly, the project was built in Cadence, a resource-oriented programming language that is relatively new and complex. It took some time for me to become familiar with the language and its nuances.

Secondly, due to the strict type system of Cadence, I encountered several bugs related to variable types. This issue required me to carefully review the code and perform rigorous testing to ensure that everything was functioning as intended.

Finally, I faced time constraints that prevented me from implementing all of the features I wanted to include in the order book, such as multiple users putting in the same limit price and a transaction history. While these features are important, I decided to prioritize the core functionality of the order book in the limited time available.

To overcome these challenges, I sought help from the Flow community and consulted various resources to improve my understanding of Cadence. I also conducted extensive testing to identify and fix any issues related to variable types. And for the features that I couldn't implement right away, I plan to work on them in the future and improve the order book's functionality over time.