Detect Cryptocurrency by Wallet Address

By  on  

I’ve always been a massive advocate of cryptocurrency. I love the technology, the ease of use, and the freedom that cryptocurrencies bring to the world. Despite my love of crypto, I know that adoption will take a long time and that the state of crypto is not friendly to new adopters.

One scary part of crypto is sending currency to another wallet address. Sure we currently send money via banks with routing and account numbers, but we’ve even been simplifying that with credit cards, Venmo, and Paypal. In short: sending money is always hard and unnerving.

I wanted to figure out if there was a way to feel a bit more secure about sending crypto. I found the answer in cryptocurrency-address-detector, a library that detects a cryptocurrency by wallet address.

You can install with:

yarn add cryptocurrency-address-detector

With the resource available, you can provide an address and get a relevant cryptocurrency back:

const addressDetect = require('cryptocurrency-address-detector');
 
addressDetect('0x281055afc982d96fab65b3a49cac8b878184cb16').then(cryptocurrency => {
    console.log(cryptocurrency);
    //=> 'ETH'
});
 
addressDetect('1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp').then(cryptocurrency => {
    console.log(cryptocurrency);
    //=> 'BTC/BCH'
});
 
addressDetect('LQL9pVH1LsMfKwt82Y2wGhNGkrjF8vwUst').then(cryptocurrency => {
    console.log(cryptocurrency);
    //=> 'LTC'
});
 
addressDetect('0xsfdlffsjksldfj[IPv6:2001:db8::2]').then(cryptocurrency => {
    console.log(cryptocurrency);
    //=> 'Cryptocurrency could not be detected'
});

This type of library also inherently acts as a validator for addresses for any given cryptocurrency type. If you can’t match the currency type, obviously the address wouldn’t work.

Anything we can do to make crypto easier and more confident for users will improve adoption rates. It’s also great that we have utilities that can make out a currency just from a wallet value.

Recent Features

  • By
    fetch API

    One of the worst kept secrets about AJAX on the web is that the underlying API for it, XMLHttpRequest, wasn't really made for what we've been using it for.  We've done well to create elegant APIs around XHR but we know we can do better.  Our effort to...

  • By
    9 Mind-Blowing WebGL Demos

    As much as developers now loathe Flash, we're still playing a bit of catch up to natively duplicate the animation capabilities that Adobe's old technology provided us.  Of course we have canvas, an awesome technology, one which I highlighted 9 mind-blowing demos.  Another technology available...

Incredible Demos

  • By
    Smooth Scrolling with MooTools Fx.SmoothScroll

    I get quite a few support requests for my previous MooTools SmoothScroll article and the issue usually boils down to the fact that SmoothScroll has become Fx.SmoothScroll. Here's a simple usage of Fx.SmoothScroll. The HTML The only HTML requirement for Fx.SmoothScroll is that all named...

  • By
    Use Custom Missing Image Graphics Using MooTools

    Missing images on your website can make you or your business look completely amateur. Unfortunately sometimes an image gets deleted or corrupted without your knowledge. You'd agree with me that IE's default "red x" icon looks awful, so why not use your own missing image graphic? The MooTools JavaScript Note that...

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!