HOW TO BUILD A CRYPTO EXCHANGE FROM SCRATCH?
Andrei Shen
Posted on January 25, 2022
A cryptocurrency exchange is a platform that allows users to buy / sell a variety of tokens. It's like a stock exchange, but instead of stocks, you buy or sell cryptocurrencies. In this article, we will show you how to build such a cryptocurrency exchange from scratch.
Cryptocurrency exchange type
The first step in starting your own cryptocurrency exchange is choosing the type of trading platform you plan to build. This is important, since the mechanism for exchanging cryptocurrencies, the way they are stored, liquidity management, the ability to trade fiat and other functions depend on the choice of the platform.
Centralized exchanges (CEX). The most common type of trading platforms, the main feature of which is the presence of a centralized operator responsible for the security, updates and functionality of the exchange. The main advantages of centralized platforms are the speed of crypto transactions and the absence of liquidity problems. The main weak point is security, since centralized exchanges store user funds in their wallets, which, as practice shows, are often hacked.
Decentralized exchanges (DEX). Such platforms bring sellers and buyers of cryptocurrency together, giving them the ability to automatically exchange assets without the participation of intermediaries to validate the transaction. The role of the guarantor of the transaction is assumed by the platform's smart contracts, which operate on the basis of open source software. This mechanism allows you to save on commissions (no need to pay intermediaries) and increase the level of security (the exchange does not have access to money and private keys of users). However, you should keep in mind that on such exchanges, the lack of third-party moderation shifts all responsibility for errors to the users themselves.
Peer-to-peer exchanges (P2P). These are essentially online message boards for buying / selling cryptocurrency. Users enter the platform, look for a counterparty with a supply offer (denomination, amount, rate, transfer method) and contact him to agree on an exchange. You can buy a crypt in this way using fiat, gold or ordinary goods - as the parties agree. In this case, the transaction can be carried out both online and in person.
Instant exchangers. Platforms that act as a regular exchange point are very easy to use. All the user needs to do is open a trade order and it will be instantly executed. This is possible because such sites act as a broker that provides access to the liquidity of many exchanges. Fee foe speed is an increase in the number of intermediaries, which leads to higher commissions and a decrease in the level of security.
Also on the market, you can find hybrid platforms that combine the properties of centralized and decentralized exchanges. For example, a service can be operated by third-party operators and give traders more control over their funds. Orders and transactions on such crypto-exchanges are encrypted, fixed in time and stored on the blockchain, and order approval is performed outside the blockchain on a third-party node.
Basic and advanced functions
In the next step, you need to decide what functionality should be implemented in your crypto exchange. It is usually divided into such modules:
Authorization and verification. The path of an ordinary user to trading on the exchange begins with registration via email or accounts on social networks and Google. But registration itself is usually not enough to start trading. This requires personal identification - verification. This verification is necessary to ensure transparency of transactions and minimize the possibility of fraud, and also because it is required by regulators.
Platform trading engine. It is responsible for the basic functionality of the trading platform. For example, a trading engine checks the balance in a user's wallet to make sure that they have enough funds to make a transaction. It also compares trade orders and rates in real time, carries out transactions, processes information about prices and commissions, creates charts, etc.
User interface. Depending on the target audience, the user interface can be simple and intuitive or relatively complex due to the many indicators, trading signals, customizable charts and other tools of an experienced trader. In any case, the user should be able to place buy and sell orders, view the current order book, past transactions, balances, statistics, etc. You should also be able to customize all this for yourself.
Exchange admin panel. Includes a panel for tracking the current state of the exchange (traffic, trading volume, number of transactions, income from commissions), traders, wallets, transactions and content. In addition, tools should be implemented to verify users, change and remove content, ban and remove users, change commissions, manage marketing and affiliate programs.
It will also be convenient if you have a system for automatically checking users for "strange" actions, like on Binance: if a trader does something compromising (strange, unusual, clearly unauthorized), the system will notify the administrator and may even temporarily freeze operations on the compromised account and / or undo the last action.
Cryptocurrency wallet. If you are developing a centralized platform, then you need the functionality of an internal wallet. It is needed for faster access to money, which speeds up the process and makes it easier, as well as to ensure the liquidity of the exchange. In the case of decentralized and peer-to-peer cryptocurrency exchanges, there is usually no need to create an internal wallet.
Think about how users will be able to replenish their wallets and withdraw funds from them to a card or their cryptocurrency account. For example, Coinbase allows traders to connect their bank account and transfer dollars to or from a wallet easily. This possibility can be realized both with the help of manual withdrawal of funds, and through automated algorithms / smart contracts.
Order book and transaction history. This is another important element that you must implement when launching your own cryptocurrency exchange. An order book is a list of open orders to buy or sell a cryptocurrency. The exchange creates it automatically, grouping orders for the purchase and sale of cryptoassets into separate lists and compares them. When an order finds an offer that matches its conditions, the system automatically exchanges and closes the order. A closed order disappears from the order book and goes into the transaction history.
Analytical tools for traders. This functionality will help attract experienced traders to the platform. Analytical tools allow you to receive additional information about the current state of the market, predict its movement, analyze trends, create and test trading strategies. When starting a crypto exchange, you have to decide what indicators you want to see on your platform. The most popular (required) options are:
- Relative Strength Index (RSI), which shows the strength of the trend and the likelihood of its change. It works simply: the system measures the magnitude of recent price changes and displays the rate of price change.
- Moving Average (MA). Another important indicator that helps identify trends by showing the average price for a selected period.
- Moving Average Convergence / Divergence (MACD). Used to assess and predict price fluctuations.
Push notifications and alerts. Allows you to keep in touch with users, informing them about important events on the exchange: stocks, news, special applications, updates, etc. In addition, alerts can also be integrated into trading to show traders notifications about changes in the rate of selected trading pairs, trend changes, notifying an important indicator or closing a trade. But there is one point. Don't forget to allow users to choose which notifications they want to turn on. Alerts should be helpful and customizable, not mandatory and annoying.
Security features. One of the main problems of the cryptocurrency market is the low security of cryptocurrency exchanges. Not a year goes by without news of another hack of any exchange. The loudest are: Mt. Gox - $ 450 million, Bitfinex - $ 65 million, Bithumb - $ 58 million, Binance - $ 40.5 million.
Therefore, when creating your own trading platform, you need to do everything to protect the data and money of your users, especially if you want to create a centralized cryptocurrency exchange. Here's what will help:
- Protection against denial of service (DoS).
- Protection of HTTP parameters from pollution.
- Protection against distributed denial of service (DDoS).
- Protection against server side request forgery (SSRF).
- Protection against cross-site request forgery (CSRF).
- Two-factor and HTTPS authentication.
- Biometric authentication.
- Data encryption.
- SQL injection.
KYC, KYT, AML compliance. If you want to work in the American, European and other markets, where exchanges are subject to increased requirements for combating money laundering and terrorist financing, then you need to implement the following procedures and standards into your trading platform:
- KYC — Know your customer. Each user will have to go through a personal identification of the person. Of course, you can independently collect user documents and carry out identification procedures using databases (PEP, sanction lists, etc.). But why bother when you can use out-of-the-box services that make it easy and cost-effective to implement verification processes such as Sumsub, Trulioo or Veriff.
- KYT — Know your transaction. Prescribes to crypto exchanges the obligation to verify from which sources user tokens are taken and to block transactions from suspicious sources. Here you can also not reinvent the wheel, but use an external service, for example, Traceer.
- Compliance with AML. According to US law, the state of the crypto exchange must have a certified anti-money laundering officer who is responsible for tracking suspicious transactions and sending SAR (Suspicious Activity Reports) to the financial monitoring authorities. This employee must have a degree in finance and a certificate that is issued by the ICA or ACAMS.
Liquidity management. Traders need an exchange that allows them to easily exchange one asset for another in no time. This is only possible if the site has enough liquidity: orders to buy or sell crypto to complete the transaction at a reasonable price. You can provide liquidity by:
Third party market maker. Involves an agreement with liquidity providers who typically trade simultaneously in many different locations and can provide the liquidity needed for one cryptocurrency exchange by entering into trades on other trading platforms.
Creation of an inter-exchange market. This strategy also implies cooperation with a market maker, but in this case, you enter into an agreement directly with the operator of an external exchange, and not a third party.
Liquidity mining. This method is most associated with decentralized communities as it rewards users for helping to secure liquidity. The simplest option: the user deposits money into the exchange account and once a month or a year receives a reward in the form of a percentage of his contribution.
Architecture, technology stack and API
Exchange architecture. This concept usually means the structure of the platform, which helps to logically and visually define the relationship and the way of interaction between all the components of the exchange: the login screen, the trading engine, the user interface, security functions, API, databases, etc. Here is an example of such an architecture:
Technology stack. It is a set of development tools such as programming languages, libraries, frameworks, database management systems, compilers, APIs, etc., for creating the backend and frontend of the platform. In the case of creating a cryptocurrency exchange, it may look like this:
Development of cryptocurrency exchange
A cryptocurrency exchange should be launched only through custom development, since only in this way can you ensure the proper quality and security of the software. There are ready-made solutions (scripts), but they, as a rule, are created by amateurs and / or carry risks that there will be many security holes in the code, created on purpose or through oversight. Considering the situation with such frequent hacks of cryptocurrency exchanges, it is not worth the risk.
And then, the process of creating a cryptocurrency trading platform will be as follows:
- Signing a contract. You and the developer company discuss the general concept of the cryptocurrency exchange, on the basis of which the technical description of the project is created. After that, you agree on the timing, cost, KPI, communication channels and sign a cooperation agreement.
- Platform prototyping. At the next stage, the designer, business analyst and / or the customer create a framework for the design of the cryptocurrency exchange, which is then discussed and brought to an ideal state.
- Creation of interface design. Further, based on the wireframe, designers develop a layout and / or prototype of the platform interface, which show how it will look for traders and admins.
- Direct encoding. After creating the design, it and the technical description are given to the programmers who implement all this in the code. Front-end, back-end, blockchain and mobile developers are responsible for this.
- Product testing. Almost immediately after the start of coding, QA engineers get down to business, who check the fresh code for errors, and so on until the software is written. Other tests are carried out in parallel.
- Deployment and support. After the cryptocurrency exchange software is ready to launch, a marketing campaign is launched to attract traders. The platform is added to business listings and social networks.
The cost of creating a crypto exchange
Posted on January 25, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.