Friday, January 02, 2015

Bitcoin was born as a spam filter

I recently learned that Bitcoin's main component: the `Proof of Work', had it's beginnings in a cool idea of Adam Back called hashcash for preventing spam.
One nice thing about hashcash is that it gives a simple way to explain the PoW concept through puzzles:

The idea is to attach a mathematical puzzle to each email someone wants to send such that:

-The puzzle will be different for each email

-Each puzzle will take a modern computer about a second to solve.

- The recipient will only accept an email if a legitimate answer to the puzzle is included.

- Checking if an answer is legitimate will only take a computer a microsecond.

Why is this useful?
The idea is that for a legitimate user spending a second of computer time is fine for each mail
he\she desires to send.
But for someone wanting to send a spam message to millions of addresses, looking for the one-in-a-million'th person who will aid him in exchange for part of his fortune that the dictator of some African country is currently confiscating, spending a second for each mail will be a big problem.

So this is a mechanism to prove that the person sending you a mail cares enough about specifically you getting it to let his computer work on sending it for a whole second! Talk about sacrifice!

How do these puzzles look like?
What you need to construct the puzzles is something called a psuedurandom function.
What this means is this is some function h such that when you give it an input z,
the output h(z) is a sequence of bits that is completely unpredictable for all practical purposes.

Now, say I want to send an email to on the date 1.1.15.
We will think of this address and date as some string of symbols x.
   x= "".

Now if the person I am sending to is using hashcash, for the mail to be accepted I have to attach a y
such that the hash of x and y starts with 20 zeros.
That is, h(x,y) is a string beginning with 20 zeros.
Since h is pseudorandom, the only way to solve this is to try *alot* of y's, 2^20 on average,
until we find a good one.

.The functions we use as h currently in the world are called SHA-1 and SHA-2.

No comments:

Blog Archive

About Me

My photo

Hi! I am a computer science postdoc. For some reason google is not finding my new homepage so I added a link from this profile