SmartDec: Digitex Futures Exchange Development Status Report #9

This is the ninth status report on the SmartDec work on the Digitex Futures exchange. The eighth report can be found here.
The launch date of the Testnet is very close and we continue to work hard.
We are waiting for the moment when the beta can be given to the first users, so they can play with it, give their suggestions, hunt for bugs, and more. Everybody is working very hard and is under high pressure, but the team keeps on pushing! The first test version is going to be quite minimalistic and may contain bugs. But that is why we need the first users, to collect feedback and start the active beta test in order to begin preparing for the Main Net. After a while, when the test net version stabilizes and third party audits are performed, the system will be ready for the Main Net.
In our previous blog post, we wrote that Adam wished to update the UI design and now we continue to integrate the new design with the back end. We have also implemented User History request into the server side. This request makes it possible to display information about trading operations in the User Interface and make a history selection for periods of time. The trader will also be able to download the trading history in .csv format.
We implemented requests that send information about users’ unmatched orders and users’ positions. Now we are working on saving information about users’ activity. User activity table will be on the “My profile” page. The table will contain information about the time and OS when the user logged in.
We also continue working on the Wallet page. We continue to implement server-side requests needed for this page to work correctly. For example, information about trader’s wallet transactions, trader’s blockchain transactions, Deposit request, and Withdraw request.
In addition to implementing back-end requests, we are working on fixing UI bugs. Here are some of the bugs that we have fixed:
- When canceling a buy order, sell orders were being canceled as well and vice versa
- We added the time until next funding
- If the last transaction does not change the last traded price, the line color with this transaction in the trade list should be the same
- Field for user input of the number of contracts in the order
- Fixed that the partially filled order cannot be canceled
In the process of stress testing, we found that the price updater gives an “Out of memory” error. It is not a critical bug, but we need to fix it.
As you know from our previous post, last week we built all the components of the exchange on Amazon Web Services. So, now we are busy with stress test using AWS.
The components Daphne and Redis are some of the legacy architecture that we received from the previous developers. Daphne is one of the implementations of ASGI (Asynchronous Server Gateway Interface). Redis is an in memory NoSQL database.
During continuous stress tests we have discovered that they can not handle the traffic. This is the new current bottleneck in the system. Right now, it is drastically limiting the throughput (up to around 500 messages per second).
We are working on removing these parts from the architecture or replacing them with different code that will not act as a bottleneck. Some approaches that could be implemented relatively quickly are:
- Replace Daphne with Uvicorn
- Add more Daphne instances
We are exploring various approaches.
We have also spent a significant amount of time on validating our understanding of perpetual markets. We have collected some data from other exchanges and have been comparing it to the mathematical models we are using. We also tested out what our models produce on our own test data. The results are within the expected error.
The next report will be published in two weeks. Thank you for monitoring the progress.
This article was created by SmartDec, a security team specialized in static code analysis, decompilation and secure development.
Feel free to use SmartCheck, our smart contract security tool for Solidity and Vyper, and follow us on Medium, Telegram and Twitter. We are also available for smart contract development and auditing work.
