Access Coin Daemons via RPC
Access XLite Coin Daemons via RPC¶
If you are doing something like writing a trading bot which trades out of XLite, you may find it useful to have direct access to the individual coin daemons of XLite. The following examples show you how.
Firstly, make sure CloudChains daemon is running¶
The CloudChains daemon must be running to access the coin daemons of XLite. The easiest way to start the CloudChains daemon running is simply to open XLite and login. Alternatively, you can run CloudChains daemon without opening XLite by following these steps:
- Download the CloudChains daemon for your OS
- Extract the executable file,
Cloudchains-SPV
from the.zip
download. - Start the CloudChains daemon in a Terminal (Linux, Mac) or Command Prompt (Windows) with
Cloudchains-SPV
- Select option
2
to have CloudChains daemon use the XLite wallet you created previously when you installed XLite. - Enter your XLite login password when prompted for a password.
Accessing coin daemons via RPC calls¶
Note: Windows users will need to install curl if it is not already installed.
-
Navigate to the CloudChains settings directory:
-
Windows:
Or pasteC:\Users\[YourUsername]\AppData\CloudChains\settings
%appdata%\CloudChains\settings
into the File Explorer path field. -
MacOS:
Open Finder and in the program menu select Go > Go to Folder... and enter the above path.~/Library/Application Support/CloudChains/settings
-
Linux:
~/.config/CloudChains/settings
-
-
Extract the RPC login credentials for the coin daemon you want to access. These credentials are found in a file called,
config-<coin>.json
where<coin>
is the coin daemon you want to access. For example, if you want to access the BTC daemon, examineconfig-BTC.json
. It will look something like this:{ "rpcPassword": "8vCaDSpOKJ8ZhJdukZxaU4Z4NGFFDa9mPy1b-ZT6tHA", "fee": 0.0001, "rpcUsername": "VMvT5inMA0841-458cOxSgz5V0mxJR8J", "rpcPort": 8333, "feeFlat": true, "rpcEnabled": true, "addressCount": 40 }
The RPC login credentials you'll need are the
rpcPassword
,rpcUsername
andrpcPort
values in this file. In this example these values are8vCaDSpOKJ8ZhJdukZxaU4Z4NGFFDa9mPy1b-ZT6tHA
,VMvT5inMA0841-458cOxSgz5V0mxJR8J
and8333
, respectively. -
Open a Terminal window (Mac/Linux) or a Command Prompt (Windows) and issue an RPC access command via
curl
. Here are some examples of sendinglistunspent
anddumpprivkey
commands to an XLite coin daemon:-
listunspent
example (no parameters passed)wherecurl -H "Content-Type: application/json" -d '{"method": "listunspent", "params": []}' http://rpcUsername:[email protected]:rpcPort/
rpcUsername
,rpcPassword
andrpcPort
are the values found in the previous step. -
dumpprivkey
example (one parameters passed)wherecurl -H "Content-Type: application/json" -d '{"method": "dumpprivkey", "params": ["address"]}' http://rpcUsername:[email protected]:rpcPort/
address
is the address for which you want to dump the private key, andrpcUsername
,rpcPassword
andrpcPort
are the values found in the previous step.
Note: This second example allows you to dump the private keys of particular addresses of particular coins. If you save these private keys in a secure (preferably encrypted) place, you can import them later into the native wallets of those coins. These private keys can thereby act as a kind of backup which will allow you to access your XLite funds, even if XLite itself is down or unavailable for some reason. For example, if you want to access LTC in your XLite and you've dumped the private keys of your LTC in XLite, you can import those private keys at any time into an LTC native wallet. Alternatively, you can import the private keys from XLite into another noncustodial multi-wallet, like Exodus.
-
-
The coin daemons of XLite can also be accessed via RPC calls made programmatically (using the RPC login credentials found in step 2 above). Here is an example of a Python program which dumps private keys of XLite addresses.
Troubleshooting
If you encounter issues, please join Blocknet's Discord and ask a question in the #support channel.
Warning: Beware of scams
Be cautious of users sending you private messages on Discord to help with troubleshooting, even if they claim to be team members. Scammers will often prey on those having issues and offer help in an attempt to steal funds. This is usually done by impersonating team members.