# Install Matcher on Ubuntu From Deb-package
WX Network Matcher executes orders on buying/selling a token. Everyone can deploy matcher and start getting a reward from executing orders.
Let's review the order execution process.
- Matcher receives an order to buy/sell some token pair. The order contains information about token
A
amount and its price, expressed in tokenB
amount. - Matcher accumulates the orders in the order book. When a new order is received, the matcher matches it with the present orders and tries to find mutually satisfying orders.
- If mutually satisfying orders are found, then the matcher sends the exchange transaction to the blockchain. As a result, the mentioned orders are being executed. If the mutually satisfying orders are not found, then the new order is sent to the order book.
- Matcher gets a matcher fee from each sender of the executed orders.
- Matcher repays exchange transaction fee to the miner. Matcher reward is the difference between the matcher fee and the exchange transaction fee.
The current article considers deploying matcher from deb-package. Because matcher is a node extension, the node must be deployed prior to the matcher activation.
# System Requirements
- 2 core CPU
- 4 GB RAM
- 50 GB HDD
# Checking the Version of the Installed OpenJDK
Make sure that you have OpenJDK version 8 installed. To do so, execute the following command in the console:
java -version 2>&1 | grep "openjdk version \"1.8" | wc -l
If 0
is being displayed, then proceed to OpenJDK version 8 installation step.
If 1
is being displayed, then proceed to Node installation.
# OpenJDK Version 8 Installation
To install OpenJDK version 8, execute in the console:
sudo apt-get update
sudo apt-get install openjdk-8-jre
# Node installation
Download the latest version of
waves_<version>_all.deb
file from https://github.com/wavesplatform/Waves/releases.Execute in the console
sudo dpkg -i /path/to/waves_<version>_all.deb
Move to
/var/lib/waves
folder by executingcd /var/lib/waves
# Node setup
Open the
/usr/share/waves/conf/waves.conf
file using the following command:sudo nano /usr/share/waves/conf/waves.conf
Decide whether the existing or new account should be used for the node. Use the existing account if you plan to use your node as a mining node.
To use a new account, uncomment in
wallet
section thepassword
parameter and set a value for it. Example:wallet { # Password to protect wallet file password = iAmGoingToUseAnewAccount # Wallet seed as BASE58 string # seed = }
To use an existing account, input in wallet section the password and, in base58 encoding, the seed.
wallet { # Password to protect wallet file password = iAmGoingToUseAnExistingAccount # Wallet seed as BASE58 string seed = 35S7EzKMHMN4JQyWnwpp84Zot1yqLoP2Q46RsbYRzgFq7n8AiV8L6skeGPq93P2NU4pGcZFeNTAT2TKJTa2XvqRwSdCmBR556MBmtZ3ggAkBtd3CCZFvZwZufz1ZqfzJQ }
Add to
/usr/share/waves/conf/waves.conf
file the section:waves.extensions = ["com.wavesplatform.dex.Matcher"]
Set in
/usr/share/waves/conf/waves.conf
file inrest_api
section the following parameters:enable = yes
api_key_hash = " "
rest-api { # Disable node’s REST API enable = yes … api_key_hash = " " }
Start node by executing the following command:
sudo systemctl start waves
Generate non-empty api_key_hash value. Execute command:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '<YOUR_ARBITRARY_STRING>' '127.0.0.1:6869/utils/hash/secure'
Please use your own value instead of
<YOUR_ARBITRARY_STRING>
. It is recommended to store it. As a result, you will see the following output:{"message": "YOUR_ARBITRARY_STRING", "hash": "3QbuM9nJP9GZQDekgfGboPGDQe4g1nsH4kmK2jbCLAFJ"}
Set in the
/usr/share/waves/conf/waves.conf
file in therest_api
section the value ofapi_key_hash
parameter:rest-api { … api_key_hash = “3QbuM9nJP9GZQDekgfGboPGDQe4g1nsH4kmK2jbCLAFJ” }
Restart the node by executing the following command:
sudo systemctl restart waves
Make sure that blockchain is downloaded. Execute the following command:
sudo journalctl -u waves -f
As a result, the blockchain download log will be displayed. If "microblock appended" entries started to appear in the log, then blockchain is completely downloaded.
Press Ctrl-C to close the log.
Discover the node account address. To do so, execute the following command:
curl 127.0.0.1:6869/addresses
As a result, the node account address will be displayed, for example, 3PAbvhnSesJGUd1Ry6YM1qCALTSD4pYGxG
.
Execute the following steps in
/usr/share/waves/conf/waves.conf
file:- Create a
waves.dex section
. - Set the node account address for matcher. To do so, assign in
waves.dex
section the value obtained in the previous step to account parameter.
waves.dex { account = "3PAbvhnSesJGUd1Ry6YM1qCALTSD4pYGxG" # bind-address = "0.0.0.0" # uncomment this line to accept connections from any host }
- Create a
Other node parameters are out of the scope of the current article. To get more information about node parameters, refer to Node Configuration (opens new window).
# Installing matcher
Download the latest version of
dex_<version>_all.deb
file from https://github.com/wavesplatform/dex/releases (opens new window).Execute the following command in the console:
sudo dpkg -i /path/to/dex_<version>_all.deb
Restart the node by executing:
sudo systemctl restart waves
Make sure that matcher is successfully started. To do so, execute:
curl 127.0.0.1:6886/matcher
As a result, the matcher account address will be displayed. Congratulations, you've successfully installed the matcher.