Skip to content

How to install on Ubuntu 16.04 16.10

Yzord edited this page Aug 7, 2017 · 16 revisions

Looking for a server? Please contact BadAss.Sx on Stratis Slack

Configure your nTumbleBit server & client

This is a step by step instruction how to install the nTumbleBit server and client on an Ubuntu 16.04/16.10 server. I used a 2c/4t, 32GB memory and 100GB SSD server for this.

Be sure to install a minimal installation of Ubuntu with SSH access. Be sure it is fully up to date. Also use this page to secure your server.

Ok, let's start.....we first are going to install Bitcoin Core. Follow the steps one by one and all will be fine.

Install Bitcoin Core

First do this:

sudo apt-get install software-properties-common git vim

Then

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt update
sudo apt install bitcoin-qt bitcoind

The we are going to make the bitcoin.conf file. Follow these steps:

cd ~/
mkdir .bitcoin
cd .bitcoin
vim bitcoin.conf

Paste the following in it and be sure you change the rpcpassword to a better one:

testnet=1
server=1
rpcuser=bitcoinuser
rpcpassword=bitcoinuser
prune=2000

Save it. Now we secure the file

chmod 600 ~/.bitcoin/bitcoin.conf

Now let's create a little startup script

cd ~/
vim start

Paste this in it and save it

bitcoind &

Make it executable

chmod +x start

And start it

./start

Bitcoin Core has started. You can use the following command to check if all blocks are downloaded.

bitcoin-cli getinfo

When it's done, send 10+ testnet Bitcoins to it. You can find your BTC address by the following command

bitcoin-cli getaccountaddress ""

Install .NET Core

Now we are going to install .NET core. First get repository ready. If you are using 14.04 then change yakkety in the first command into trusty or when you use 16.04, into xenial.

sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ yakkety main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt-get update

Second, install .NET core

sudo apt-get install dotnet-dev-1.0.4

.NET core has been installed.

Install Tor

Now let's install Tor. First we get the repository ready

sudo vim /etc/apt/sources.list

Paste the following in it and change the codename to the name of your distro (xenial, trusty or yakkety)

deb http://deb.torproject.org/torproject.org <codename> main
deb-src http://deb.torproject.org/torproject.org <codename> main

Now do the following

gpg --keyserver keys.gnupg.net --recv 886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
sudo apt-get update
sudo apt-get install tor deb.torproject.org-keyring

Tor has been installed. Now let's configure it

sudo vim /usr/share/tor/tor-service-defaults-torrc

Ensure that the following lines are (anywhere) in this config file:

ControlPort 9051
CookieAuthentication 1
CookieAuthFileGroupReadable 1

Save it and restart Tor

sudo /etc/init.d/tor restart

Now we need to make sure that the linux user that runs the bitcoind process has access to read the tor authentication cookie. We need to modify the user that runs bitcoind on your machine to be a member of the Tor group

sudo usermod -a -G debian-tor <username>

At this point (just to be safe) you should open a new terminal window / SSH session to ensure that the bitcoind user has the correct permissions. In the new window, you can check the permissions via:

id

If everything goes right you should see the group "debian-tor" in the output:

uid=1000(username) gid=100(users) groups=100(users),121(debian-tor)

Tor has been installed and the user has added to the debian-tor group.

Clone & restore nTumbleBit

Be sure you have git installed (sudo apt-get install git). Now we are going to clone nTumbleBit.

cd ~/
git clone https://github.com/NTumbleBit/NTumbleBit/
cd NTumbleBit/
dotnet restore

Configure and run the nTumbleBit server

Attention: be sure the tBTC blockchain has been fully downloaded before you go further. Let us run the server first, so it creates the config file we need

Attention2: skip this server setup if you only want to participate into the stress server test.

cd NTumbleBit.ClassicTumbler.Server.CLI
dotnet run -testnet

it will result in a failure, simply because it created the server.config. Now open up this file

vim /home/username/.ntumblebitserver/TestNet/server.config

And be sure you remove the # before these lines and use the password you create in ~/.bitcoin/bitcoin.conf

rpc.url=http://localhost:18332/
rpc.user=bitcoinuser
rpc.password=bitcoinpassword <-------EDIT THIS TO THE PASSWORD YOU CREATED IN bitcoin.conf

Save it and start the server again

dotnet run -testnet

You will see some warnings about RSA private key & Voucher Key. You can ignore them, because they are simply being created at that point. Next time when you start the server these warnings will be gone and you will get an output like this

info: Configuration:  Using HOME environment variable for initializing application data
info: Configuration:  Configuration file set to /home/stratis/.ntumblebitserver/TestNet/server.config
info: Configuration:  Network: TestNet
info: Configuration:  Data directory set to /home/stratis/.ntumblebitserver/TestNet
info: Configuration:  Configuration file set to /home/stratis/.ntumblebitserver/TestNet/server.config
info: Configuration:  Using cycle shorty
info: Configuration:  Testing RPC connection to http://localhost:18332/
info: Configuration:  RPC connection successfull
info: Configuration:  Bitcoin Core version detected: 140200
info: Configuration:  Successfully authenticated to Tor
info: Configuration:  Tor configured on http://y5mmki3tarye5nhc.onion/
info: Configuration:  RSA private key found (/home/stratis/.ntumblebitserver/TestNet/Tumbler.pem)
info: Configuration:  Voucher key found (/home/stratis/.ntumblebitserver/TestNet/Voucher.pem)
info: Configuration:  --------------------------------
info: Configuration:  Shareable URIs of the running tumbler are:
info: Configuration:  http://y5mmki3tarye5nhc.onion/api/v1/tumblers/5719366296e291d7b256b236542c1c1a7920374b
info: Configuration:  http://0.0.0.0:37123/api/v1/tumblers/5719366296e291d7b256b236542c1c1a7920374b
info: Configuration:  --------------------------------
info: Broadcasters:   BroadcasterJob started

As you can see, the nTumbleBit server successfully connected to Tor and created a shareable Tor link. Write this URL somewhere! Also the RSA and Voucher keys are found. Your nTumbleBit server is ready.

Installing Copay

Download the Copay app from the iOS App Store or Google Play Store. Copay is also available for home pc's. Go through the whole setup process and when it is done do the following:

  1. Click the plus sign on the top right
  2. Click "New personal wallet"
  3. Give it a name and click "Show advanced options"
  4. Turn on "Testnet" and click "Create new wallet"
  5. Click "Settings"
  6. Select your newly made wallet and click "More options" down under
  7. Click "Wallet information" and scroll to down under
  8. Copy the Extended Public Key and mail it to yourself.

Configuring and starting the nTumbleBit client

Go to the nThumbleBit client folder and start the client

cd ~/NTumbleBit/NTumbleBit.ClassicTumbler.Client.CLI
dotnet run -testnet

Also the client will stop with a failure, because it is making the config file. Open this file

vim /home/username/.ntumblebit/TestNet/client.config

And be sure you remove the # before these lines and edit it to your needs

rpc.url=http://localhost:18332/
rpc.user=bitcoinuser
rpc.password=bitcoinuser <---- Your selfmade password
tumbler.server=http://y5mmki3tarye5nhc.onion/api/v1/tumblers/5719366296e291d7b256b236542c1c1a7920374b <--- Tor URL you wrote down
outputwallet.extpubkey=tpubDCBFwgSkGF7sF4ZPHTukbGsgHUE1JS2Wiq1dneYcUEDRTMUvtNZDgX6c6bHbVD6nLuZRq8k7rn1wuyn1iv8XJmHpijx4KqA5mEfZdDJiNou <----- Your extended public key from Copay
outputwallet.keypath=0

Save it. Now go to

cd ~/NTumbleBit/NTumbleBit.ClassicTumbler.Client.CLI
dotnet run -testnet

If all went well you will connect to the server through the Tor URL and it is asking you to say YES to the configuration

info: Configuration:  Using HOME environment variable for initializing application data
info: Configuration:  Configuration file set to /home/stratis/.ntumblebit/TestNet/client.config
info: Configuration:  Network: TestNet
info: Configuration:  Data directory set to /home/stratis/.ntumblebit/TestNet
info: Configuration:  Configuration file set to /home/stratis/.ntumblebit/TestNet/client.config
info: Configuration:  Testing RPC connection to http://localhost:18332/
info: Configuration:  RPC connection successfull
info: Configuration:  Bitcoin Core version detected: 140200
info: Configuration:  Downloading tumbler information of http://y5mmki3tarye5nhc.onion/api/v1/tumblers/5719366296e291d7b256b236542c1c1a7920374b
------
Do you confirm the following standard tumbler settings? (type 'yes' to accept)
------
Well-known cycle generator: Shorty
Tumbler Fee: 0.01000000 (0.01%)
Denomination: 1.00000000
Time to tumble the first coin: 00d:02h:50m
Time to tumble the following coins: 00d:00h:20m
Peak amount tumbled per day: 72.00 BTC
yes
info: Configuration:  Tumbler parameters saved
info: Configuration:  Using tumbler http://y5mmki3tarye5nhc.onion/api/v1/tumblers/5719366296e291d7b256b236542c1c1a7920374b
info: Broadcasters:   BroadcasterJob started
NTumbleBit.CLI 1.0.0.0 -- TumbleBit Implementation in .NET Core
Type "help" or "help <command>" for more information.
>>> info: Client:         State machines started
info: Client:         New Block: 1153700
info: Client:         New Cycle: 1153699
info: Broadcasters:   Broadcasted 0 transaction(s), monitoring 0 entries in 0 seconds
info: Broadcasters:   Trusted Broadcaster is monitoring 0 entries in 0 seconds
info: Client:         [[[Updating cycle 1153699]]]
info: Client:         Phase Registration, ending in 2 blocks
info: Client:         Registered

Your nTumbleBit server and client are configured and working. Be sure you have at least 30-50 TBTC's in your Bitcoin Core wallet to get it tumbling. When tumbling is ready the tBTC's are being send to your Copay wallet on your phone/pc. Just send them back to your server to keep it going. Happy testing!

If you find bugs, please contact Nicolas Dorier or Nopara73 in the Stratis Slack.

Want to tip me? Please send Stratis to SU5C9MCQ5udMpEyb1quxoVmDHR7kseRVYc