Category Archives: Uncategorized

Bitcoin

I spent some time last night wrapping my head around how bitcoin works.  Here’s a summary that I wrote up for a friend earlier today. The summary is a bit on the technical side.

The heart of the system is a global, public ledger listing all transactions on the network.  The ledger is called the “block chain”, a term derived from the underlying tech.

Balances are held by ‘addresses’ which function much the same way as bank accounts.

  • An “address” is the public side of a public key / private key pair.
  • Transactions can only be initiated by the address owner, who has the private key.
  • Transactions are authenticated by any number of peers on the network, using the address’ public key.
  • New addresses are cheap to create, and can be created by anyone at any time.  It is common for people to use many many addresses.
  • The balance for any address may be derived by locating the first appearance of that address in the block chain, and rolling forward all transactions in the block chain involving that address.

Transactions are committed in batches called “blocks” about every 10 minutes.

  • The network requires an expensive computation to be performed in order for the for transaction set to be committed to the public ledger.
  • The computational cost protects the network against fraudulent transactions.
  • The computation is a hash of the transaction data, the previous block’s hash, and a number called a “nonce”.
  • The fun part: the hash must begin with N zeroes, where N determines the computational difficulty.
  • The higher N is, the harder it is to find a nonce that produces a qualifying hash.
  • Why?  Because we don’t know a-priori what nonce will produce the needed number of zeroes in the hash, and must brute-force the computation by trying different nonces until one is found.
  • The higher N is, the lower the number of qualified hashes, and therefore the harder it is to find a nonce.
  • The network moves N up or down over time as described below.
  • Because each block hash builds on the previous block hash, the blocks form a “chain” which is very computationally expensive to rebuild once it is set.  This protects the network from fraud.
  • The network incentivizes this hard computational work by rewarding the committer with newly minted bitcoins.
    • The people who do this work are called “miners” because the net result of their work is like mining gold.
    • It is a competitive business.
    • Only one miner can commit a block of transactions and get the reward.
    • Miners race to be the first to commit a block, deploying electricity and hardware to gain bitcoins.
    • The network adjusts N to maintain a pre-determined rate of bitcoin creation as hardware improves and miner interest fluctuates.

    Dude, where’s my git repo?

    Imagine you’ve joined a startup as the tech lead. The founder has a prototype, which she built with a contractor. Conveniently, the contractor hosted the code on github, so you fork the repository and you’re off and running. Months of building go by. The contractor, while still friendly with everyone, has moved on.

    One day, you go to push your latest commits to github, and you get an error message that the remote repository cannot be found. You log into github, and the repository is gone. All traces of it have disappeared.

    What happened? It turns out that Github treats private repositories in a special and unexpected way: private forks disappear when their ancestor is deleted from github. So when the contractor, needing to free up space in his account, removed the prototype repository, all its children went with it. Caveat emptor.

    This might sound scary, but since every git repository carries its history, it’s actually pretty straightforward to recover so long as you have an up to date clone of the repo handy. Here is the procedure:

    1. On github, create an empty private git repository having the same name as the old one, in the same github account as your fork.
    2. On a machine containing a checkout of the code, make a bare clone of the repo and mirror it to the re-created repo on github:
      git clone --bare /path/to/code /tmp/repo.git
      cd /tmp/repo.git
      git push --mirror git@github.com:username/repo.git
    3. Now you can fetch, pull and push in the original checkout as if nothing happened.

    Fifty-Fifty Spaghetti

    Try this some time: when making spaghetti, use half regular noodles and half whole-wheat noodles.  The latter have lots of fiber making for a hearty and filling meal, but for most sauces I find them to be a little too heavy.  Cutting the whole wheat with regular pasta gives a light taste while retaining some of the good stuff.  My kids, who normally eschew all things fibrous, barely notice the difference and happily wolf it down.

    Hello again, world

    This is another test. We’re doing some additional posting to help root out an issue with the circonflex A’s that appear between sentences. Let’s see how it goes.

    How about sentences with two spaces.  Do we get a different result?

    Hello, world

    This is a test of posting to the blog from a new writing environment. Let’s see what happens. Postscript: it worked! (mostly)

    This is a second test.  I’m using the same post to try it out.  Let’s see what happens.

    What Lyfe Kitchen can learn from the iPod Shuffle

    This month’s Wired magazine features a profile of Lyfe Kitchen, which aims to serve up health- and eco-conscious fast-food on the scale of McDonald’s. It’s a fascinating and inspiring idea, something that could change the food system and public health for the better. Read the profile, it’s worth the ten minutes.

    The end of the piece focuses on the challenges to scaling up. Consider for example the challenge of seasonality:

    No matter how energy-efficient the kitchen, no matter how technically astute the procurement practices—weather happens. Too much rain rots tomatoes. Oranges freeze. Texas onions shrivel in a drought.

    The assumption is that the restaurants require a steady supply of the same ingredients month in and month out. After all, the menus will be the same year-round, right?

    This got me thinking about the iPod shuffle. Bear with me here. I still remember wondering how small Apple would take miniaturization as we went from the iPod to the Mini to the Nano. The devices couldn’t get much smaller, because soon there would be no room for a screen, and what good would an MP3 player be without visual feedback to select songs and see what is playing? The genius of the shuffle was to take that bug and turn it into a feature. What the heck, let’s name the device after it: “No screen? No problem? This device is for shuffle mode!”

    What does all of this have to do with Lyfe Kitchen? How about we make seasonality a feature, designing the menu and diner’s experience to bring us closer to the farmers, closer to the weather. Make us a part of it and we’ll take more pleasure in our food, missing fondly the items that are out of season, eagerly awaiting their return and enjoying the novelty of a new item that nature brought our way.

    Rdio remote control mode

    I use the online service rdio to listen to music. One of the “features” of the service is that you are limited to a single stream at any given time. If you’re active on one device, other devices display a note indicating that the stream is playing somewhere else, and an option to re-route the stream to device you’re on. But there’s also an option to control playback on the currently streaming device…Remote Control Mode.

    The upshot is, you can have Device A driving your hi-fi speakers while you work at, and select new music from Device B across the room. Brilliant.

    Moved to bcc

    Just came across an interesting mail technique called “moved to bcc”. Here’s how it works

    1. You introduce me to a friend of yours and finish off with some variation of “okay, have fun!”
    2. I want to thank you for connecting us but not keep you on for the details.
    3. Instead of cc’ing you, I bcc you and say “Thanks! (moved you to bcc)”.
    4. You get the thank you message.
    5. When your friend replies to me so we can get to talking, you’re gracefully freed from the thread.