Thursday, February 17, 2011

Cryptographic Currency

I've recently become interested in Bitcoin, which is a form of cryptocurrency. The idea of cryptocurrency is to limit the supply of the currency using a purely computational mechanism.

Like any good accounting system, cryptocurrency involves a series of transactions between accounts. In other words you add or subtract a number from the original number. The goal is to do this accurately, in a manner such that once the transaction has been entered it cannot be changed -- only new transactions can be added.

The mechanism used for encryption is called hashing. Any sequence of bits can be used to generate a single 256-bit number (or whatever length is desired) which is mathematically related to that sequence. Any peer can check whether this number matches by regenerating it from the same starting conditions. This makes it practically impossible to fake a transaction.

Bitcoin also has a mechanism to prevent inflation -- no currency can possibly be added without the approval of all peers (i.e. other bitcoin clients), and they are all programmed to only add currency under strict mathematical conditions. Specifically, where a transaction hash is discovered that is below a certain predetermined target value. The lower the value the harder it will be to find, and the clients all .

Originally, the idea was that everyone would contribute CPU time to discovering these unique hashes while simultaneously encrypting account histories. However, someone discovered that you can get a lot more bang for your buck using a the GPU (graphical processing unit) of a graphics card. The reason for this is because they let you attempt many hashes in parallel instead of one after another.

However not all graphics cards are created equal. My computer has an NVIDIA 9500 card, and gets about 5494 khash/s. This might sound like a lot of hashes (and is far faster than a CPU), but it takes 235 days, 5 hours, 38 minutes to find one matching hash at the current difficulty rate. For my trouble, the peers are programmed to grant me 50 additional bitcoins (a number that will drop over time, being cut in half every 4 years). A more powerful card is the Radeon ATi 5970 with dual Cypress XT GPU chips. This insanely overpowered gaming device costs about $600 and can solve a block in about 2 days!

Tuesday, March 13, 2007

Python, Perl, Forth

Python: Clever. Named after the comedy troop Monty Python, this language packs a lot of power into every function and feature. You find surprises around every corner, but you have to keep your eyes peeled or you won't "get" them. It keeps the amount of stuff you have to type to a minimum, so it's incredibly productive.

Perl: Newbie-friendly. This language combines incredible power and flexibility with a syntax that, although slightly ugly and perhaps even clunky, is extremely easy to pick up. Each function is very well documented, and everything can be done in More Than One Way -- so you can easily mimic the style of your favorite language.

Forth: Powerful. Invented by Chuck Moore in the 60s, this language at it's finest is basically a dictionary, some simple stack-based primitives, and an interpreter. You start at the bottom and work your way up, learning much in the process, especially how to factor your code. In Forth you can tell right away if your code has unnecessary complexity -- it's all right there in front of you.

I initially learned Perl, and still use it for most things involving text processing where my knowledge of Bash scripting doesn't suffice. Then I turned to Python, when I was interested in creating a Multiuser Dungeon (MUD) program, and learned a lot -- but couldn't quite master it. Lately I have spent several months (over the past 2-3 years) learning Forth, specifically RetroForth. It is a real eye-opener when you have to allocate your own memory on the heap, even for simple string manipulation.

This week I went back to studying Python. I think in terms of productivity and fun job opportunities, this likely holds the most promise. But I won't neglect the other languages I have studied, including Scheme, C, C++, and even Java. Each gives useful perspective and teaches one to think like a computer scientist in different yet important ways.

Sunday, March 11, 2007

What is Brainwave Entrainment?

Before you try any of the plethora of products out there utilizing binaural beats, check out this free open-source project: http://uazu.net/sbagen/. It is easy to use and can generate powerful scripts.

Now that you have a tool to try this out with, I shall endeavor to explain how this phenomenon works. Human brainwaves are divided into roughly four categories:

  • 0.5-4 Hz - Delta
  • 5-8 Hz - Theta
  • 8-12 Hz - Alpha
  • 13-30 Hz - Beta
The human brain tends to generate a lot of different waves at any given time. But one particular frequency will dominate. Delta dominates during deep sleep and sleepwalking, and Theta during REM sleep and vivid dreams. Alpha dominates during periods of relaxation and the early stages of falling to sleep, and Beta dominates when you are wide awake.

When you see or hear a stimulus at regular intervals, this generates a similar frequency in the brain. It's similar to hearing a tune and wanting to sing along. The main trouble is that your ears can't hear frequencies lower than about 30 Hz. That is where binaural beats come in.

If your ears hear two frequencies, one in each ear, the difference between the two is heard as a third tone. For example, 440 Hz in one ear and 450 Hz in the other ear comes off as 10 Hz. If you have it tuned to 1 Hz, you can tell even more easily -- that's one beat per second. So for example 100 Hz in the left ear and 101 Hz in the right ear produces a steady pulsing sound, which incidentally corresponds to a Delta frequency in your brain.

I am still in the process of testing brainwave entrainment at various frequencies. They appear to make me tired, energetic, and euphoric at various times. Theta and Delta unsurprisingly make me sleepy -- not something I necessarily want when I'm trying to get work done. Sometimes I just get a headache (probably from too high of volume). I believe when I find the right mix, it will be a very powerful personal development tool indeed.