Understanding TumbleBit Part 5: Try It Out!

Written by nopara73 | Published 2017/06/07
Tech Story Tags: bitcoin | blockchain | tumblebit | anonymity | privacy

TLDRvia the TL;DR App

Andreas Antonopoulos mentioned once if he would be in prison he would reinvent an offline version of the Bitcoin consensus algorithm by playing Sudoku. Doing a role-play like this on Bitcoin meetups makes a lot more sense than you would initially think, let me explain why.

In Andy Hunt’s book, The Pragmatic Thinking and Learning he told a story of how he learned wall climbing. Firstly, he paid a lot of money for a lesson then the instructor told the group: “go climb wall” and went for a cup of coffee. After half an hour of climbing the wall and cursing the lazy instructor, he came back and started explaining how to climb the wall. The explanation made a lot more sense after some experience, than it would have meant before that. The reason is because there are two primary ways of learning: synthesis and analysis. If you cannot identify which one was which in the wall-climbing class you were not paying attention my dear reader.

Role-playing is a similar synthetic learning experience. Since playing Sudoku requires people and you are just a loner in front of your screen, I will not go down the role-playing rabbit hole, I just offer a similar synthetic learning experience. We are going to go through how to use a pre-alpha version of TumbleBit in Classic Tumbler Mode with HiddenWallet as the receiving output wallet without deep theoretical stuff. Just follow me and get a first-hand experience with an experimental technology.

A couple of notes before we start.

  • Yes, yes, I know, if I wanted to follow the example of the wall-climbing teacher I should have started the whole Understanding TumbleBit series with this article, however at the time the softwares were not there.
  • If you happen to read this article, let us say half a year later from its creation you will have extra difficulties, or shall I say challenges to overcome, presented by the changes in these rapidly evolving softwares.
  • This is not the way how HiddenWallet will integrate TumbleBit. That will be a user-friendly way. This is only using HiddenWallet as the output wallet of NTumbleBit which you could think of something like TumbleBit Core.
  • For reference, up to date instructions for NTumbleBit can be found here and HiddenWallet can be found here. You can of course go through them, however those are not as funny and layman friendly as this article.

1. Install a bunch of development tools

Yes, by the end of this article you are going to become a hardcore programmer, we will not choose the easy of simply running executables.

(a-b) Git and .NET Core

For both HiddenWallet and NTumbleBit you will need Git and .NET Core present on your system. .NET Core is the cross platform, opensource .NET framework. It enables us to write code in our favorite language, C#, while Git is a super complicated tool with only one purpose, to make the coordination of programmers harder with each other.

(c) Bitcoin Core

For NTumbleBit you only need Bitcoin Core. Do not stop right here, you are going to use it on the testnet, which is significantly less cumbersome than the mainnet, therefore you can give it a try for your learning.

After you installed and downloaded it, create/edit your bitcoin.conf:

# Run on the test network instead of the real bitcoin network.testnet=1

# server=1 tells Bitcoin-Qt and bitcoind to accept JSON-RPC commandsserver=1

# RPC user and passwordrpcuser=bitcoinuserrpcpassword=bitcoinpassword

Finally, execute bitcoind or bitcoin-qt, allow it catch up with the network and acquire 3+ testnet coins to it. Google is your friend.

(d) Node.js

For HiddenWallet you need Node.js present on your system, since its graphical user interface is written with Electron, which is written in Node.js.At the time of writing if you are on Windows you can just download the binaries for HiddenWallet and then no need to install Node.Node is the server side JavaScript. Because of .NET Core is relatively new and there is no good way to write cross platform GUI in it I was forced to write it in another language, therefore creating one more requirement for you.

(e) Tor

Tor is the tool that only pedophile terrorists use and by downloading it will of course automatically make you one of them as well.At the time of writing this article, Tor is not yet integrated into NTumbleBit, although it probably will be in a couple of days when I have time for that, however it is integrated in HiddenWallet. In HiddenWallet if you are using the release binaries for Windows you can skip this step, those binaries are shipped with built in Tor support, however if you use OSX or Linux you need to make sure Tor is in your PATH.

2. Get HiddenWallet

(a) The easy way: for Windows users

  1. Download the release binaries and extract the archived folder:

2. Run HiddenWallet, then close it instantly without generating new wallet. Running it once will create a config file for you. Because you are working on the testnet you have to edit it beforehand, I will give you more instructions about this later.

(b) The little less easy way: for non-Windows users

Fire up a terminal or the command line and clone the repo with Git, restore the needed packages, build and publish the API software with .NET Core, make sure Tor is in the right place, install the needed npm packages and start the GUI.

  1. git clone [https://github.com/nopara73/HiddenWallet.git](https://github.com/nopara73/HiddenWallet.git)
  2. cd HiddenWallet/HiddenWallet/HiddenWallet.API
  3. dotnet restore
  4. dotnet build
  5. dotnet publish -r win7-x64 --output bin/dist/current-target Find your platform identifier here and replace win7-x64. If you get an error here, do not worry, just add your platform identifier to the <RuntimeIdentifiers> tag in the `HiddenWallet.API/HiddenWallet.API.csproj´ file.

  6. Only on Windows: — Copy and unzip HiddenWallet.Packager/tor.zip to HiddenWallet.API/bin/dist/current-targetdirectory. Quick note on unzipping, the final path to tor.exe has to be: current-target/tor/Tor/tor.exe and not: current-target/tor/tor/Tor/tor.exe

  7. cd ../HiddenWallet.GUI)
  8. npm install
  9. npm start
  10. Close it instantly without generating a new wallet. Running it once will create a config file for you. Because you are working on the testnet you have to edit it beforehand, I will give you more instructions about this later.

3. Setup and Run NTumbleBit

(a). Clone & Restore

Fire up a terminal or the command line and clone the repo with Git. Then restore the needed packages with .NET Core:

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

(b) Run the client

Run the client once, it will generate your default configuration files.

cd NTumbleBit.CLIdotnet run -testnet

(c) Edit the config file

The client’s configuration file can be found in the user’s home directory at .ntumblebit/TestNet/client.configon non-Windows platforms and %appdata%\NTumbleBit\TestNet\client.configon Windows.Depending on what rpc credentials you used make your config file look like this:

rpc.url=http://localhost:18332/rpc.user=bitcoinuserrpc.password=bitcoinpasswordtumbler.server=http://testnet.ntumblebit.metaco.comoutputwallet.extpubkey=tpubDCeHeZ4A66VU78YDJ1yKtnR7uVPf8rRU1thtCXtyzZ3XQXBqc3HFaqMPH1fxESjFvR4CyhyDqT3NuNKSnWc5HC6dD8cePbTaEUU6HF1MUNDoutputwallet.keypath=

Leave the outputwallet.keypath empty and get your own extpubkey from HiddenWallet so you can change the outputwallet.extpubkey.How do you get that? You already ran once HiddenWallet and closed it, therefore you must have a Config.json file generated for you:

Open it:

Set the network to TestNet and set CanSpendUnconfirmed to True. Even though it is dangerous, it makes testing easier, and since you are working on TestNet you do not need to care for security.

Generate a wallet:

Decrypt it:

And get your extpubkey:

HiddenWallet is a full block spv wallet to protect your privacy, it does not ask a remote server or nodes about what transactions it is interested in, it rather asks all the transactions the Bitcoin network has and locally selects those which it is interested in, therefore not exposing it to third parties. This comes with the inconvenience of long syncing times:

Now you are all set up and ready to use TumbleBit on the testnet!

4. Tumble!

Make sure your Bitcoin Core has already caught up with the testnet chain. Get some testnet coins to it, over 1 tbtc, and start tumbling:

cd NTumbleBit.CLIdotnet run -testnet

By running NTumbleBit.CLI, after each cycle HiddenWallet will receive some coins. The denomination of the testnet server is 1 tbtc.It will take twenty four blocks to get your first coin in your HiddenWallet, followed by one coin every two blocks.In the future, depending on the liquidity TumbleBit will be much faster than this and the denomination can change as well. We still have not started to figure out the sweet spots and optimal parameters.

Do not forget that this is TumbleBit’s Classic Tumbler mode, the Payment Hub mode will be way more powerful, faster and cheaper.By pressing Enter you can stop the NTumbleBit.CLI process and running it again with dotnet run -testnet -onlymonitor command it will tell the CLI not to start tumbling more coins but to finish those that are in process.You can see if money is still being tumbled by checking Bitcoin Core’s watch only addresses. Once the process is over, there should be no money on watch only addresses.

Final notes

That is it! That is where we are today. I know it is still scary, complicated and cumbersome, however it is getting easier and easier and progress is being made every day. I hope you at least enjoyed it and learnt something.


Published by HackerNoon on 2017/06/07