Does Bitcoin exchange creation sound interesting to you? Sometimes the process of Bitcoin exchange creation can be lengthy and confusing, so we decided to make it easier for you!
In this video, we will show you how easy and fun it is to create your own Bitcoin exchange! We will take you through all the steps that need to be taken in order to create your own Bitcoin exchange. So if this sounds like something you have contemplated doing, then fret no more and get right on it with us!
To find out more, take a look at our video or read the article below!
Hi guys, this is Karolis Ramanauskas. I am a software engineer at NextChange.io. For those who are not familiar with us, we are a fairly new cryptocurrency exchange. We hold zero balance; we have really strong values of transparency and openness. As a result, you might already know, we decided to make our front-end open source and our back-end open for anybody to use.
You can find our front-end here on GitHub; just paste this URL. I will also put it in the description. As you can see, it’s written in React, but if you don’t know React, don’t worry. For the basic changes for your own exchange, you don’t really have to know React. You can just change it; it’s like changing an HTML file. If you want to do any more complicated modifications, you might want to take a course in React and learn how Redux and React work in general.
We also have an open back-end API, which you can find if you go to our website and click on API docs. It will get you to our documentation. It’s an apiary, and you can see all the endpoints here. Let’s see this one; it allows you to get all the currencies that we exchange, or the get latest ticker shows you the latest price of a given pair.
So, let’s say if you trade Bitcoin to Litecoin, it will show you what each Bitcoin is worth in Litecoins. Probably the most interesting endpoint for you is going to be this referrals endpoint, which allows you to set your own referral fee and get your own referral code.
I will show you how it works later, but now that we have our front-end open-sourced and ready, and we have a back-end where you can set your own referrals, you can set up your own exchange in less than one hour, I hope, and I will show you how to do it in this tutorial. So let’s get started.
Start Setting Up the Exchange
So, we will start setting up the exchange by cloning our front-end repository. You can find the link for our GitHub repository in the description, and I also assume that you know what Git is and what cloning means. If you do, let’s copy the URL and clone the project. Just like that. While it downloads, let me quickly show you the basic structure of our project.
We have this config directory; it just contains the basic configuration files for Webpack, for testing, just basic configuration. The public folder contains all the publicly accessible assets, like favicons and the index HTML file. In the scripts, we just have three files: test, build, and start.
These are just NPM scripts, which you type in your terminal, like NPM start, and it will start the project, so you are not going to have to change that at all. Then we have this source directory, which is where you’re going to spend the most of your time, most likely. We have these actions and reducers folders, which are the logic for the Redux stuff. Then we have this components directory for the React components, we have this CSS, which has a lot of files split based on the component, and it’s written in SCSS, but you can always change that. Finally, we have fonts, images, and this JavaScript folder, which contains some of the libraries that the project depends on but are not installed as NPM modules.
So, that’s kind of it. Let’s see if the project has been downloaded. Yes, it has.
Install All the Dependencies
So the next step is to go into our repository and install all the dependencies that the project depends on. It doesn’t have that many; it’s just basically Babel for transpilation, Axios for HTTP transmission, like making HTTP requests, JQuery, Lodash, Moment for dealing with dates, just the basic stuff, and, of course, Redux. So, it will take some time to install, so let me get back to you once that’s done.
Okay, so all the NPM modules have been installed. Here we can see this node_modules directory, so now what we can do is actually start our project and see how it works. So, it’s still loading. Why is it still loading? Okay, here we are. What you should see is almost the same as on what you can see if you go to Nextchange.io because it’s basically the same.
So, you probably want to delete all this and change the “About Us” section, you might want to change your background picture, change the description, the logo; you might want to change your FAQ. So, let me show you how to do that. In order to change the content like the “About” section or images and stuff like that, we need to open the code for our repository. So let’s navigate there. Okay, here we go. As I mentioned previously, all the React components are located in the source and then in the components folder. As you can see, there are a lot of them, and I tried to name them as descriptively as possible.
So let’s say for the About section, the component is called About. You can see right here the content; we don’t have any sophisticated CMS at the moment, a content management system; we just hard-code our content like that, and this is what you can do as well. So let’s say instead of “Nextchange,” you can put “Funchange” or something like that.
And then you can obviously delete all these team members because they are not going to be a part of your team, but you can always change their names, titles, countries, and add their social links. But for now, I’m just going to delete them, and that’s it. Let’s see how that looks. Yeah, so the same for every FAQ section. Let’s see, here we go; there are a lot of questions and answers here. You can delete any of them that you don’t need, and you can add any of them that you think would be useful.
So this is how it goes. For a background picture, you can go to hero.js, which is the component that contains this entire section and the hero image. Let’s say you can inspect where the image is set; it’s set in the #hero section, and that’s going to be contained in the hero.scss file. You can then change the background picture here, which is located in the images directory. You’re obviously going to need some CSS and HTML skills, but this is nothing extraordinary, nothing that you cannot figure out, especially if you have some background in programming. I think this is all I’m going to show you in terms of the front end.
Now, let’s get started with the back-end.
How to Obtain Your Own Referral Token
So, regarding the back-end, the main thing we want to discuss is how to obtain your own referral token and how to use that in your own exchange. The way we have done it for now is that you have to make an order of any size. So I’m buying some Ether with Bitcoin. I execute that order, and then if you scroll down, you can see this referral link. You can send this link to your friends, and if they use it and make an order later, you will get a commission fee.
Set It to Your Own Referral Code
But you can also copy this part—anything after ref=. If you search for the file config.js, you will see this referral code key, and at the moment it’s null, but you can set it to your own referral code. Now, any time the back-end makes a call—like if the front end makes a call to the back end—it will also always add this referral code.
Our back-end can check if the referral code is set, and if it is, it can accumulate your commission. To see how that works, let’s go to referrals.js and here, in this part, we are checking if config.referralCode is set. If it is, we use it; we set the header to x-referral-token, and then we execute our AJAX request. You don’t have to understand how it works, but to put it short, if you set the referral code in your configuration file, any time the front end makes an HTTP request, it will attach this referral token header.
Set Your Own Fees on Top Of Our Base Feeds
Now, let’s discuss shortly how the commissions work. For September, since we are newly opened, any time a new user makes a transaction, you’re going to get a commission of five dollars. After that, you will be able to set your own fees on top of our base fees. The base fees at the moment are 0.5%, so you can add anything on top of that, and then you will get paid. You will get paid to whatever wallet you set as a withdrawal address in your transaction. So let’s say if our transaction was this, and you got the referral token from here, and you set the destination address as this, then any time we’re going to pay out the commission, we will send it to this address in Ether.
If you want to get paid in Bitcoin, you should buy some Bitcoin from us so that the receive address is a Bitcoin address. I hope that’s clear, and if you have any questions, let me know in the comments. If this tutorial gets more popular, we will make a new version, perhaps more advanced and comprehensive, where we will go through more details about how everything works.
Set Up The Entire Repository Somewhere on the Server
Now the only step left for you to have your own exchange is to set it up, to set up the domain. All you need to do is set up this entire repository somewhere on the server. What you will have to do is run NPM run build and copy-paste the files, and that’s it. It’s really, really simple. So, I hope you like it, and I’ll see you next time.