XBridge Configuration Guide¶
This guide explains how to setup and configure your Service Node to support XBridge. If you have not yet setup your Service Node, start with the Service Node Setup Guide.
XBridge is a decentralized exchange protocol with the ability to perform non-custodial, trustless, and decentralized exchange between any digital assets that is supported by the Blocknet Protocol. XBridge allows any application to perform decentralized exchange, opening the door to an ecosystem of decentralized trading services (see the list of compatible blockchains). Service Nodes are used to verify that the UTXOs in the trades are valid and relay the order book. For these services, Service Nodes receive 100% of trade fees.
For each market you would like to support and earn fees from, you must host the full nodes of those blockchains. For example, if you are hosting full nodes of Bitcoin, Litecoin, and Blocknet, you would be supporting the following markets: BTC-LTC, BTC-BLOCK, LTC-BTC, LTC-BLOCK, BLOCK-BTC, BLOCK-LTC.
Note: Full nodes are required.
Lite wallets and Electrum wallets are not supported. You must host full blockchain nodes with txindex=1
. In order to check if you are running a full node, use the getblockchaininfo
command. You should see "pruned": false,
if you are running a full node. If you see "pruned": true,
then make sure txindex=1
is in that wallet's configureation file and restart the wallet. See the list of compatible blockchains.
To setup XBridge, follow these steps:
Enable XBridge¶
XBridge is turned off by default. To turn it on, add enableexchange=1
to blocknet.conf
. Changing this to enableexchange=0
will turn off XBridge.
Example blocknet.conf
:
listen=1
server=1
rpcallowip=127.0.0.1
rpcuser=username
rpcpassword=password
port=41412
rpcport=41414
enableexchange=1
servicenode=1
rpcthreads=8 # equal to number of supported wallets, set to no less than 8
Tip: For best performance...
maxconnections=
setting should not be specified.rpcthreads=
should be set to the number of blockchains you are supporting (if running 24 blockchains, setrpcthreads=24
). If you are running less than 8 blockchains then it should remainrpcthreads=8
as the minimum.
After making these changes you will need to restart your Service Node Blocknet wallet.
Configure XBridge¶
To configure XBridge, Blocknet's xbridge.conf
file and the wallet configuration files for each supported blockchain must be setup properly. Configuration is specific to the blockchain and wallet version. Here is a list of compatible blockchains and wallet versions. All configuration files can be found in the blockchain-configuration-files Github repo.
Blocknet uses a manifest (view manifest) to determine which configurations to use based off the blockchain and wallet version. The manifest uses a code-friendly format called JSON.
This manifest uses "version groups", which is a group of wallet versions for a blockchain that pertain to a specific set of configurations. A blockchain can have multiple version groups, each with different sets of wallet versions. Each version group is separated by {curly brackets} and contains similar sets of information. The information you will need to focus on is the following:
Key | Example Data (Bitcoin) | Description |
---|---|---|
blockchain | Bitcoin | The name of the blockchain. |
ticker | BTC | The blockchain's ticker. |
ver_name | Bitcoin v0.16.x | Version group name. |
versions | ["v0.16.0","v0.16.1","v0.16.2","v0.16.3"] | The wallet versions compatible with this version group. |
xbridge_conf | bitcoin--v0.15.1.conf | Filename of XBridge configs for these wallet version. |
wallet_conf | bitcoin--v0.16.0.conf | Filename of wallet config for these wallet versions. |
Wallet Confs¶
- In the manifest, find the version group for the blockchain you want to support. For example, if you want to support Bitcoin and have wallet version 0.17.0.1 then find the version group that says
"blockchain": "Bitcoin"
and has"v0.17.0.1"
listed under"versions"
. Thre are multiple version groups for Bitcoin, but only 1 version group with v0.17.0.1 listed under it:{ "blockchain": "Bitcoin", "ticker": "BTC", "ver_id": "bitcoin--v0.17.0", "ver_name": "Bitcoin v0.17.x", "conf_name": "bitcoin.conf", "dir_name_linux": "bitcoin", "dir_name_mac": "Bitcoin", "dir_name_win": "Bitcoin", "repo_url": "https://github.com/bitcoin/bitcoin", "versions": [ "v0.17.0", "v0.17.0.1", "v0.17.1" ], "xbridge_conf": "bitcoin--v0.15.1.conf", "wallet_conf": "bitcoin--v0.17.0.conf" },
- Take a note of the
"wallet_conf"
filename. For Bitcoin v0.17.0.1 it isbitcoin--v0.17.0.conf
. - Navigate to the
wallet-confs/
folder of the blockchain configuration files repo: https://github.com/blocknetdx/blockchain-configuration-files/tree/master/wallet-confs - Open the file with the filename listed in the version group. For Bitcoin v0.17.0.1, filename
bitcoin--v0.17.0.conf
, that would be this file: https://github.com/blocknetdx/blockchain-configuration-files/blob/master/wallet-confs/bitcoin--v0.17.0.conf - Copy that file's contents. These are the contents of
bitcoin--v0.17.0.conf
:server=1 listen=1 rpcuser= rpcpassword= rpcallowip=127.0.0.1 port=8333 rpcport=8332 txindex=1 # Legacy addresses must be used (address must begin with "1", not "3") addresstype=legacy changetype=legacy # Enable deprecated calls deprecatedrpc=signrawtransaction
- Open the wallet's configuration file. For Bitcoin this is
bitcoin.conf
. - Delete any contents in this file. This is important because and duplicate settings can mess with the configuration.
- Paste the previously copied file contents into the wallet's configuration file.
- Enter a username and password for
rpcuser=
andrpcpassword=
. These should be difficult and secure credentials. - Enter the IP of your Service Node client for
rpcallowip=
. If this blockchain will be hosted on the Service Node computer, userpcallowip=127.0.0.1
(localhost). - Save the configuration file.
- If the blockchain's wallet has been open, you will ned to restart it to load the updated configurations.
- Repeat this process for each blockchain you want to support.
XBridge Conf¶
- In the manifest, find the version group for the blockchain you want to support. For example, if you want to support Bitcoin and have wallet version 0.17.0.1 then find the version group that says
"blockchain": "Bitcoin"
and has"v0.17.0.1"
listed under"versions"
. Thre are multiple version groups for Bitcoin, but only 1 version group with v0.17.0.1 listed under it:{ "blockchain": "Bitcoin", "ticker": "BTC", "ver_id": "bitcoin--v0.17.0", "ver_name": "Bitcoin v0.17.x", "conf_name": "bitcoin.conf", "dir_name_linux": "bitcoin", "dir_name_mac": "Bitcoin", "dir_name_win": "Bitcoin", "repo_url": "https://github.com/bitcoin/bitcoin", "versions": [ "v0.17.0", "v0.17.0.1", "v0.17.1" ], "xbridge_conf": "bitcoin--v0.15.1.conf", "wallet_conf": "bitcoin--v0.17.0.conf" },
- Take a note of the
"xbridge_conf"
filename. For Bitcoin v0.17.0.1 it isbitcoin--v0.15.1.conf
. - Navigate to the
xbridge-confs/
folder of the blockchain configuration files repo: https://github.com/blocknetdx/blockchain-configuration-files/tree/master/xbridge-confs - Open the file with the filename listed in the version group. For Bitcoin v0.17.0.1, filename
bitcoin--v0.15.1.conf
, that would be this file: https://github.com/blocknetdx/blockchain-configuration-files/blob/master/xbridge-confs/bitcoin--v0.15.1.conf - Copy that file's contents. These are the contents of
bitcoin--v0.15.1.conf
:[BTC] Title=Bitcoin Address= Ip=127.0.0.1 Port=8332 Username= Password= AddressPrefix=0 ScriptPrefix=5 SecretPrefix=128 COIN=100000000 MinimumAmount=0 TxVersion=2 DustAmount=0 CreateTxMethod=BTC MinTxFee=7500 BlockTime=600 GetNewKeySupported=false ImportWithNoScanSupported=false FeePerByte=120 Confirmations=1
- Open the
xbridge.conf
file. This file can be found in the Blocknet wallet data directory. This file is used to tell the Blocknet wallet how to communicate with the other wallets. - At the beginning of the file, enter the following main settings:
[Main] ExchangeWallets= FullLog=true
- After the [Main] settings, paste the previously copied file contents.
- Repeat this process and paste in the XBridge configurations for other blockchains.
- Update each blockchain's
Username=
,Password=
, andIp=
setting with therpcuser=
,rpcpassword=
, andrpcallowip=
values from the respective wallet conf file. TheAddress=
setting can be left blank. - Add the blockchain's ticker to the
ExchangeWallets=
setting, separating each one with a comma (no spaces). - Save the
xbridge.conf
file. - If the blockchain's wallet has been open, you will need to restart it to load the updated configurations.
- Alternatively, the dxLoadXBridgeConf command can be used from either the Debug Console or the command line.
Example xbridge.conf
:
[Main]
ExchangeWallets=BLOCK,LTC,SYS
FullLog=true
[BLOCK]
Title=Blocknet
Ip=127.0.0.1
Port=41414
AddressPrefix=26
ScriptPrefix=28
SecretPrefix=154
COIN=100000000
MinimumAmount=0
TxVersion=1
DustAmount=0
CreateTxMethod=BTC
GetNewKeySupported=true
ImportWithNoScanSupported=true
MinTxFee=10000
BlockTime=60
FeePerByte=20
Confirmations=0
Username=BlockDXBlocknet
Password=13d9c8f8-61e9-2ddf-0418-3232e52bab39
Address=
TxWithTimeField=false
LockCoinsSupported=false
[LTC]
Title=Litecoin
Ip=127.0.0.1
Port=9332
AddressPrefix=48
ScriptPrefix=50
SecretPrefix=176
COIN=100000000
MinimumAmount=0
DustAmount=0
CreateTxMethod=BTC
GetNewKeySupported=false
ImportWithNoScanSupported=true
FeePerByte=200
MinTxFee=50000
TxVersion=1
BlockTime=150
Confirmations=0
Username=BlockDXLitecoin
Password=b28a9f5e-ba864-7bec-9fea-928f78ba910
Address=
TxWithTimeField=false
LockCoinsSupported=false
[SYS]
Title=Syscoin
Ip=127.0.0.1
Port=8370
AddressPrefix=63
ScriptPrefix=5
SecretPrefix=128
COIN=100000000
MinimumAmount=0
TxVersion=1
DustAmount=0
CreateTxMethod=BTC
MinTxFee=10000
BlockTime=60
GetNewKeySupported=false
ImportWithNoScanSupported=false
FeePerByte=20
Confirmations=0
Username=BlockDXSyscoin
Password=6af915fd-a98c-1188-9213-b785e4eb49bf
Address=
TxWithTimeField=false
LockCoinsSupported=false
Deploy Wallets¶
- Add the blockchains you want to add trading support for in the
ExchangeWallets=
entry inxbridge.conf
, denoted by the chain's asset's ticker. Separate each wallet name with a comma (no space). You can keep the rest of the configuration body the same, only theExchangeWallets=
setting needs to be updated (unless adding new support).- Example:
ExchangeWallets=BLOCK,LTC,BTC,SYS,DGB
- Example:
- Restart the Blocknet wallet or use the dxLoadXBridgeConf command (from either the Debug Console or the command line) to load the updated settings.
- Use
servicenodesendping
to propogate these new settings to the network immediately or wait up to 3 minutes for this to happen automatically. - You can view the blockchains you are supporting with the
dxGetLocalTokens
command.