FUSION DCRM Wallet Service and SMPC Wallet Setup

Iruwen
6 min readJul 10, 2020

Just a quick guide to get the minimum required setup running.

Update 2020–12–09: You can now run an MPC node for Anyswap. Since it’s using different ports than the legacy DCRM node, you can just run it on the same system without stopping the existing node. If you’re running my Docker container already and have sufficient RAM and storage, just do this:

sudo mkdir -p -m 750 /var/lib/mpcnode/conf/
# Note: This is a single command broken into two lines!
sudo cp /var/lib/dcrm-walletservice/conf/dcrm.privatekey \
/var/lib/mpcnode/conf/node.key
# Note: This is a single command broken into multiple lines!
sudo docker run -it --name mpcnode --restart always \
-p 8441:8441/udp -p 8441:8441/tcp -p 8449:8449/tcp \
-v /var/lib/mpcnode:/mpcnode \
anyswap/anympcnode:v6.0.0

The first two commands simply copy the private key of the old node over to the new one’s data directory. Then just follow the official guide from step 3, Node Registration and Login.

Update 2020–07–27: After having this bug fixed, and fixing this follow-up bug right after, I recommend updating the service as laid out in the corresponding paragraph below.

Update 2020–07–13: To make the initial setup and future updates even easier, I decided to fork the DCRM Wallet Service repository and make the required changes to support fully automatic Docker container builds. The setup also isn’t limited to Ubuntu anymore, you can run the container on any platform that Docker supports. You can find my Docker Hub repository here and review my code additions here.

If you followed the initial version of the guide, where you compiled the code and did things manually, and want to migrate to using Docker while keeping your DCRM private key and data, please do this before you start:

sudo systemctl stop dcrm-wallet
sudo systemctl disable dcrm-wallet
sudo mkdir -p -m 750 /var/lib/dcrm-walletservice/conf/
# Note: This is a single command broken into two lines!
sudo mv /root/.dcrm-walletservice.key \
/var/lib/dcrm-walletservice/conf/dcrm.privatekey
sudo mv /root/.dcrm-walletservice/ /var/lib/dcrm-walletservice/data/

Now to install the Docker version, only these three steps are required:

  1. Install Docker. This depends on your platform, on Ubuntu this works:
    sudo apt update; sudo apt install docker.io
    You can find more information here.
  2. Create the directory in which the service data should reside. Usually /var/lib is the right place for that under Linux, so do this:
    sudo mkdir -p -m 750 /var/lib/dcrm-walletservice
    You could also use your home directory though for example.
  3. Download the Docker image and create and run the container:
# Note: This is a single command broken into multiple lines!
sudo docker run -it --name dcrm-walletservice --restart always \
-p 4441:4441/udp -p 4441:4441/tcp -p 4449:4449/tcp \
-v /var/lib/dcrm-walletservice:/dcrm-walletservice \
iruwen/dcrm-walletservice

That’s it. You should see the service starting and doing its thing (press Ctrl + c to go back to the console, the container will keep running in the background). You can always verify that the service is running properly by looking at the container log like this: docker logs -f --tail all dcrm-walletservice
The service will automatically create a private DCRM key in /var/lib/dcrm-walletservice/conf/dcrm.privatekey if it doesn’t exist, or just reuse an existing one. If the service crashes or the system reboots, it will restart automatically.

To update the DCRM Wallet Service to a new version, just do this:

sudo docker rm -f dcrm-walletservice
sudo docker pull iruwen/dcrm-walletservice
# Now run the command you used to start the container above again

If you want to learn more about Docker, you can take a look at my FUSION node guide here where I talk more about it.

You can now skip the compiling and jump right to the second part.

This is the original first version of the guide; it’s still valid if you want to compile and run the DCRM service manually. Otherwise skip to the next section if you already have the Docker version running!

This guide assumes that you have a fresh Ubuntu 18.04 or 20.04 LTS VPS with SSH access and work as root (which isn’t generally recommended, but anything else would be out of scope here as it opens a can of worms; we’ll do this properly after launch). Since I’m using Hetzner, I just fired up a cloud instance there and got everything running quickly like this; I commented the steps so you roughly know what they do:

# If you aren't working as root already, this should make you root
sudo -i
# Add a PPA to install a current golang version
# NOTE: ONLY DO THIS IF YOU ARE STILL ON UBUNTU 18.04
# REMOVE THE COMMENT HASHES IF YOU REALLY NEED THIS
#apt -y install software-properties-common
#add-apt-repository -y ppa:longsleep/golang-backports
# Update the package repository
apt update
# Install required packages
apt -y install git golang-go build-essential
# Create and switch to the build dir
cd /root && mkdir -p fsn-dev && cd fsn-dev
# Clone the DCRM repo and checkout the dev branch
git clone -b dev https://github.com/fsn-dev/dcrm-walletService
# Build the DCRM service binaries
cd dcrm-walletService && make
# Generate a private DCRM key
./bin/cmd/gdcrm --genkey /root/.dcrm-walletservice.key
# Create a systemd unit for the service
# NOTE: THIS IS ONE LARGE MULTI LINE COMMAND UP TO
# THE NEXT COMMENT WHICH ENDS AT THE FINAL EOF
cat <<"EOF" > /etc/systemd/system/dcrm-wallet.service
[Unit]
Description=DCRM Wallet Service
After=network.target
ConditionFileNotEmpty=/root/.dcrm-walletservice.key
[Service]
ExecStart=/root/fsn-dev/dcrm-walletService/bin/cmd/gdcrm --nodekey /root/.dcrm-walletservice.key
Restart=always
[Install]
WantedBy=multi-user.target
EOF
# Load the newly created unit definition
systemctl daemon-reload
# Enable it so the service starts after boot
systemctl enable dcrm-wallet
# Finally start the DCRM service
systemctl start dcrm-wallet
# Check that the service is running (Ctrl + c to exit)
journalctl -u dcrm-wallet -ef

If you see a message like “config file: ./conf.toml not exist” somewhere in the process it seems safe to ignore, at least everything’s working fine for me.

The enabled systemd unit will make sure the service comes back up if it crashes, or if the server reboots unexpectedly.

If you have a firewall running, you may need to open some ports so the communication with the service works properly. Hetzner doesn’t enable a firewall by default. This is what iptables rules might look like for example:

iptables -A INPUT -i eth0 -p tcp --dport 4441 -m state --state NEW -j ACCEPT
iptables -A INPUT -i eth0 -p udp --dport 4441 -m state --state NEW -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 4449 -m state --state NEW -j ACCEPT

For Ubuntu’s ufw, which I’m not using, it could look like this:

ufw allow 4441/tcp
ufw allow 4441/udp
ufw allow 4449/tcp

After your DCRM service is running, please download the most recent SMPC wallet release for your platform here:
https://github.com/fsn-dev/SMPCWallet/releases/

Alternatively, you can use https://smpcwallet.com/

If you’re not registered yet, do so. Pick a username and password and write it down somewhere. There’s no way to recover a lost account. Then proceed with the login. Insert your service address in the “Set Node” field like this:
http://1.2.3.4:4449
Where 1.2.3.4 is your VPS’ public IP address (the one you also connected to using your SSH client). Use the username and password you just created.

After you (hopefully) successfully logged in, go to the wallet settings. You can find them behind the little colored blocky avatar in the top right corner. Select “Release Node” and enter a “Node Name” of your choice. The “Node Address” is the http://1.2.3.4:4449 thing you used before. Please replace 1.2.3.4 with your actual IP address again.

That’s it already. It might take some time for your node to show up on the network list (somewhere between five minutes and an hour), so be patient.

If you need additional help, please join the official Telegram group:
https://t.me/smpcwallet

If you think this article was helpful in any way, feel free to buy me a beer!

FSN: 0x0afAB9b6dA9FBb79f3260F71E4a17d4AF9AC1020
ETH: 0x0afAB9b6dA9FBb79f3260F71E4a17d4AF9AC1020
BTC: 16yAtsdjzEaQbH8ucK1nbtkqrpo791EZ7a

--

--