Files
bch-dex/README.md
T

55 lines
4.4 KiB
Markdown
Raw Normal View History

2022-02-23 06:09:04 -08:00
# bch-dex
2022-02-23 05:51:12 -08:00
2025-04-11 16:09:31 -07:00
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
2022-02-23 05:51:12 -08:00
2025-04-11 16:15:29 -07:00
`bch-dex` is a decentralized exchange *protocol* for permissionless trading of [SLP tokens](https://github.com/simpleledger/slp-specifications/blob/master/slp-token-type-1.md) and [NFTs](https://github.com/simpleledger/slp-specifications/blob/master/slp-nft-1.md). Trading fees are incredibly small, compared to other DEX platforms. The software is based entirely on open protocols and open source software. `bch-dex` software is maintained by the [Permissionless Software Foundation](https://psfoundation.info).
2022-04-15 06:35:19 -07:00
2022-04-30 16:49:30 -07:00
- [High-level Overview of bch-dex](https://youtu.be/LVX8CLi4sHw) (Video)
2025-04-11 16:15:29 -07:00
This is a prototype web service that monitors one or more [Nostr relays](https://nostr.com) for trading signals, to trade BCH and SLP tokens. It's inspired by the [SWaP Protocol](https://github.com/vinarmani/swap-protocol/blob/master/swap-protocol-spec.md).
2022-02-23 05:51:12 -08:00
2025-04-11 16:09:31 -07:00
This repository contains the back end code. The user interface is contained in the [bch-dex-ui-v3](https://github.com/Permissionless-Software-Foundation/bch-dex-ui-v3) repository.
2022-02-23 05:51:12 -08:00
**Warning**: This repository is under active development. Things will be constantly changing and breaking.
2022-03-29 09:27:29 -07:00
## Media
- [High-level Overview of bch-dex](https://youtu.be/LVX8CLi4sHw) (Video)
- [Developer walk-through for installing and hacking on bch-dex](https://youtu.be/T5XI43-SWJo) (Video)
2022-05-01 13:03:31 -07:00
- This video is out of date. Follow the instructions below.
2022-03-29 09:27:29 -07:00
2022-03-27 11:42:16 -07:00
## Participate
This is an open source project, and we encourage other JavaScript developers to participate in its creation and maintenance. We have two chat rooms for the community:
2025-04-11 16:09:31 -07:00
- [Telegram Channel](https://t.me/bch_js_toolkit)
2022-03-27 11:42:16 -07:00
## Installation
Running the DEX requires composition of these different software packages:
- bch-dex - This repository is the back end software that tracks trade data on the network, generates [Offers and Counter Offers](https://github.com/Permissionless-Software-Foundation/bch-dex/tree/ct-unstable/dev-docs#definitions), and finalizes trades by accepting Counter Offers.
2025-04-11 16:09:31 -07:00
- [bch-dex-ui-v3](https://github.com/Permissionless-Software-Foundation/bch-dex-ui-v3) web app and user interface (UI) for bch-dex focused on Sellers of tokens.
- [MongoDB](https://www.mongodb.com/) is a database used by bch-dex to store and manage local data, user accounts, etc.
2025-04-11 16:09:31 -07:00
The above software is orchestrated using [Docker](https://www.docker.com/) and Docker Compose. The target operating system is Ubuntu 20+, and the target hardware is amd64 (normal desktop PCs). Trying to operate this software on other operating systems or hardware is possible, but not supported.
2025-04-11 16:09:31 -07:00
Setup instructions:
2022-04-15 06:35:19 -07:00
2022-04-15 06:42:20 -07:00
1. Follow the direction in [this Gist](https://gist.github.com/christroutner/a39f656850dc022b60f25c9663dd1cdd) to install Node.js, Docker, and Docker Compose.
1. Clone the repository with `git clone https://github.com/Permissionless-Software-Foundation/bch-dex` and enter it with `cd bch-dex`.
1. Install dependencies by running `npm install`
2022-05-01 13:03:31 -07:00
1. Create a wallet:
- `cd production/scripts`
- `node create-wallet.js`
2025-04-11 16:09:31 -07:00
1. Change directory to the `production/docker` folder.
2022-05-01 13:03:31 -07:00
1. Pull the Docker images down from Docker Hub: `docker-compose pull`
2025-04-11 16:09:31 -07:00
1. Build the core software: `docker-compose build --no-cache`
2022-04-15 06:42:20 -07:00
1. Start the Docker containers with `docker-compose up -d`
1. Open a web browser and navigate the `http://localhost:4500`. You'll be able to see new Offers as they come in and are detected by bch-dex.
1. To take the other side of the trade, click the `Take` button in the UI.
1. You can add the 12-word mnemonic from the `wallet.json` file to the the web wallet, which will mirror your wallet in the UI, and allow you to perform basic wallet functions (send and receive BCH and tokens).
2022-05-01 13:13:59 -07:00
## Blockchain Infrastructure
2025-04-11 16:09:31 -07:00
bch-dex requires a [Cash Stack](https://cashstack.info) back end in order to connect to the blockchain. By default, the Docker containers connect to [free-bch.fullstack.cash](https://free-bch.fullstack.cash/). Several community-provided servers are provided and can be [viewed here](https://consumers.psfoundation.info/consumers.json). The back end can be changed by setting the `CONSUMER_URL` environment variable in the `docker-compose.yml` file.
2022-03-27 11:49:55 -07:00
2022-02-23 05:51:12 -08:00
## License
[MIT](./LICENSE.md)