Should You Use JavaScript For Your Blockchain Project?

blockchainAlmost 13 years ago, renowned software developer and blogger Jeff Atwood introduced Atwood’s Law. According to it, “any application that can be written in JavaScript, will eventually be written in JavaScript.” Given the huge popularity of the language and the wide array of uses that got it out of the client-side in web browsers, it’s hard to argue with that thought.

So, in line with Atwood’s Law, and given the huge boost in popularity blockchain projects are getting lately, it’s only natural to ask ourselves – it’s JavaScript the right way to go for a blockchain project? A lot of JavaScript developers would confirm that it obviously is. Some blockchain enthusiasts would argue that you should look elsewhere.

Who to believe? Well, as it happens a lot of times, there’s a middle ground that might serve as an answer. Many people are using JavaScript to create their own blockchain-based solutions – go ahead and google it, you’ll find tons of how-to articles. Yet, there will be certain projects that won’t benefit from the popular language. Here’s what you need to know.

JavaScript for Blockchain Projects

javascript codeWith JavaScript being so ubiquitous, it’s only natural for some companies and developers to look at it as a good alternative. After all, the language has been around for years, it has huge community support, and it’s incredibly advanced. Yet, at first sight, some will say that it isn’t well suited for blockchain.

You should be careful with that opinion, though. People that think that might be only considering cryptocurrencies as their main concern. Historically speaking, cryptocurrencies have been written in other languages, mainly because they rely on cryptographic functions. Thus, neither Bitcoin nor its descendants use JavaScript. NEM uses Java, Ethereum is founded mostly on Go, and even Haskell goes for an alternative with Cardano.

Even when considering cryptocurrencies alone, JavaScript is proving to be a great ally for blockchain. Options like Lisk, Ark, and Nimiq all use JavaScript in one way or another. The main reason why the do that? According to Will Clark, Full Stack Developer at Lisk, the language “ensures wide platform adoption once the tools are released.”

But there’s more to that – and it goes beyond cryptocurrencies. JavaScript’s open-source tradition plays a major role in blockchain teams. Since blockchain is mainly concerned with decentralization, relying on an open-source language is a must to keep one single party from governing a specific project or indirectly deciding its future path.

Besides, JavaScript is a language that can run in all browsers by default. This guarantees you that whatever function you write, you can use it wherever you need it. In blockchain, this means that JavaScript functions can work on nodes, browsers, command-line clients, or even auxiliary servers. All in all, this leads to greater consistency and improved efficiency when writing code.

What’s more – JavaScript combined with Node.js is enough to create programs that interact with a lot of cryptocurrency APIs in real-time. So you can build a solution in JavaScript that “talks” to those APIs seamlessly by resorting to the language you already know very well and that your team feels comfortable with.

Even in the light of all this, some people would say that JavaScript isn’t good enough for blockchain, as you’d need to go with a different language like Solidity or Simplicity to write smart contracts. While that’s somewhat true, you can use powerful tools already available to bridge that gap. Truffle, Embark or Dapple are all development environments that support the creation of solutions for smart contracts – and all of them use JavaScript.

There are also APIs like Web3.js that allows you to address the Ethereum API from a regular JavaScript code. Or there are also plugins like Metamask, which serves as a bridge between blockchain nodes and the browser. This allows you to get access to all Ethereum functionalities through the JS scripts embedded on a site.

When Not to Use JavaScript for Blockchain Projects

Up until now, it feels like JavaScript will abide by Atwood’s Law and will end up being the language of choice for blockchain projects. While that might feel true, it really isn’t – at least not to the full extent of covering the wide range of projects you can develop with blockchain.

For instance, if you want to create your own cryptocurrency platform instead of using one of the existing ones, then you’ll definitely be better off with some other languages. C++, Go, and Java might be better options, especially if you’re starting from scratch. Javascript is also a poor fit for blockchain projects that need to scale quickly or those that don’t need browser-based clients.

Conclusion

All of the above points towards the veracity of Atwood’s Law, even in the case of blockchain-based projects. While it’s true that there are some things that JavaScript can’t do in certain projects, its popularity is turning it into an attractive alternative for anyone interested in developing blockchain solutions.

That’s because JavaScript development companies, developers, and anyone familiar enough with the language can use it to come up with interesting uses. Besides, the wide array of advanced tools make it even easier to come up with new platforms, even if they require the creation of distributed applications.

In fact, it’s somewhat understandable if new cryptocurrencies and blockchain-based tools make use of it in some manner. Even if they don’t use it as a primary language, JavaScript will still be a great access point for blockchain developers and fantastic assistance in all kinds of projects.