full PIVX/LTC DEXSETUP setup example:
- This example works even from freshly installed Debian operating system
- At the end of tutorial you would be able to PIVX/LTC trading automatically by DEXBOT or ,manually by BlockDX
How to Step by step setup DEX with DEXSETUP
- open terminal and SSH connect to remote server for setup
- please replace username with real login username and server_hostname with your real server hostname or ip address
ssh username@server_hostname
- set to install base mandatory privacy tools packages
- set to install mandatory console interface build dependencies and main console interface tools packages
- set to install install useful console interface tools. For example tool clamav anti-virus tool is used by dexsetup after every packages compilation or download to verify it.
- set to install install graphical interface build dependencies and main graphical tools
- set to install install graphical user interface tools. If you want to manage dexsetup environments like wallets, BlockDX and other apps remotely there is VNC package. Keepassx is tool to securely store your keys, passwords, seeds etc..., xsensors to monitor temperatures.
- set to configure user to have ability to use tor network anonymity layer
- set to configure tigervnc server to start automatically with computer for current user
- make command to detect and use primary administration access system
- make system updated and finally install packages and configure things
pkg_base="proxychains4 tor torsocks";
pkg_cli_build="curl wget git make cmake clang clang-tools clang-format libclang1 libboost-all-dev basez libprotobuf-dev protobuf-compiler libssl-dev openssl gcc g++ python3-pip python3-dateutil cargo pkg-config libseccomp-dev libcap-dev libsecp256k1-dev firejail firejail-profiles seccomp proxychains4 tor libsodium-dev libgmp-dev screen";
pkg_cli_tools="clamav htop joe mc lm-sensors apt-file net-tools sshfs";
pkg_gui_build="qt5-qmake-bin qt5-qmake qttools5-dev-tools qttools5-dev qtbase5-dev-tools qtbase5-dev libqt5charts5-dev python3-gst-1.0 libqrencode-dev";
pkg_gui_tools="gitg keepassx geany xsensors tigervnc-standalone-server";
groups | grep debian-tor > /dev/null && cfg_user_tor="echo 'Tor for ${USER} is already configured'" || cfg_user_tor="usermod -a -G debian-tor ${USER}";
grep "^:1=${USER}$" /etc/tigervnc/vncserver.users && cfg_user_vnc="echo 'TigerVNC for ${USER} is already configured'" || cfg_user_vnc="echo ':1=${USER}' >> /etc/tigervnc/vncserver.users; systemctl start tigervncserver@:1.service; systemctl enable tigervncserver@:1.service";
sudo -v; (test $? != 0) && su_cmd="echo 'Please enter ROOT password'; su -c" || su_cmd="echo 'Please enter ${USER} sudo password'; sudo sh -c";
eval "${su_cmd} \"apt -y update; apt -y full-upgrade; apt -y install ${pkg_base} ${pkg_cli_build} ${pkg_cli_tools} ${pkg_gui_build} ${pkg_gui_tools}; ${cfg_user_tor}; ${cfg_user_vnc}; exit\""
- for previous command changes to be applied
- disconnect and SSH connect to remote server again
exit
ssh username@server_hostname
- set password used to login over VNC remote desktop management to current user
- please remember that password it will be need later.
tigervncpasswd
- download DEXSETUP installation files privately over tor
mkdir -p ~/dexsetup/dexsetup \
&& cd ~/dexsetup/dexsetup \
&& proxychains4 git clone https://github.com/nnmfnwl/dexsetup.git ./ \
&& git checkout merge.2025.02.06 \
&& chmod 755 setup* \
&& chmod 755 ./src/setup*.sh
- proxychains user file reconfiguration
./setup.cfg.proxychains.sh install
- download and build
blocknet,litecoinwallets securely from official sources - Because PIVX using not enough tested rustc unstable buggy library and Debian using 1.63 stable version, the PIVX wallet must be temporary downloaded as precompiled binary package.
./setup.cc.wallet.sh ./src/cfg.cc.blocknet.sh install
./setup.cc.wallet.sh ./src/cfg.cc.litecoin.sh install build
./setup.cc.wallet.sh ./src/cfg.cc.pivx.sh install download
- generate wallets start scripts with default wallet.dat names and default chain directories
- generate firejail security sandbox configuration file(rules)
- check, merge and generate/add needed wallet configuration variables for ability to be everything working properly and ready for DEX and CLI management
- generate CLI(command line interface) wallet management predefined commands for autocomplete
./setup.cc.wallet.profile.sh ./src/cfg.cc.blocknet.sh
./setup.cc.wallet.profile.sh ./src/cfg.cc.litecoin.sh
./setup.cc.wallet.profile.sh ./src/cfg.cc.pivx.sh
- generate PIVX/LTC trading strategy start scripts
- generate firejail security isolation configuration files(rules) for scripts
- check, merge and generate/add all needed Blocknet-Decentralized-exchange configuration variables(Xbridge config)
- Bellow command using:
- default blocknet wallet
./src/cfg.cc.blocknet.shas DEX provider - default pivx wallet
./src/cfg.cc.pivx.shas maker for trading pair PIVX/LTC - default litecoin wallet
./src/cfg.cc.litecoin.shas taker for trading pair PIVX/LTC - default dexbot version
./src/cfg.dexbot.alfa.shas automatic trading bot order manager - default startegy configuration
./src/cfg.strategy.pivx.ltc.shused to generate final working strategy - generated strategy with suffix name
strategy1
- default blocknet wallet
- command will be run again later with
yourpivxaddressandyourlitecoinaddressreplaced with real wallet addresses. - Specific generated strategy is using funds sitting on specified addresses only. Because you can run many strategies with pivx at same time, for example
PIVX/LTC conservative 1,PIVX/LTC aggressive 1,PIVX/BTC aggressive 1... and you do not want funds to be mixed.
./setup.cc.dexbot.profile.sh ./src/cfg.cc.blocknet.sh ./src/cfg.cc.pivx.sh ./src/cfg.cc.litecoin.sh ./src/cfg.dexbot.alfa.sh ./src/cfg.strategy.pivx.ltc.sh strategy1 yourpivxaddress1 yourlitecoinaddress1
- Another PIVX/LTC trading strategy could be generated very easy, lets say, name it
strategy2and using another addresses for fundsyourpivxaddress2andyourlitecoinaddress2and choose not default but aggressive price movement behavior to try earn more profits./src/cfg.strategy.pivx.ltc.aggressive1.sh
./setup.cc.dexbot.profile.sh ./src/cfg.cc.blocknet.sh ./src/cfg.cc.pivx.sh ./src/cfg.cc.litecoin.sh ./src/cfg.dexbot.alfa.sh ./src/cfg.strategy.pivx.ltc.aggressive1.sh strategy2 yourpivxaddress2 yourlitecoinaddress2
- download or build blocknet BlockDX GUI(Graphical user interface) app from official sources
- setup BlockDX by compilation from source code would take hours, so we choose
downloadinstead ofbuildargument
./setup.cc.blockdx.sh download install
- following command is to setup/configure default installed
blockdxwith default installedblocknetand create start script to run blockdx inside security sandbox and generate firejail security sandbox configuration file(rules). - Firejail isolation makes ability to also run multiple BlockDX instances connected to two different running Blocknet instances.
./setup.cc.blockdx.firejail.sh
- As all DEXSETUP processes and also running components are by default protected by tor sanboxing, the part of project is also tor browser setup and sandboxed profiling.
- To download TorBrowser privacy web browser from official sources
./setup.torbrowser.sh download install
- To setup firejail sandbox profile for tor browser named default
./setup.torbrowser.firejail.sh default
- Starting up, stopping or updating manually all wallets and trading scripts could take some time...and effort...and mistakes could be done...
- DEXSETUP setup.screen.sh script automatically generate screen start/stop/update scripts based on previously used DEXSETUP commands(not from bash history file)
- As we setup with DEXSETUP everything we want, it is time to generate whole ecosystem startup script.
- DEXSETUP start script could be regenerated later when needed, for example when user adds more wallets and trading strategies and pairs.
./setup.screen.sh install
- Now we are almost ready and it is time to logout/close from terminal/SSH server connection.
exit
How to VNC remote desktop connection
- Before VNC remote desktop connection to server, it is always needed to make secured SSH tunnel to server first.
ssh -L 5922:127.0.0.1:5902 username@server_hostname -N -f
- Now run VNC client remmina or any other VNC client as you wish to.
remmina
- Inside VNC client create remote connection to VNC server over localhost tunnel which been created by previous command
127.0.0.1:5922
- click connect button and enter VNC password set in previous steps
- So every time you want to connect your server by VNC you need to open secure SSH tunnel to server first, but many VNC clients support SSH tunnel inside profile, so it could do automatically, it highly depends which VNC client is used.
How to start DEX system and attach into and detach from screen DEX CLI interface
- To spin up whole DEX system up: enter directory and click on script or use command
cd ~/dexsetup/dexsetup/ && ./start.screen.instance_default.gui.sh
- To attach to DEX system CLI interface command
screen -x
- To list all DEX system components use keyboard shortcut
CTRL + a + ", navigate bynarrowsand switch to component byEnter
CTRL + a + "
- To detach from DEX CLI
CTRL + a + d
How to start DEX wallet components
- screen start script will start or not start loading wallets automatically depending how DEXSETUP
./setup.screen.shwas setup. - For now it is not recommended to let it all start automatically because huge pressure and slowdown on server could happen.
- It is recommended to connect DEX system CLI interface and start components manually one by one:
- use
CTRL + a + "to switch toblockDEX system component and startblocknet wallet componentbyenteron already predefined command. - Use same steps to start also
litecoin walletandpivx walletby switching intoltcandpivxcomponents.
- use
- Below commands are not needed just represents whats been done.
cd ~/dexsetup/blocknet
./firejail.blocknet.wallet_block.qt.bin.sh
cd ~/dexsetup/litecoin
./firejail.litecoin.wallet_ltc.qt.bin.sh
cd ~/dexsetup/pivx
./firejail.pivx.wallet_pivx.qt.bin.sh
DEXSETUP configured system finalization
- Fresh new
wallets supposed to be encryptedby password first to system become more secure. - use
CTRL + a + "to switch toblock_cliCLI(console user interface) component and use command./encryptto encrypt Blocknet wallet. - Or you can just use boring wallet GUI(Graphical user interface) and click on menu to encrypt wallet.
- Apply wallet encryption procedure also on all other wallets
litecoin_cliandpivx_cli
./encrypt
- Once wallets are encrypted,
wallets supposed to have backup. - Use
CTRL + a + "to switch toblock_cli,litecoin_cliand alsopivx_clicomponents and use command./backup
./backup
- Once wallet backups are done, immediately make hard copy of whole
/home/username/dexsetup/dexsetup/backup/directory on safe external offline drive. - you can do it manually by graphical user interface or do like hacker by calling recursive copy command.
cp -r ~/dexsetup/dexsetup/backup /media/${USER}/usb/mount/point/
- maybe if your server is remote running VPS, you can run scp command on your local machine to download backups to your local machine.
scp -r username@server_hostname:~/dexsetup/dexsetup/backup ~/backup_dex_wallets
- Please remember that encrypted wallets must be unlocked before starting any dexbot trading bot strategy or doing any funds send operations.
- Use
CTRL + a + "to switch toblock_cli,litecoin_cliand alsopivx_cliand use command./unlock.fulland enter password used to encrypt wallet.
./unlock.full
- Just little CLI(command line interface) HINT:
- To easy list and use many DEXSETUP predefined wallet CLI commands, just type
./and pushTABbutton twice for autocomplete.
./
- Every trading strategy must specify wallet address where funds are stored to be working with.
- To generate needed wallet addresses, navigate again to
litecoin_cli, andpivx_cliand use command./getnewaddress.default - There will be one address needed per every bot trading strategy.
- Addresses could be also easy-boring generated by GUI wallet interface.
./getnewaddress.default
- Now set our addresses to be used by generated PIVX/LTC trading strategies
startegy1andstrategy2. - Most easy way is to navigate by
CTRL + a + "todexsetupcomponent and call dexbot setup command again with real addresses andupdate_strategy - or manually edit file
~/dexsetup/dexbot/git.src/strategy_PIVX_LTC_strategy1.pyand~/dexsetup/dexbot/git.src/strategy_PIVX_LTC_strategy2.pylines ~41 and ~42 where--makeraddressand--takeraddressis specified.
./setup.cc.dexbot.profile.sh ./src/cfg.cc.blocknet.sh ./src/cfg.cc.pivx.sh ./src/cfg.cc.litecoin.sh ./src/cfg.dexbot.alfa.sh ./src/cfg.strategy.pivx.ltc.sh strategy1 PIVX_ADDRESS_1 LITECOIN_ADDRESS_1 update_strategy
./setup.cc.dexbot.profile.sh ./src/cfg.cc.blocknet.sh ./src/cfg.cc.pivx.sh ./src/cfg.cc.litecoin.sh ./src/cfg.dexbot.alfa.sh ./src/cfg.strategy.pivx.ltc.aggressive1.sh strategy2 PIVX_ADDRESS_2 LITECOIN_ADDRESS_2 update_strategy
- Now wallet addresses used buy DEXBOT trading strategies needs FUNDS(you know what to do)
- Best would be to send funds to trading addresses as many times as open orders you are willing to keep active by bot at same time, because atomic swap technology can process just one swaps per UTXO. Split functionality is already part of Blocknet's XBrige API and Automatic split functionality will be part of DEXBOT configuration later, anyway expensive transaction coins like Bitcoin should be using strategy with this feature very carefully and by default must be disabled.
#no command needed
- Use
CTRL + a + "navigate toblock_clicomponent - PIVX/LTC
strategy1andstartegy2using openorder size of 10 PIVX, so we would splitPIVX_ADDRESS_1andPIVX_ADDRESS_2funds into pieces of12to cover also TXfee and not left unusable dust after trade. But we need also consider bot configuration to keep maximum just2 orders open, so if we have 500 PIVX in wallet, we could split funds into pieces of250 PIVX, it would be most effective, most cheap and not wasting blockchain space. - Same logic needs to be applied with
LITECOIN_ADDRESS_1andLITECOIN_ADDRESS_2, for example having 10 Litecoins would be split into pieces of5 LTC.
./cli dxSplitAddress PIVX 250 PIVX_ADDRESS_1 true false true
./cli dxSplitAddress PIVX 250 PIVX_ADDRESS_2 true false true
./cli dxSplitAddress LTC 5 LITECOIN_ADDRESS_1 true false true
./cli dxSplitAddress LTC 5 LITECOIN_ADDRESS_2 true false true
- more trading strategy parameter updates by file edit
~/dexsetup/dexbot/git.src/strategy_PIVX_LTC_strategy1.py, for example:- maximum open orders count update is
"--maxopen 2" - first placed order size and minimal first placed order size
"--sellstart 10 --sellstartmin 5" - first placed order price slide
"--slidestart 2.01"(2.01 * price == slide is +101%) - last order size and minimal last order size
"--sellend 10 --sellendmin 5" - last placed order price slide
"--slideend 1.05""(1.05 * price == slide is +5%)
- maximum open orders count update is
- there is also ability for CLI interactive strategy edit mode and also ability to define own configs to generate strategies, but those later when advance user.
DEXSETUP configured starting strategies
- For using DEXBOT most effective way there is pricing proxy/cache
- Use
CTRL + a + "to switch toDEXBOT pricing proxycomponent - And push
enterkey to start dexbot pricing proxy process by predefined command. - Below command is not needed just represents whats supposed to be done.
cd ~/dexsetup/dexbot/ && ./run.firejail.proxy.sh
- Use
CTRL + a + "to switch toPIVX LTC strategy1component - And push
enterkey to start PIVX DEXBOT order maker ofPIVX/LTCtrading pair. - Below command is not needed just represents whats supposed to be done.
cd ~/dexsetup/dexbot/ && ./run.firejail.PIVX.LTC.strategy1.sh
- Use
CTRL + a + "to switch toLTC PIVX strategy1component - And push
enterkey to start LTC DEXBOT order maker ofPIVX/LTCtrading pair. - Below command is not needed just represents whats supposed to be done.
cd ~/dexsetup/dexbot/ && ./run.firejail.LTC.PIVX.strategy1.sh
- Yes you are now one of DEX system liquidity providers.
echo "I am happy DEX Liquidity provider"
- To correctly stop trading strategy:
- Switch to running strategy component
- push
CTRL + cfew times to quit process - and call again run strategy script with
--canceladdressaddition ie like./run.firejail.LTC.PIVX.strategy1.sh --canceladdress - this way, the BOT is stop and orders which belong just to this one specific running strategy are canceled.
./run.firejail.LTC.PIVX.strategy1.sh --canceladdress
DEXSETUP viewing open orders by BlockDX GUI and Blocknet monitor web page
- to run BlockDX GUI just push
Enterkey when switched toblockdxcomponent. - Check out Graphical user interface to see you running as Liquidity provider into DEX.
- You can also try to manage orders manually like a BOSS )
- Below command is not needed just represents whats supposed to be done or mouse click manually.
cd ~/dexsetup/blockdx/blockdx.1.9.5/ && ./firejail.blockdx.default.sh
- to run TorBrowser GUI just push
Enterkey when switched totorbrowsercomponent. - Once tor browser starts, just visit
https://www.blocknetmonitor.com/?p=openordersto check see you running as Liquidity provider into DEX. - Below command is not needed just represents whats supposed to be done or mouse click manually.
cd ~/dexsetup/tor_browser/latest/ && ./firejail.torbrowser.default.sh
https://www.blocknetmonitor.com/?p=openorders
How to stop whole DEX system
- To stop all DEX system components: enter directory and click on script or use command
cd ~/dexsetup/dexsetup/ && ./stop.screen.instance_default.sh
How to update just one specific wallet, for example Litecoin wallet
- switch to wallet cli which is going to be updated, for example
ltc_cliand stop wallet by command./stop
./stop
- switch to wallet
ltccomponent and wait until wallet completely stop. - If wallet experience stuck at quit as actual version of PIVX is causing, try use
CTRL + csome few times.
# `CTRL + c`
- switch to
dexsetupcomponent and for sure switch directory todexsetupand use proxychains and git pull to update components
cd ~/dexsetup/dexsetup/ && proxychains4 git pull
- rebuild
ltcwallet from source into new version by
./setup.cc.wallet.sh ./src/cfg.cc.ltc.sh update build
- Unfortunately there are many cases when developer forget to update correctly build rules, so wallet would not update or is not able to be rebuild from previously downloaded and updated source code correctly. For this cases there is ability to force wallet files to be removed and rebuild again from scratch.
./setup.cc.wallet.sh ./src/cfg.cc.ltc.sh purge
./setup.cc.wallet.sh ./src/cfg.cc.ltc.sh update build
- optionally
ltcwallet could be updated by download
./setup.cc.wallet.sh ./src/cfg.cc.ltc.sh update download
- Once build/download update process successfully finish, check new wallet version in
ltc_clicomponent by command./cli -version
./cli -version
- And finally start ltc wallet again switched in
ltccomponent
./firejail.ltc.wallet_ltc.qt.bin.sh
How to update whole DEX system
- To update all DEX system components: enter directory and click on script or use command on fresh open terminal.
- all wallets and components will stop automatically.
- this is experimental branch functionality and needs more development and testing.
cd ~/dexsetup/dexsetup/ && ./update.screen.instance_default.sh all`
FAQ - Frequently asked questions
-
Where could find all files used and generated by DEXSETUIP?
- DEXSETUP is by default using standard directory paths for chain data used like
~/.pivx,~/.litecoin,./blocknet,~/.bitcoin - DEXSETUP is by default using one main installation path/directory where source code, profiles, build and all stuff stored
cd ~/dexsetup/ - DEXSETUP also using standard proxychains config file
~/.proxychains/proxychains.conf
- DEXSETUP is by default using standard directory paths for chain data used like
-
DEXSETUP is failing to download a source code with commands like
./setup.cc.wallet.sh ./src/cfg.cc.blocknet.sh install.- DEXSETUP is by default using
tor onion privacy routingto download and communicate with other internet entities. - This high quality privacy technology could sometimes go wrong.
Solution 1: Just run command again and replace argumentinstallwithupdatelike:./setup.cc.wallet.sh ./src/cfg.cc.blocknet.sh update.Solution 2: Before calling command again, just force tor to switch into new routing path bysu - -c "systemctl restart tor@default.service; exit"orsu - -c "service tor@default restart; exit".Solution 3NOT recommended solution because loosing privacy: DEXSETUP setup command could be called without tor sanboxing bynoproxychainsargument.
- DEXSETUP is by default using