Wednesday, August 23, 2017

Crescent Suns Everywhere

Yup, I saw the total eclipse, in a nondescript town called Gaston, SC.

Nope, pictures will never do it justice, I will not even try to show you one.  If you want to experience a solar eclipse, you need to go and see a solar eclipse.  I can, however, show you a picture of something that I thought was amazing....

Right before the sun disappeared, openings in the tree branches above converted to thousands of pinhole cameras, each projecting a mini crescent sun.  No-one had ever told me that totality would be precipitated by dancing crescents painted upon earth everywhere, this took my breath away.


Here we stand in the quickly dimming sky, awaiting the moment....



Monday, August 21, 2017

Pancake FAX Machine

Our Holiday Inn in Aiken, SC seems to have a pancake FAX machine....  


Press a button, and pancakes come out.

Sunday, August 20, 2017

Never Stare at the Sun

I've always known it's a pretty bad idea to stare at the sun, but it wasn't until I started researching the eclipse that I discovered *how* bad of an idea it is.  We all know that you can "burn your retinas", which, yeah, sounds pretty terrible, but I thought that this was more of a metaphorical "ohhh-this-menthol-patch-kinda-burns" kind of thing, more like a fluff local late night news warning, "common household item can kill your dog, news at 11".

In fact, if anything, it is much worse....

Let me explain using a story we will all be familiar with....

Bad child holds magnifying glass over ant.  Sun beams focus on ant.  Ant incinerates.

That is *exactly* what would happen in your eyeball.  *precisely*, *literally*

The lens of your eyeball is a small magnifying glass, evolved to focus light beams precisely to a point in the middle of your retina.  Point this tiny magnifying glass towards the sun, and you incinerate what is behind it.  Let's rewrite the above story as

Clueless human holds eyeball-lens over delicate rods and cones.  Sun beams focus on rods and cones.  Rods and cones melt.

Sorry to be so graphic, but you would literally cook your retina, and boil that fluidy stuff inside your eyeball whose name nobody knows.

This is pretty serious stuff.  Using a lens, you can ignite foliage.  You can start a fire using dollar store reading glasses.  This guy starts a fire with nothing other than the concave reflective bottom of a pepsi can.  Here is a case where a telescope pointed in the wrong direction may have burned down part of a house.

This guy thought it would be funny to hold a magnifying glass over his buddy.  His buddy didn't agree.

And it is even worse than that.  Your retina doesn't have any pain receptors in it (why would it?), so you don't actually have any sensation to warn you of what is happening.  In fact, according to this guy, if anything, the discomfort of looking at a bright object decreases as you partially blind yourself.  And unlike your skin after sunburn, the retina will never heal.

On the bright side, if you ever find yourself alone and afraid on a deserted island with just a pair of reading glasses and a can of beer, you now know how to start a fire or boil some water....  You're welcome.

One last note: Every last bit of this warning is applicable to cameras also.  Remember this if you decide to film the whole eclipse using your iPhone.


(No ants were harmed in the writing of this post.)






Thursday, August 17, 2017

Statistical Impossibilities


In Ethereum, data is stored by its hash (256 bit Keccak, to be exact).  Blocks point to their parents via hash, contracts are conjured up via hash, even that measly amount of Ether you purchased in a panic because the price was going up quickly back in April is stored in a data structure in a Patricia Merkle Trie on top of a LevelDB that you call up by....  256 bit Keccak hash.

I've trained a bunch of people on the guts of Ethereum over the last couple years, and every once and a while I get the hash collision question:

  -Hashes aren't unique.  Eventually, isn't someone gonna obliterate my Ether??

Yeah, hashes aren't unique.  This is kinda obvious by the fact that the number of hashable things (aka- *all-possible-data-sets*) is larger than the number of 256-bit hashes (ie- infinity > a finite value), so eventually you're gonna start having to reuse those hashes.  So it is technically *possible* that I will wake up one day and my super-secure-banking-smart-contract will have been replaced by a prototype for a soup sharing app....  But it isn't gonna happen.  It is a statistical impossibility.

Banks know this.  They are so confident that you aren't going to stumble upon an arbitrary large number, that they base their cryptography on it.

But, even if unlikely, as a developer, isn't it best practice to account for all possibilities?  Shouldn't you always write some code to (at least) warn that a catastrophe is occurring?

No.     No you should not.

For comparison, here are 10 things that are more likely than a single collision between two 256 bit numbers (a 1 in 1077 likelihood).

1. You will be run over and killed by a car *today*: 1 in 109

2. You will be killed by a lightning bolt: 1 in 107

3. A coconut will fall on your head, and you will die: 1 in 108

4. An asteroid will destroy humanity *this week*: 1 in 108

5. In the *same minute*, a television will fall on you and crush you, a tornado sweeps in from the sky and violently tosses you, then a shark eats you, all killing you.  Also, in that same minute, a coconut falls on your head, killing you again:
(1 in 1016) * (1 in 1012) * (1 in 1016) * (1 in 1016) = 1 in 1060

6. You will be the next president of the USA: 1 in 108
(assuming, of course, you are a citizen of the USA....  The chances go down a wee bit if not, but definitely not all the way down to 1 in 1077)

7. You will win Powerball 4 times in a row, and then you will win Mega Millions 4 times in a row: 1 in 1066

8. One day you will wake up with an uncontrollable Swedish accent, that will forever make it look like you are making fun of Swedish people: 1 in 1010
(it is only 1 in 108 that you will contract foreign accent syndrome, and extra two orders of magnitude that it be Swedish)

9. You have a plant growing inside you right now: (I don't know the probability, but it has happened at least once in our lifetime, so presumably higher than 1 in 7 billion)

10. The 10 top Ethereum developers all die of a heart attack tomorrow, leaving the Ethereum foundation in chaos: 1 in 1053



And remember, 1053 may sound like it's kinda *almost* as big as 1077, but that ain't how exponents work.  You would have to live in 1024 universes where the top 10 Ethereum developers die of a heart attack tomorrow (that is a billion billion million universes) before a single Keccak cracked.



But, you say, on the blockchain we have more than 2 hashes that can collide.  Certainly the chances of a single collision go up if you have, not 2, but many hashes floating around.  This is a very well understood problem, and it turns out that even with a billion hashes the probability of just one single collision just drops to about 1060.

OK, what about a deliberate hack that searches for a collision?  Could a shadowy figure engineer the downfall of the financial system with sufficient computing power?

Well, *maybe* Keccak will be mathematically cracked someday (or already, in a musky underground NSA lab), perhaps using a quantum computer, but unless this happens, I am not going to lose any sleep.  For instance,

1. Consider the brute force search, on a single super fast computer that can perform 1 billion Keccak hashes per second (real numbers are a few orders of magnitude slower).  Crack time would be 3*1060 years = 1050 "the-length-of-the-universe"s

Maybe you could string together a bunch of GPUs and speed this up using parallelization?

2. Consider the brute force search, on a massively parallel computer where we have converted all 1050 atoms on the planet earth (including all that lava) each to an individual, fully functional computing CPU core that can each perform 1 billion Keccaks in a second.  Crack time would be 1010 years = 1 "the-length-of-the-universe"s

or

3. Consider the brute force search, on a massively parallel computer where we have converted all 1068 atoms in the galaxy, each to an individual, fully functional computing CPU core that can each perform 1 billion Keccaks in a second: Crack time would be 0.01 seconds

Hey, 100 per second!  Now were are getting somewhere! (of course you will have to wait on average another 105 years for this information to propagate to you through the now-galaxy-computer at the speed of light).

If these laughable scenarios haven't convinced you of the impossibility of a collision, in case you still feel that it *just-can't-hurt* to add that code to deal with a hash collision, let me leave you with one final statistic:

1. The chances that the (difficult to test and never triggered) code you write to deal with a hash collision will add destabilizing bugs to the code: pretty close to 100%