Short Linkblog: 10 Technology Elements of a Blockchain

The blockchain and its various implementations are a wonderful example of technology changing the world. By using a distributed ledger that rewards more people maintaining a true copy, a viable replacement to fiat currencies is now possible.

When I first heard about blockchains, I thought it must use some esoteric technology. This view was easily reinforced by how frequently academic terms like “white paper” and “proof of work” are referenced in the blockchain world. When I started digging deeper into the bitcoin stack however, I found that most of the concepts used were very simple. In fact, I now think that Satoshi was a genius not in that he advanced the state of the art in computer science, but as befits a great engineer, he combined several widely disparate but simple concepts in the computer science & engineering world to create something truly unique & compelling.

What are these concepts? I’ll try to list down 10.

  1. Public-Private Key Cryptography: for blockchain identify & signing.
  2. Peer to Peer & Multicast: Easily find and talk to other nodes. First pioneered by P2P file sharing way back!
  3. Unspent Transaction Output (UTXO) [more detail]: for simplified ledgers.
  4. Merkle Trees: for efficient storage & verification of transactions.
  5. Proof of Work Mining: Algorithmic Problem Solving as a reward mechanism.
  6. Block Creation [more detail]: Use previous block hash + transactions to create block.
  7. Building a Blockchain: Distributed order creation to avoid double spends.
  8. Blockchain Forks & Resolution: Longest chain wins.
  9. Difficulty Adjustment [more detail]: to increase difficulty with mining power, and ensure that blocks are generated in uniform time.
  10. Independent Transaction Validation: Every node independently verifies transactions before storing in pool. There is no trusted actor!

So there you go! 10 concepts that you have to grok, and then combine to form the foundations of blockchain-based payment networks like Bitcoin. This should easily be a good weekend read 🙂

 

Replr: Easy Command-line REPLs

I built a small utility this week to help anybody start a REPL in any language stack[1], with any libraries of their choosing. It’s built on top of docker, and it was a fun exercise for a couple of days to build something that’s I’ll personally use quite a lot when trying out new Ruby gems.

So instead of creating a Gemfile, making sure that its syntax is correct, installing the version of Ruby you’d like via rvm, instead, you just type in a single command:

replr ruby chronic

& your REPL is ready!

Do check it out at Github and gem install replr

A few things I learnt while building this:

  • I wanted to keep dependencies low (because this is something people will install as a binary into their machines), so I did all the argument parsing et. al. manually. It’s not that hard or clumsy at all. replr currently has 0 dependencies.
  • I used Visual Studio Code as the editor for building this, and its quickly becoming my go-to editor for every kind of code editing. I was one of the last few folks holdouts at Textmate 2, and while VSCode is still not native enough for my tastes, the breadth & depth of its editor and tooling integration is hard to live without now.
  • Speaking of VSCode integration, I’ve heavily used the Ruby editor integration to make sure code conforms to Rubocop​ guidelines. It’s nowhere near as good as Prettier​ on JavaScript though. Prettier just has you spoilt with its auto-formatting & opinionated code rewriting. I feel Ruby can really use a tool like that.

[1]: Well, it currently just supports Ruby, but am planning to add new stacks soon!

Trip to Hampi

Uma & I went on a trip to Hampi recently. It’s an easy place to travel to if you’re based in Bangalore: we took an overnight train to Hospet (& then an auto ride on to Hampi), but you can go by road—take a car or a bus—or even a flight if you’d like.

L1047856.jpg
The north side of the river seems drier, and these sort of spindly trees are everywhere.

This was one of the best trips I had in recent memory. Hampi in its heyday, as part of the Vijayanagara empire, must have been one of the most wonderful places in the world. The extent and immensity of the ruins, and the stories and legends behind each are simply mind-boggling. There are rock pillars that make sounds of musical instruments. There are huge street markets made of stone that used to sell diamonds.

L1047935.jpg
Hieroglyphics anyone?

The Vijaya Vittala temple is just a work of art. If you drive around the Hampi area, every 200 metres or so, you come to a random protected monument: it has no name, but it looks as sweet as any Roman ruin. If you think North India is teh shit, do visit Hampi: the ruins and the glam on display here puts to shame any North Indian monument.

L1047861.jpg
Monkeys are constant companions wherever you go in Hampi.

We stayed at Shanthi guest house during the 3 days we spent at Hampi, and it’s a good enough place to stay. The ruins of Hampi are bisected by the river Tungabhadra, and touristy guest houses are on the north side of the river. The south side is where most of the important sights to see are, but staying on the north means that you can take a good break from all the walking around and just chill.

L1047871.jpg
Both greenery & dry stones. Hampi is a study in contrasts.

The first day we took a scooter (around ₹600 bucks a day + fuel), and traveled around the North side of the temple. We saw:

  • Pamba Sarovar & Lakshmi temple, which you can safely skip. Pamba Sarovar sounds awesome, but it’s just a temple pond.
  • Anegundi: Chinthamani temple, which is cool. This is apparently where Bali & Sugriva fought.
  • Hanuman temple/Monkey temple. This is one of the those places that I struggled to climb up the 575 steps to the temple. Having asthma and long climbs is not a fun combo. My brain went into reptilian survival mode by the time I got up to the temple. It’s a good enough place if you just want to checklist it out.
L1047886.jpg
The Virupaksha temple. By half.

There are good places on the north side of the river if you want to have food: a notable mention is German bakery, where they have low-floor seating and great desserts.

L1047924.jpg
Old Kannada writing is everywhere.

The next two days we spent south of the river, returning by 5.30PM when the last ferry starts. There’s a truckload of places to see here, so I would recommend at least 3 days for this part as we found it a bit rushed. Here’s some notable stuff we saw:

  • Virupaksha temple is the main temple still functioning just on the banks of the river. It’s huge, with immense towers all around and has nooks and corners with a lot to explore.
  • Kadalekalu Ganesha & the Monolithic bull are cut from single pieces of rocks. The figurines have deteriorated quite a bit, but it’s still an impressive sight.
  • Hemakuta temple area south of the Virupaksha temple is a series of several temples and structures. It’s one of the first such places I’ve visited and you can spend a long time wandering around the area and taking photos of odd structures (which is what I did).
  • Elephant stables are a cool structure just outside the Zanana enclosure. I kept picturing the huge place alive with Elephants and their trumpets.
  • The black stone Pushkarni is also a good visit. You can’t climb down into its depths unfortunately, but I’ve always been fascinated with old Indian well constructions.
  • Vithala temple was the best temple structure we saw. This is the place that has large complexes surrounding the main temple, a dance hall with instruments from stone, and a Konark ratham duplicate (that has a great backstory).
  • Mathanga hill is the iconic Hampi sunset destination. It’s calm, quiet and peaceful, and the sun contrasted with the greenery and the mountains, and the temple structures leads to great shadows all around.
L1047930.jpg
Doesn’t this remind you of Roman viaducts?

There’s a lot more that we saw, but the ruins start to blur into one another after a while. It’s a place where you can spend a week or more though, slowly enjoying the old structures.

L1047933.jpg
The black stone Pushkarni.

I would love to learn more about the rise and fall of the Vijayanagara empire. And since I love to read historical fiction and alternate history, I would love to read about stories about the empire. It must have been a great place in time.

New Year Trip to Maldives

Had a wonderful time at Maldives recently. Uma, Gautham, Mekha and me went there for the New Year, and it was one of the best beach vacations I’ve had. Maldives is probably the closest best beach and coral destination to Kerala—it’s just one hour away by flight from Trivandrum.

It’s a huge island country in terms of total land and sea area, but the proportion of land to sea is skewed a truckload: most islands are less than a kilometre long, and far from each other. We stayed in Maafushi, which is touristy, but also affordable, and visited Guraidhoo and Gulhi. To just to give you an idea about how that looks on the big Maldives map, here’s some map porn:

Screen Shot 2018-01-06 at 3.19.54 PM
Yes, that’s pretty much the entirety of Maldives that we saw.

This also means that Maldives is a destination you can go to many, many times. Next time I want to go to the south. Fun facts and observations:

  • The language spoken is Divehi, which is an Indo-Aryan dialect, much like how Sri Lanka has Sinhalese. I would love to understand which seafaring aryan tribe (from India?) first spread this language to these countries, and why they don’t have Dravidian roots instead.
  • The English word atoll is from Divehi atoḷu. Very appropriate!
  • Snorkeling in the Maldives is just divine. The first time I put my head under water, I had a mindgasm. We snorkelled along the shore, the coral reefs, and the deep sea.  There’s so many places near to Maafushi that you can snorkel and see everything from turtles to octopuses to fishes, and dolphins in all their spectral colours. It’s just wonderful.
  • We did a Discover Scuba dive, and it was good, but not as great as the snorkelling. I missed the fact that I wasn’t in control, and there was just too much gear in the way. Should do this again though!
  • Maldives is a dry country without alcohol, but if you stay at Maafushi, it’s pretty easy (and expensive) to get bottles. We got whiskey and vodka for around ₹8K a bottle.

And as usual, took some pictures with my Leica. It was hard to get the camera out with so  much water (& fun in the water) in the way.

L1047799.jpg
This was a wonderful place. By the sea, under the shade, on a swing.
L1047772.jpg
These kinds of chairs (I call them a mini hammock), were everywhere. Not so good for my back though.
L1047809.jpg
The streets were all unpaved. Good enough for an island just a kilometre long.
L1047817.jpg
We did do some water-sports: kayaking (ok), jet-ski (fun, but hell on my back), catamaran ride (awesome, especially how the wind drives the boat), and fun boat (Uma loved this).

In short: great trip with fun people. Should do this again.

A Trip to Bekal

So Uma took me on a surprise trip to Bekal recently, and it was a lovely break. We got to stay in an old Nair Tharavadu that has been converted into a homestay, and the food there was just plain amazing.

I took along my Leica, and got some nice photos.

L1047352.jpg
From the Bekal fort. A great old ruined fort.
L1047380.jpg
The fort has these nooks and corners that lead to some really nice light.
L1047415.jpg
When we went on an unofficial thoni ride.
L1047444.jpg
Some good light at the numerous beaches that dot Bekal.
L1047451.jpg
The “Grandmom” of the tharavadu where we stayed. Wonderful family, great conversation and amazing food.

Having used the Leica for a bit more, here’s my observations:

  • It’s a 10 year old camera, and that shows. If I had more of a budget, I’d have bought the M9, the M240, or maybe even the M10. But the Leica experience is very immersive for shooting photos. I’m more focused on the scene and the feel of the photo than fiddling around with camera controls.
  • I’m not so enamoured with the shoot RAW, use Lightroom RAW conversion, and get a JPG workflow that I’m using now. Even though it provides me a lot more flexibility, I’m more of an in-camera conversion guy. Might be that I’m spoilt by the great Fuji X100S filters.
  • There’s no beating the Leica colours, especially the M8 black and white shots. Even the colour shots — the greens have an otherworldly feel.