Change ILP endpoint

If you are running an existing Codius server and have moneyd problems (e.g. the ILP node you connected too is stalling), you can switch to another ILP Connector. However you have to be doing this the right way, so you will get your locked funds (10 XRP) back. However if you have any outstanding drops (shown with moneyd xrp:info) you will loose them when releasing the payment channel, so make sure the balance is not too high when you switch out. Before starting, please make sure you have at least 36 XRP on your active and unlocked balance to have enough room to create the new payment channel.

This manual assumes you have a _running_ and _working_ codius installing, with moneyd functioning and installed. In addition it assumes you will be using the _same_ wallet, but are changing the endpoint for your server.

Step 1 – Turn everything off:

Run the following command’s to stop all the services used by Codius.

systemctl daemon-reload
systemctl stop codiusd.service
systemctl stop moneyd-xrp
systemctl stop hyperd
systemctl stop nginx

And while you are at it, clean up old artifacts (this is done from our restart script to)

for mount in `cat /proc/mounts | grep /run/hyper | awk '{ print $2 }'`; do umount $mount; done
for mount in `cat /proc/mounts | grep /var/lib/hyper/hosts | awk '{ print $2 }'`; do umount $mount; done
rm -rf /var/lib/hyper/hosts/*
rm -rf /var/lib/hyper/containers/*
rm -rf /run/hyper/*
rm -rf /var/log/hyper/qemu/*.log
Step 2 – move existing moneyd config:

First locate the config file:

find / -name .moneyd.json

My machine found the file in /root/.moneyd.json. You will need to update the below command if you have installed it under another path/user:

mv /root/.moneyd.json /root/.moneyd.json.backup
Step 3 – Configure moneyd in advanced mode:
moneyd xrp:configure --advanced
  • If you have a preffered ILP connector (like your own ILP connector), then enter its hostname. In other cases just hit Enter for default automatically and randomly selected public parent connector.
  • Hit enter if you want to use the automatically generated name or enter a unique name of character containing [A-Za-z0-9-_~] (NOfullstops!)
  • Enter your wallet secret (private) key.
  • Press Enter to select default Rippled server.

Output should look similar to the following:

? BTP host of parent connector: btp1.mlab.company
? Name to assign to this channel: afafdf_asdlfksfjkdjfdf-fklksdjsdf
? XRP secret: sXXXXXXXXXXXXXXXXXXXXXXXX
? Rippled server: wss://s1.ripple.com
Step 4 – Start services:

Now start the services back up again:

systemctl start nginx
systemctl start hyperd
systemctl start moneyd-xrp
systemctl start codiusd.service
Step 5 – Cleanup old paymentChannel:

You have to cleanup the old payment channel, and have to make sure its the right one. You can look at the XRP address for validation, the old channel has the XRP address from your old ILP node. If the new ILP node is under your control (you can also look in the peering database) then you can see your XRP address as the new connection.

Get a list of payment channels:

moneyd xrp:cleanup

There should be two channels appear.

  • Hit Spacebar once to select the first paymentChannel
  • Hit Enter to flag it for removal
fetching channels...
connecting to xrp ledger...
account: rXxxxxxxXxXXXXXxxxxxCALE
balance: 39.004504 XRP
index  destination                         amount (drops)  balance (drops)  expiry
0      rJNa71cLCjzQG68oNjh4fCUqCZSGNkWDrM  10000000        30000               
1      rK6g2UYc4GpQH8DYdPG7wywyQbxkJpQTTN  10000000        0                   

? Select channels to close: 0
Closing channel 57406E035A0171CB35C4491947BF108514F23137B33AC3491D28D8BF370DAD61
[[email protected] ~]#

The removal process takes about an hour. While waiting, you can run the following command to see the expiry time (time until channel can be closed).

moneyd xrp:info

Once the time has expired, you can run the cleanup command again.

moneyd xrp:cleanup

If there are still two channels press Spacebar to select the channel that is flagged ready to close, then Enter to finalize the removal.

  • Note: sometimes the channel is cleaned up automatically after expiry (as once expired, anyone can close the channel). If this is the case, then you are done!