electrum server on a cubox

I don’t even remember if there were alternative wallets available when I started with BitCoin. I used the reference implementation exclusively for a long time. Now there is a wide variety to choose from. They fall in three main categories: full node, light client and web wallets. They are nicely listed and explained at bitcoin.org

full node

Every hardcore bitcoin enthusiast should run at least one full node. That’s how the system was envisioned. It expresses the peer to peer nature. A full node maintains the complete history, and can verify transactions. It has lots of connections to other nodes, and helps propagate the transactions and blockt through the peer to peer network. The downside is that the size of the blockchain has grown so large to make it impractical, especially for mobuile devices.

light client

Most mobile wallets fall into this category, as well as my favorite: electrum. The main reasons why I prefer electrum are that it has been in the apt repository for a while, and it has good support for hardware wallets. Light clients communicate with servers that in addition to the blockchain of the full node also maintain an additional database. This is required to serve requests for addresses, that the full node doesn’t have in its wallet. The client is responsible for managing the keys, and thus signs the transactions locally before distributing them.

web wallets

This is mainly for new users that don’t know how to secure theit private keys. I won’t go into details here. This post is about something else.

electrum server

The main downside of light clients compared to full nodes is that there is a layer between your light client and the peer to peer network. You depend on these servers to be available. The server you connect to, could connect your BitCoin addresses to your IP address. They theoretically could also selectively filter transactions. But what they have no way to do, is steal from you. As I understand it, electrum talks to multiple servers not only to protect your privacy, but for various reasons. There are about 7’000 full nodes, but only about 20 electrum servers. To protect your privacy, you can run your own electrum server in your basement. That’s what I do, but it’s more to support the system then out of paranoia. There is a strong incentive to mine BitCoin, but the incentive for running a full node or an electrum server is not monetary. Still I think it is very important to have many of these around.

I had a cubox small quad core arm box around that already ran a BitCoin full node and p2pool as well as some smaller stuff. It had some more capacity, but I didn’t know if it was enough to run electrum server. As it is not really apt-get installable, I didn’t want it on my main server. Electrum server uses a leveldb to keep track of all the information that it needs in addition to bitcoind. At the moment this database has about 11GB. Building it from scratch can take a long time, so they advice to download it form the foundary, and grow it from there. It didn’t work out initially, so I tried to build it from scratch. After computing for a week it slowed down too much at the blocks of mid 2012. So I downloaded from the foundry again, and this time it worked. For about two weeks I tested it in private. Then I had to enable IRC to make it public. You find the public server in #electrum, they start with E_. My electrum server is probably one of the slower ones. The cubox is a cool device, but not a typical server. It has performance comparable to a smartphone. Sometimes it lags a few blocks, but in general it keeps up quite well. I can see hundreds of clients connect to it.

Categories: BitCoin, Software | Tags: , | Leave a comment

Hello Kitty

Since she was a kid, my wive dreamt of having a pet, preferably a cat. Our kids also said they would love to have a cat or a bunny or a turtle or… I grew up with animals. We had cats and dogs and sheep and goats and chicken and once even a pig. We even had newborn cats and dogs and chicken in our house. Out of all these animals I like dogs best. They are a lot more social and intelligent then any other animal we had. But for our family, even I have to agree, that having a dog would be too big a commitment and responsibility. So after reviewing bunnies, turtles and guinea pigs, we settled for a cat. Mirella surfed the web evening for evening for weeks searching for cats. Then I saw a poster in a cablecar station when doing some tandem flights. Somebody uphill wanted to give away some young cats. They looked cute. So I took a photo of the poster.

After some back and forth and some planning and buying equipment, we went to get one. I quit work early last Friday. After I came home, we drove to Flüelen together, and took the cablecar to Eggberge. The boys were totally excited. We had to walk about half an hour uphill to reach the farm. A boy fetched the cat we had previously selected. They didn’t ask a specific price, but just wanted something to cover their expenses. Our boys could choose a name for the cat. They came up with “Simba”. Simba didn’t like the walk in the box too much, so she started to purr when we stopped at the cablecar. The ride with the cablecar as well as with the car didn’t look too pleasant to her.

But at home she came out of the box, exploring our flat and cuddle. It turned out even though she grew up on a farm she is not shy at all. It’s clear that the kids on the farm spent a lot of time playing with the young kitten. She doesn’t seem to care if our boys drive their RC cars close by her. We try to teach our boys not to carry her around all the time, and watch for the signs if she likes something. Eventhough you can tell if she doesn’t like it sometimes when they play with her, she never hurts them.

Categories: Family | Tags: | Leave a comment

HW1 tiny BitCoin hardware wallet

While the trezor is certainly a great device for securing BitCoins, I’m also interested in alternative hardware wallets. Even in my very first discussions about increasing the scurity of BitCoin we talked about SmartCard solutions. After all, that’s also how I secure my GPG keys. But a regular SmartCard alone only protects the keys. If the computer is malware infected, it could sign another transaction than the one you initiated, and thus spend all your coins at once. The trezor solves this problem nicely with displaying the transaction details on the screen, waiting for a button press to confirm. Then came the HW1, a tiny BitCoin hardware wallet, based on smartcard technology with some extras. Since it has no display nor buttons, I was ready to get somewhat reduced security compared to the trezor. But in fact they are also very clever, and it turns out the security is just as high at the cost of a bit of convenience. But as I understand it, that level is configurable. I just opted for the more secure option.

So, If I want to spend some Coins from my HW1, I plug the dongle which is smaller than a regular key on my keychain into an USB port on my computer. Then I start up electrum, and send the coins. Now the HW1 has to sign the transaction. It asks me to remove the dongle and plug it into another computer, that is preferably not connected to the internet. If I don’t have too much funds on this wallet, I can also plug it into the same one again. A text editor should be opened beforehand, and it should have focus. The dongle then acts as a keyboard, typing the transaction details along with a TAN code to validate the transaction. Next I remove the HW1 again, and plug it into the former computer. I type the TAN code, HW1 signs the transaction, and electrum distributes it to the BitCoin network. That’s it: simple and secure.

Just as electrum itself and trezor, the HW1 uses a deterministic hierarchical wallet. To be sure I can trust the device and the method in general, it was not enough for me to test that I can spend from it. I wanted to also be sure I keep my coins in case the device gets damaged or lost. That means I have to be able to restore it from a seed. The seed is generated when I first initialize the dongle. And like the TAN code it is printed out in HID keyboard mode. If you have it print it on a machine that could be compromised, there would be no point in using a hardware walled in the first place. So have it print the seed to an air-gapped secure computer. If you already initialized your HW1, you can’t restore another seed onto it, unless you reset it first. I couldn’t find any documentation on how to reset it though. A developer told me to enter a wrong PIN three times to reset it. After that, don’t choose restore, but initialize. In the BTChip personalization manager that follows, you choose restore. I did this on a machine where I removed the harddisk, and booted from a fresh USB stick. Getting electrum usable with all the required plugins and libraries was the most work. Before typing in the seed, unplug the network cable and disable WiFi. After the seed was typed in, and the dongle restored, I issued “sudo dd if=/dev/random of=/dev/sda” and waited for the kernel to go belly up. That’s for making sure no sensitive information remained on the USB dongle. Don’t do this on your regular computer.

In conclusion, I can say that:

  1. The security is just as high as with the trezor, if you let it type the TAN on a computer that is temporarily offline. But the convenience obviously suffers.
  2. If you only use it to store medium value funds, you can have it type on the same device, at reduced security. In that setting the convenience is about the same as with the trezor.
  3. Where the biggest difference lies for me, is restoring the device from a seed. Preparing a fully equipped air-gapped computer to securely restore the dongle from a seed proved to be quite some work. While with the trezor, you don’t need an additional computer. Luckily that’s a task that is required infrequently.

While the experience with the trezor was smooth from the beginning, I tested a lot with the HW1 to gain confidence with it. I found some minor bugs. I had the computer freeze a couple of times. I saw lots of messages about dongles not found. I had to reconnect and start over many many times. Some things were not documented or not obvious. All these problems became lesser the more I tested it. I can only explain it that way that I grew a sense for the correct timings and steps required. In the meantime I use it without problems, but I have the feeling that it is not as robust as the trezor. It will work in the end, but you might have to try a few times before it does.

I packaged the python library that is needed for the plugin for ubuntu. Once all parts and dependend libraries are out of beta, I will also try to get it into debian. On ubuntu, you can install it like this:

sudo apt-add-repository ppa:richi-paraeasy/bitcoin
sudo apt-get update
sudo apt-get install python-btchip

Ah yes, and there’s the price difference. A trezor costs $119 while a HW1 is just $20. At the moment they have a 2 for 1 offer, so go hurry.

Categories: BitCoin, Software | Tags: | Leave a comment

What could go wrong when ordering pizza?

For some months now it was possible to order pizza for BitCoin in our area. I wanted to give it a try since it was announced. But only last Thursday, I proposed to my coworkers to order pizza. And that I would pay with BitCoin. It was meant as a demonstration how cool the virtual currency is, and that it is actually useful in the real world. I was going to take pictures and blog about it. After all, a pizza deal was the first real use and most famous BitCoin transaction in history.

So I placed the order with lieferservice.ch for pizza’s from Angolo, where we used to go for lunch before. The website was really cool, we could order extra ingredients on top of the regular pizza. Payment was a breeze, as always with BitCoin. It was 11:25 when I placed the order, and I picked 12:30 for the delivery. The email confirmation from lieferservice.ch followed immediately. But when we all grew more and more hungry, I tried to call Angolo at 12:45 to ask where our food was. Nobody answered the phone. I tried again, and again, and again. Nothing, not even an answering machine. After 13:00 we decided we would drive to Angolo with the confirmation email, and eat our pizza in the restaurant. When we arrived, it was closed for holiday.

This is clearly not how this is supposed to work. The guy from lieferservice appologized, and told me their contractors are ment to tell them when they change opening hours. He couldn’t refund me in BitCoin, and asked for my IBAN instead. One of my colleagues was so pissed off, he said he wouldn’t go to Angolo ever again.

Categories: Work | Tags: | Leave a comment

Paracuda walk & fly

In the Paracuda paragliding club, we distribute the organization of the events among the members. So I agreed to organize a “walk n fly” event in October. Usually pilots go up with a cablecar to go flying. This saves us from having to carry the equipment for too far. But for people that want to do a bit more sport and see a bit more from the nature, there is “walk n fly”. It’s the perfect undertaking for autumn, where the thermals vanished and the temperatures retreat. The interest was stealthy from the start, but I still hoped some people would join. To my dismay, I was alone on the meeting point.  That didn’t stop me from going to hike though. The Wasserberg was covered in a cloud, and the description in the Internet described the trail as difficult to find. So I save this one for later. Instead I went to the familiar Pfaff near Glattalp. About once a year, I take the cablecar to the Glattalp, and do the half hour hike to the Pfaff. It has a huge take off area with two possible directions. After I was airborne, I headed straight to the Kupferberg with a nice little cloud atop. As I approached, the birds left, and apparently the thermals as well. So I went to the next one. This was the mountain straight on top of where my father grew up. I remember looking up the wall when I was a kid, visiting my grandmother. It looked enormous from below, but at the hilltop looks very friendly. It even spared some thermals for me. In October late afternoon it’s already very nice, if you can hold your position for a couple of minutes. After cruising around in the Bisital some more, I landed right behind my uncle’s cows. That was actually the most difficult part of the flight. There is a tight grid of power lines, and only from atop I could spot a cell big enough to squeeze into. I had a coffe at my cousin’s house, and then hiked back to the car. The signs indicated more than an hour, but actually it takes only slightly more than half.


Categories: Paragliding | Tags: , , | Leave a comment

The Rise and Rise of BitCoin

As part of the Zürich Film Festival last week, they presented “The Rise and Rise of Bitcoin“. I couldn’t make it to one of the screenings where the director and the main actor were present. The room was fully booked, which I noticed with delight. I didn’t learn too much from the film on the technical side, as I’ve been involved with the topic for some years. But it was interesting to get to know some of the famous players a bit better. The movie was not very technical, and that’s on purpose. It does a great job in explaining BitCoin to the average people, and maybe get them interested in the future of money.

To test my knowledge in the area of BitCoin and crypto currencies in general, I recently took the test for “Certified BitCoin Professional“. While most of the question are not that hard if you’ve been involved in BitCoin for some time, the time to answer is limited. You have to answer 75 questions in 20 minutes. So I forced myself into flow mode and gave the answers swiftly. After 16 minutes I hit submit on the last one, and was presented with “73 correct out of 75″. They won’t tell which ones were not correct, nor do they specify how many you need to get the certificate. Only the fee stops you from trying it over and over again. I’d be interested in your scores.

Categories: Software | Tags: | Leave a comment

Presentations with code that actually works

I don’t do presentations that often these days. And if I do, more often than not, they contain some form of source code. With most things you write, you refine it over and over. This is especially true with stuff that you present. Applied to code snippets, that can mean you test it initially, but once it is in the presentation it is a burden to copy it back and forth to verify every change, and then start over again with the formatting. So you often end up changing your code snippets in the presentation, without verifying if the code is still valid. Sometimes you find these errors during proof reading, but even famous presenters caught compile errors during the presentation. That’s how it works when you use the traditional PowerPoint style of products. As I expressed earlier, the Office suite and their opaque file formats doesn’t belong to my favourite tools.

Thus after I recently learned LaTex, I wondered if presentations could be done with it. Sure enough TexMaker offers a good set of templates for just that.

Next I wanted to see if I could link in code from external files, and sure enough, there is the listings package for LaTex. Now that enables me to have the code in files that I can actually compile.

But wouldn’t it be cool, if I could compile the code snippets for verification and generate a pdf file from the tex source all at one go? Sure enough there is a cmake UseLATEX package.

Now wouldn’t it be even cooler, if I could edit and generate all from within the same console window, without having to exit the editor, start the editor from a specific directory, or type complicated commands? Sure enough I found out how to write project specific .vimrc files. With everything prepared, I just have to type :make in vim to trigger the process, to get a new pdf file with all code snippets verifyed.

A small project to demonstrate the technique is at: https://github.com/ulrichard/experiments/tree/master/initializerlists

And you can find the resulting pdf file at: https://github.com/ulrichard/experiments/releases/download/initlist_0.1/initializerlists.pdf

Categories: Software, Work | Tags: , | Leave a comment

The phone book of the internet age

When I was a kid, the main means of communication with remote friends was using telephones. If I didn’t know the phone number of their parents, I looked them up in the phone book. The phone books also contained the postal address. So if I wanted to send a letter or a packet, I could also consult the same source for where exactly to send it.

Nowadays we have many more means of communication (mobile phones, email, xmpp, IRC, BitMessage, Twitter, Skype, WhatsApp, ICQ, FaceBook, Hangout, Forums…), but in this plethora of options, discovery is sometimes more difficult. On some services you just search for name, on others you have to know the user handle beforehand. But most important, you need to know on which service to look in the first place. In addition, an increasing number of people choose not to be listed in the phone book, or their online counterparts any more. So when I recently wanted to send a package to a friend who just received a child, I couldn’t find his postal address anywhere and had thus to ask him.

I’m sure in addition to the online versions of the regular phone books, there are lots of registry services where people can sign up to be listed. The problem is though that they are scattered all over the place, and mostly for local communities. There is one notable global directory, but that is for domain names rather than for people. DNS has problems of its own. As I experienced recently first hand, you’re at the mercy of the registrars if something unusual happens. And if you forget to renew, or lost access to the account your friend registered your domain (don’t get me started on passwords), some troll may catch your domain and use it for blackmailing.

Namecoin is here to solve both problems. It is a descendant of BitCoin, the famous cryptocurrency. Namecoin is a decentralized store of information such as domain name registrations, personal information… you name it. As it uses a block-chain it is completely tamper- and censorship-resistant. The rules are very clear. The first one to grab a name gets it. When a name expires it is available again. Registration or update is very cheap, in the range of a few cents. Since it is merge-mined with bitcoin itself, it inherits the protection against 51% attacks.

All you need is an installation of a namecoin full node (I’m not aware of any thin clients). The block chain is a lot smaller than that of bitcoin, so it is no problem to run it on your notebook. Once installed, you can register your domain. The GUI has fields for the required information. If you have a static IP address, you can just use that for registering and skip all the DNS stuff. The client side is a bit harder at the moment. To get the full security the system offers, you need to install a browser plugin, that is still a bit clunky. But there are already DNS providers that resolve .bit domains. That can be a lot more convenient at the cost of some security.

But the reason I’m writing about namecoin is an alternative usage, namely as a kind of modern phone book. I can’t remember how I found the site  nameid.org. I think it was from some guy writing about integrating it with the BitMessage client. As BitMessage addresses are hard to remember, that makes a lot of sense. Using namecoin for OpenID is also a nice idea, but I don’t use that part. I’m still looking for an OpenID solution based on OpenPGP where I can use my OpenGPG Smartcard. There was a great project started in this direction called EnigForm, too bad it has been stalled for some time. But I’m diverting again.

So, you can pick a short name (“ulrichard” in my case), and register selected information about you (email, blog, phone number, postal address…) with namecoin. The process is not as straight forward as with domain names, as the GUI has no fields for that yet. So you have to construct the json string yourself. The wiki documents the various fields and their types. You then only have to provide your short name as kind of digital, updateable business card. Yes, and updateable business card, isn’t that cool? Since not all people have namecoin installed, instead of the short name alone, you can provide a link to a website that nicely formats the information : https://nameid.org/?name=ulrichard . Once namecoin is integrated with other services, you no longer need to send mass-messages to all your friends when you change your eMail-address or phone number, you just update your namecoin id record.

Categories: Software | Tags: , , | Leave a comment

Trezor BitCoin HardwareWallet

Today I received my Trezor BitCoin HardwareWallet. When I ordered it in June 2013, the expected delivery Date was October. But as it happens all that often with BitCoin related hardware, the dates get pushed back. They offered a device with plastic case for XBT 1 and one with an alloy case for XBT 3. After the Bitcoin price skyrocketed end of last year, they stopped taking pre-orders. The devices we early backers received, have a nice “First Edition” label at the back.

The trezor is the first hardware wallet for BitCoin that is mass produced. It has a small screen, two buttons and a microUSB connector. So it is actually a lot more secure than if you just stored the private key on a SmartCard, as could be done with a HW1 or a YubiKey NEO if the software was finally released. You can see the balances on the different addresses in the client on the computer. When you want to send some coins, you see the receiving address and the ammount on the small screen of the trezor. Once you confirm using two button presses, the trezor signs the transaction, and the client on the computer propagates it to the BitCoin network.

Build quality and form factor look quite nice. It is actually a bit smaller than I expected, which is a good thing. Fifteen Swiss Francs in Coins would require about the same space. I guess it helps in that regard that it doesn’t require a battery, but is powered from USB.

The first thing I did was setting it up with the browser plugin from https://mytrezor.com. It’s an easy process where you have to write down the seed which consists of 24 words. Then I sent a small amount back and forth. Only after seeing this succeed, I transferred bigger amounts to the addresses of the device.
Then I wanted to test the electrum plugin that slush recently noted, would be merged soon. I found it in a pull request on github. It didn’t work initially, but several people were quick to help. After all issues were sorted out, also sending with the trezor from electrum works fine.

It wouldn’t be a security device if it worked without entering some kind of secret. Entering the secret on the computer would make it less secure, as some malicious software could record it. Entering it on the device with only two buttons would be cumbersome, as not that many people these days are fluent in morse code. So, I was curious, how they solved that problem. The solution they came up with is actually quite nice. They display a 3×3 grid of buttons with question marks on the cumputer, while the trezor shows a 3×3 grid with digits 1 to 9 in random positions. That way, you enter your pin on the computer using a mouse or touch screen, using the positions found on the trezor screen. Even after playing with the trezor for only some hours, it’s evident that a lot of thought went into it.

I wonder what will happen next in that space.
I was not fully convinced by the HardBit. Indeed it turned out, somebody found out how to activate WiFi and bluetooth of the repurposed SmartPhone. That makes it way less secure. The developers seem eager and friendly, but it might be just not the most secure platform to begin with.
Recently I backed an interesting project called PRISMicide on Indiegogo, but with only 8% funding after half the time, it looks as if they won’t make it.
The picture and description of the BitSave from ButterflyLabs look really slick. But they have a history of overpromising and delivering late.
And finally, I’m sure SatishiLabs, the creators of trezor, will work on a follow up device that is even smaller and communicates with SmartPhones.

Categories: Projects, Software | Tags: , , | Leave a comment

veteran at last

Today my Jaguar XJS finally gained veteran status. That means it is now officially recognized by the Swiss authorities as an oldtimer car. This in turn means lower taxes and insurance, but comes with the requirement to not drive more than 3’000km per year. Also the rate of technical examinations changes from 2 to 6 years. To gain that status, a car has to be at least 30 years old, and in very good condition. All parts need to be original, and the vehicle is not allowed to have modifications. At the first attempt after I woke it from the winter sleep, the regular technical check was no problem. But it didn’t get the veteran state, as the examiner found some barely visible traces of rust  in the lower fold of the driver door. So I had this fixed by a plumber. And this time it got the veteran status.

Jaguar hast two main model lines, the saloons and the sports cars. Initially, I only knew about the saloons that mostly older executives drove. I always liked these cars, and imagined I would someday drive one myself, when I’m old and rich. Now, I still don’t consider myself neither old nor rich. But at the end of 2001 I ran into a very beautiful XJ6 series 2 with vinyl roof, that was for sale, and even affordable. Too bad, the rust already won on that car, such that it was not worthwile to restore. But that was enough to infect me with the Jaguar bug. Now that I knew that older Jag’s were affordable, I wanted to have one, and the search began. That’s how I found my 1984 XJS HE V12. I bought it in the summer of 2002 when it had 75’000 km. Because there was a strange noise coming from the gear box during the test drive, I got it a bit cheaper. Later we found out that a missing  rubber holder on the propeller shaft was responsible for the noise. This was easy to fix. In fact, I cannot confirm at all the bad reputation that the Germans like to impose on British cars. The biggest repair I had in the 12 years was refurbishing the power steering, because it leaked oil. And the funniest problem was a fizzly sound from the engine, when I had the car only for a few weeks. I thought some pipe of the exhaust gas recirculation was broken. My brother then found out that one spark plug was loose. There was no noticeable reduction in performance. Well with 11/12 of 294 = 270 hp there was still plenty of power. In contrast, when two spark plugs of our camper failed in south America, 2/4 of 95 = 48 hp, the lack of power was more noticeable.

The guy in the tyre shop told me long ago, that XJS were used for racing. But only after owning the car for almost ten years, I found out that they were actually very successful. While reading the book “TWR and Jaguar’s XJS“, I learned, that some of the XJS’s greatest victories were the 1979 canonball race, the 1984 european touring car championship, the Spa 24 hours race, as well as the 1985 Bathurst 1’000 mile race.

Categories: Uncategorized | Tags: | Leave a comment