Design Blog 2: Identicons
How can users easily recognize addresses?
What is an Identicon?
An Identicon is a visual representation of a hash value. In the words of the originator:
I originally came up with this idea to be used as an easy means of visually distinguishing multiple units of information, anything that can be reduced to bits. It’s not just IPs but also people, places, and things. IMHO, too much of the web what we read are textual or numeric information which are not easy to distinguish at a glance when they are jumbled up together. So I think adding visual identifiers will make the user experience much more enjoyable.
— Don Park,
Today Identicons are used in a broad spectrum of applications such as Github’s default avatars:
or to visualize addresses in Ethereum wallets:
Do they have to look so weird?
Since Nimiq aims for better usability than conventional cryptocurrencies we weren’t satisfied with state-of-the-art Identicons. They seem to be designed for more tech-savvy audiences and look neither nice nor well distinguishable for the average user. Let’s not even speak of memorability.
So we’ve done lots of research on various Identicon libraries and the only one generating appealing results was Robohash. Instead of generating abstract shapes, Robohash assembles random robots from a predefined set of bodies, heads, eyes, mouths and accessories. This approach decreases the total amount of possible Identicons, but it increases the amount of distinguishable and memorizable Identicons:
Are they secure?
Lets calculate the number of different robots we can generate:
- There are 5 different body parts
- There are 10 different shapes for each body part
- There are 10 different robot colors
- There are 10 different background colors
In total that’s 10⁵ * 10 * 10 = 10 000 000 different robots. That’s not even close to the number of different addresses which is ~2²⁵⁶ = 10⁷⁷. Though it’s probably impossible to generate anything close to 10⁷⁷ different, well distinguishable, well memorizable Identicons on a 128x128 pixel canvas, just because humans capacity in processing images is limited. Therefore Identicons can never be a security measurement and they can never replace the need to carefully check an address before confirming a critical transfer. Even though their entropy is neglectable in comparison to the address space, to quickly get an overview of your transaction history or to distinguish your own accounts, Identicons are very valuable.
The original Robohash library is designed to run on a server. Though for an wallet application you don’t want to call a server to render your Identicon, because that would violate your privacy since you’d have to tell that server your address. Therefore we needed to port the rendering code from the server to the browser.
The original library layers multiple PNGs of body parts on top of each other to assemble a robot. The database of body parts is about 3.5MB which is way too large to ship it in a web app. So to port the library we wanted to compress the image database by a factor of hundred down to about 35kB.
Compressing the PNGs that much would look horrible so we took a different approach and converted the PNGs to SVGs and compressed them with SVGO even below our target to about 24 KB gziped SVG+JS which creates perfectly scalable, well distinguishable and well memorizable Identicons:
Can we make it faster?
Can we have Nimiq-style Identicons?
As part of Nimiq’s branding we establish a pattern of repeating the hexagon shape of our logo in our user interfaces. Therefore it was obvious that we wanted our Identicons to be hexagons, too. So we used SVG clip-paths to give them a nice shape, and filters to add a slight shadow beneath. The final result looks like this:
Robohashs beyond Nimiq
Our port of the Robohash library is open source and contributed to the public domain. We’d love to see other projects use our library and help us enhance the code and maintain the repository.
DISCLAIMER: None of the statements must be viewed as an endorsement or recommendation for Nimiq, any cryptocurrency, or investment product. Neither the information, nor any opinion contained herein constitutes a solicitation or offer by the creators or participants to buy or sell any securities or other financial instruments or provide any investment advice or service.