Building a blockchain trading platform: Case study

Start talking derivatives trading with the uninitiated and you’re likely to get blank stares and stifled yawns. The financial instruments have traditionally been the territory of large institutional investors far removed from everyday people. This relatively uninclusive environment is what drove CloseCross founder Vaibhav Kadikar to create a fully decentralized blockchain trading platform.

Together with the in-house CloseCross dev team, Espeo Blockchain rose to the challenge of bringing Kadikar’s idea into reality. Several key objectives for the blockchain trading platform posed unique challenges. Few other blockchain financial use cases offered a model to work from. Scalability, transparency, and an attractive landing page each required tailor-made solutions. We played a key role in designing the blockchain architecture and supported Kadikar in his goal. We’d like to share some of the how and why from the innovative project.

Derivatives?

A derivative is a financial instrument with a value derived from an underlying asset — most commonly one with some volatility. Currencies, oil, stocks, bonds, and interest rates are common underlying assets. A little over a year ago, some large exchanges such as the Chicago Mercantile Exchange began offering bitcoin futures, igniting interest in the wider investment community

The Money Project estimates the value of the derivatives market is between $544 billion and $1.2 quadrillion. Kadikar believes there is a considerable market niche for investment dApps in this space.

In a derivatives contract, two or more parties predict the price of a commodity at the end of a specified term. These terms can be a few hours or can last up to several years depending on the agreement.

Historically, derivatives allowed companies to manage fluctuating exchange rates between currencies in cross-border trade. Today, investors can make predictions on all sorts of assets in derivatives contracts. However, most investors must trade through large, centralized exchanges. Many blockchain financial use cases are largely hypothetical still as the technology continues to develop and grab the attention of business leaders. However, our team aided the CloseCross blockchain trading platform in overcoming significant technological hurdles. 

CloseCross objectives

During the initial development talks, Kadikar expressed that trading in large centralized institutions is not inclusive. Significant barriers to entry exist which he believes blockchain technology can help address. Like many blockchain projects, objectives for the project included specific features designed to address the legacy industry’s flaws.  Transparency and verifiable fairness were among them.

First, the platform had to be decentralized to avoid any single point of failure. Without a central authority, no single entity should have access to user funds. CloseCross would provide the technical infrastructure to run the blockchain trading platform, but the platform itself should remain provably fair through strong cryptographic guarantees. 

Additionally, to increase transparency users had to see how other investors on the platform behave in real time during the trading period. This feature, in theory, would help users make informed decisions before making a prediction. Unlike other blockchain financial use cases, CloseCross adds in a feature so that users can see how other users are behaving in real time.

Finally, the blockchain trading platform had to be user-friendly and intuitive. Users who may not have the experience or deep knowledge of derivatives trading should be able to casually pick up their device and learn it quickly. One of the challenges here was how to simultaneously provide users with a responsive user experience while also recording all the transactions on the blockchain with Ethereum smart contracts. Blockchain financial use cases rely on blockchain’s immutability but must also remain responsive to users.

Designing a straightforward, viable blockchain-based trading app for the everyday investor was our mission.

How does it all work?

One of the first challenges to overcome in designing a blockchain trading platform was scalability. Ethereum is not particularly efficient at processing transactions. Technology lead for the project, Krzysztof Wędrowicz, recalls the early challenges he and the team had to tackle first.

“When we’re talking about [Ethereum’s efficiency], we’re talking about fifteen transactions per second maximum. That’s the whole network. Not just your small part. This was too few… to create a real-time trading app.”

Scalability

Kadikar envisions over 50,000 active users per day with manifold trades — too many for a standard Ethereum blockchain to handle efficiently. When we look at other blockchain financial use cases, scalability is one of the main factors limiting adoption. Espeo’s developers together with the CloseCross team, however, began working on an inventive solution to deliver a fundamentally novel and functional platform. Wędrowicz explained some of the novel innovations:

“We designed and implemented a protocol based on the state channel concept which gives us the possibility to exchange a receipt between the backend and which acts on the owner’s site and the users’ devices. These receipts are signed by both sides with their cryptographic keys.”

State Channels

Off-chain transactions save time and slash the cost while still ensuring the security and immutable cryptographic guarantees of blockchain tech. Let’s say a user makes one thousand predictions on the platform. If the transactions occurred on-chain — as they do in other blockchain financial use cases — he would have to wait for each to commit a thousand transactions. Each transaction costs Ethereum gas as well. With the use of state channels, the user only pays for three transactions — one for transferring money to a smart contract, committing the last receipt of successful predictions, and finally a transaction to unlock the funds.

According to Wędrowicz, the team had to build many things from the ground up. He said one of the most challenging things was to be a pioneer in this regard:

This project is not a copy of something. It’s not something we had done before. When we started developing… the concept of state channels was very new and there were not many reference implementations exactly for our objective. So we had to design and implement our own. [State channels] fit our problem so we decided to go in this way.”

Project Manager, Sylwia Rogowicz, recalled that at the beginning, the blockchain trading platform was an R&D project rather than a commercial project with a proven technology stack. There were few blockchain financial use cases to look to for inspiration. Since blockchain technology is still so new, managing a blockchain development project differs greatly from traditional software development. Rogowicz beamed:

“It was more liquid at the beginning. We checked what was possible, and what wasn’t possible. It took a while and later, it transformed into the testnet application. They launched recently at the WebSummit 2018. It proves that this kind of solution can work.”

Blockchain backend

CloseCross uses blockchain, DLT, and smart contracts together in its technology stack, as a “trust layer.” When replacing a centralized party, it is important for a dApp to ensure that it can demonstrate neutrality, by having auditable data and a clear transaction trail.

In addition to an innovative off-chain solution to address scalability, CloseCross also had to remain transparent to all the users involved. After all, it had to be verifiably decentralized to all its users. Thanks to smart contracts, CloseCross cannot manipulate data to influence investment behavior. Trades occur off chain between users. Once those transactions go through, they commit to the blockchain through transparent smart contracts. Wędrowicz explained:

“As long as users trust each other, then we can use the platform without the blockchain, but if anyone has a feeling that something is not right, he can check it without CloseCross.”

Any user can validate a transaction independently with what’s called a validator. CloseCross encourages everyone to check the data for themselves if needed.

“Validators give users the possibility to easily check what a backend produces. Let’s say as a backend, we must produce a valid output because we’re assigned what we give to the user. If there is a descrepancy, a user can take a receipt and put it in the validator which is on the blockchain and the validation based on the current information are all on the blockchain.”

CloseCross provides the technical infrastructure to run the dApp. Though the platform itself remains provably fair due to its proprietary algorithm. The company cannot influence the results in any way or even benefit from specific results. This feature sets CloseCross apart from other blockchain financial use cases. 

Intuitive UX

Kadikar expressed in an interview that complicated terms and complex calculations are some of the greatest barriers in the derivatives market.

“Unless you understand how to read a derivatives contract and calculate your break-even and ROI, you will be lost and overwhelmed.”

Espeo designers sat down with Kadikar over his pen-drawn visuals to create the straightforward UX. Since the target user for the platform is someone who might not have deep financial knowledge, the interface had to be visual and user-friendly. For us, this was one of the challenges to address.

As blockchain developers, we know that transactions can take time to complete on a blockchain. However, the everyday user may not realize that. “It’s designed to not disturb users as they trade,” said Sylwia Rogowicz. A responsive platform that allows users to trade derivatives quickly, but also commit those transactions to the blockchain was key. 

Virtual Prediciton Floor

CloseCross’ UX simplifies the prediction process through a 3-click derivatives trading platform. Users first select a Virtual Prediction Floor (VPF) for a given asset — bitcoin futures for example — then make a prediction, and commit to a price. Kadikar explained:

“This process is simple enough for any financial layman to understand and execute.”

A straightforward user experience, however, is not so straightforward for developers. The team had to provide a system which is partially in real-time and partially not. Introducing these features in the simplest, most transparent way possible was challenging for the team. “The point is to create a user interface as simple as it can be,” said Wędrowicz.

Through an innovative design and intuitive interface, CloseCross enables finance beginners to interact directly over the platform. Blockchain still provides the basis for the underlying transparency mechanism, but transactions appear to users in real time. 

Blockchain financial use cases – results

CloseCross unveiled its testnet application at the WebSummit 2018. Kadikar says the commercial launch is due to launch in the second quarter of 2019. Together with CloseCross, Espeo Blockchain has brought the patented idea into reality as a working blockchain trading platform. Unique features posed unique challenges which our team of blockchain developers successfully overcame. Scalability, transparency, and an elegant user interface all contribute to Kadikar’s innovative product. CloseCross serves one of the few successful blockchain financial use cases to date. 

CloseCross will open up the market to more people who have traditionally not had access to the market. This fulfills some of the lofty ideals of blockchain technology. Extending economic freedom through blockchain technology is a  powerful tool — one we’re pleased to have helped develop. You’re welcome to join the CloseCross Community on Telegram.