Blockchain and Ethereum technology can be very confusing if you don’t have a background in either. It seems that every time I mention that I work for a Blockchain company, the conversation inevitably goes to how exactly it works and what it all means. One aspect that can appear daunting is understanding an Ethereum wallet. Upon first glance, it looks like a long random string of characters. Someone might copy/paste an address and forget a letter or accidentally swap two characters while typing, and it’s very difficult for a human eye to discern the correct address from the incorrect one. Thankfully there is a solution to help give a visual representation of an address: Ethereum calls them “blockies.”

Blockies

If you have or interact with multiple Ethereum wallets, it can be difficult to differentiate between them quickly. An Ethereum address is the last 20 bytes of the wallet public key’s Keccak-256 hash. As such, it can be difficult to ensure that the validity of the address quickly, with a single change in the address representing a completely different public key. It is easy for the human eye to confuse 0xb8c2e8bc21c3033c2356aea6a93853ad802654d2 with 0xb8c2e8bc21c3033c2356aea6f93853ad802654d2.

That’s where blockies can help. Blockies, or Ethereum identicons, are procedurally generated images, and use the wallet’s address as its seed. They are consistent across all mediums and allow for greater user clarity. With blockies, the same minor change in the addresses above has greater visibility. Take a look at the blockies below. The addresses are the same as the examples above, but you can easily see that they are different wallets.

 blockie 1   blockie 2

Blockies are very useful for quick differentiation between wallets. They also provide a consistent experience when dealing with different platforms and sites. This was one of the main reasons we wanted to make our blockie generator. We wanted a way to dynamically generate a blockie with different sizes for mobile and desktop use with relative ease and customizability. We were able to create a dynamic blockie generator through the use of Lambda@Edge.

AWS Lambda@Edge

AWS Lambda is a flexible serverless platform that can be used to programmatically respond to events such as uploads to an S3 bucket, website clicks or readings from an IoT device. These Lambda functions fire after the event triggers and are executed in response to these events. AWS Lambda@Edge is the marriage of CloudFront and Lambda, where Lambda functions can be deployed to and executed at the CloudFront ‘edge’.

Lambda@Edge is a relatively new technology, that has been publically available since mid-2017. It is designed specifically to respond to CloudFront events. Lambda@Edge events run during the request cycle and can modify the request and/or response that CloudFront serves.

We use our Lambda@Edge function to hijack requests to a fake S3 bucket and return procedurally generated images. It works by reading the wallet address from the request URI and then returning a PNG of the corresponding blockie. This allows for dynamic blockie generation, and does not require the use of an S3 bucket for retrieval nor storage. As such, it allows for different sizes to be returned depending on the query parameters.

There are other benefits to using Lambda@Edge with CloudFront. The functions actually run on the edge nodes of the CloudFront network, which means that it will run on the closest server to the requester. A user in Japan and another in Florida can make the same request, and receive their response in the same amount of time, as they are being processed by the servers closest to them. In addition, the images are cached on those nodes which makes response times faster. This drastically improves response time, in some cases even 2-3 times faster than other services.

Introducing: blockies.shipchain.io

This service is something that we decided to make public. It does not cost much to maintain, and we hope that the benefit it can provide others will outweigh the cost. We currently use it on our platforms and have already used it in other areas. For example, I recently participated in the ETHDenver 2019 hackathon and created an organization voting DApp. Since users can log in and vote using different wallets utilizing Metamask or Portis, it is important to show when the active wallet has changed. We were able to use blockies.shipchain.io in this project to provide a visual indicator of which wallet was currently active in the DApp.

The way to generate the blockie is simple. You can visit our landing page here, and enter your wallet address with whatever address you need the blockie for. A blockie of each size will be displayed, and you’ll be able to click them to automatically copy a link to your clipboard. Otherwise, you can use make requests to this link, blockies.shipchain.io/{wallet_address}.png, replacing the {wallet_address} with whatever address you need the blockie for. These blockies can come in one of three different sizes by adding “?size=[small, medium, large]” to the end of the request. Currently, the sizes are either 32×32 (small), 64×64 (medium), or 128×128 (large), with the default being medium.

The project is open sourced, and the repository can be viewed here. If there are any issues using blockies.shipchain.io, please file them via Github Issues.