2/15/2018 7:03:13 AM
Creating an app on Blockchain technology using JavaScript
Blockchain Development,Blockchain API,Decentralized App
https://appdevelopermagazine.com/images/news_images/Blockchain-APIs-are-Make-Development-Easier-App-Developer-Magazine_eb2hb3el.jpg
App Developer Magazine

Cryptocurrency

Creating an app on Blockchain technology using JavaScript


Thursday, February 15, 2018
43,574

Blockchain technology is difficult, but with new JavaScript APIs Lisky hopes to make decentralization easier to program for developers.

As Blockchain technology comes into its own, it is becoming increasingly important for software developers and programmers to acquaint themselves with the benefits which blockchain can provide the architects and users of digital platforms and applications.

Lisk is an application platform whose Software Development Kit allows users to code in JavaScript to build Blockchain applications, without needing to be Blockchain literate. Fully customizable, apps built on Lisk can take any form, from new social media networks, games, and online stores to financial or accounting applications. In simplifying the creation of blockchain applications, Lisk is democratizing blockchain, extending the technology’s benefits to all - even those with just rudimental programming experience.

We sat down with Will Clark, Full Stack Lead at Lisky, to learn more about how developing blockchain-enabled applications through blockchain APIs is becoming easier.

ADM: From a developers standpoint how has Blockchain technology changed the approach of creating platforms?


Clark: Traditional platforms require a central authority to facilitate user interactions, whether it is a messaging platform (Twitter), a marketplace (eBay), or whatever. That hands a lot of control and responsibility to the central authority, because they essentially own the data. They are responsible for handling it securely, but they also have the power to modify or censor that data as they see fit. Building a platform on top of a blockchain removes the need for a central authority, and therefore the need to trust such an authority to handle your data responsibly.

As a developer for a centralized system, your task is ultimately to maximize the value your company can extract from its position of power in the network. A large part of that will obviously be improving the mechanisms for the relevant user interactions because a better user experience increases your network size, which gives you more power, but there’s a fundamental tension in the motivations of the various stakeholders. By contrast, when you are developing a decentralized platform, your sole focus is on facilitating user interactions, because there is no central authority. This model also encourages a more collaborative approach to development, with most projects in this space adopting an open source approach to give everyone the opportunity to improve the platforms they care about.

ADM: How will creating an app on blockchain technology change from an app developer's perspective?


Clark: Compared to traditional app structures, there is a lot that is similar when developing with blockchains. Front end applications are pretty much the same: you use the same frameworks, you still get data via an API (Application Programming Interface). The big difference is that you have much more choice regarding where your data comes from, so you can have a greater level of trust in it. In most cases you can run your own node, use it to validate all the information on the blockchain for yourself, and have your clients contact your node for the data they need.

On the back end, there is obviously a lot of work involved in making sure every node on the network ends up with the same conclusion about the state of the network, or of your application in particular. Besides that, your focus is mainly on defining and processing transactions, which in one sense is just a pure way of thinking about how users can interact with each other.

Right now we are in the very early stages of decentralized app development. It is difficult to get started, and it is very easy to make mistakes. Several projects, including Lisk, are working on these issues, to try and make blockchain development as smooth as it is using a traditional architecture. So in the coming months we will be seeing much more in the way of tooling and frameworks. Ideally we want people to be able to create decentralized applications just through a process of configuration: defining your transaction types, your genesis block, selecting your consensus algorithm if you require your own blockchain etc.

ADM: Why did Lisk choose JavaScript as the code that would be used to build applications on their platform?


Clark: Lisk’s mission is to make blockchain technology accessible to all. JavaScript is one of the most popular programming languages, especially among beginners, and it is going through a lot of interesting developments. It has now got a regular update cycle, with some important improvements added in ES2015, and major industry players are investing increasing resources in JavaScript. It also has a very strong open source tradition, which is important to us in the decentralization space.

JavaScript is the only language that is in the major browsers, so it is the only language that can be used on both the front end and the back end. This is perhaps the main factor which is driving its increasing popularity at the moment, but it is also extremely useful for us as blockchain developers. It means you can define some functionality in one place and then use it on your nodes, on auxiliary servers, in your GUI (Graphical User Interface) clients, as well as CLI (Command Line Interface) tools. When you have critical cryptographic functionality, for example, it is great to know that you are using the same code everywhere, and if a change is made on the back end nobody has to remember to update the front end function. At Lisk we’re already using this benefit to a large extent, but we will be taking it further.

ADM: What aspects of JavaScript make it a code that people still want to learn and should learn?


Clark: JavaScript is extremely flexible. It is multi-paradigm, so you can do object-oriented programming for example, but in the last few years people have been incorporating more functional patterns into their JavaScript. So it is good for learning different approaches to solving problems, while using the same language.

As mentioned before, it is the only language that you can easily use on both the front end and the back end, so it is great for anyone who wants to get going with full stack development. Since the release of ES2015, the syntax has also been greatly improved. There are also extensions to the language, like Flow for types, which add functionality which isn’t included natively.

ADM: Are there any ways in which the user interface would benefit on an app that is developed in JavaScript as opposed to another code?


Clark: By sharing code between the front end and back end, you remove a certain class of bugs which arise from those distinct code bases getting out of sync with each other. Indirectly you also benefit from the application having access to the huge open source JavaScript community, by way of contributions to the codebase as well as publicly available packages, which the app depends on (speeding up development time).

ADM: What specific knowledge of blockchain should an app developer have when coding in JavaScript?


Clark: This applies to all languages, not just JavaScript, but you should have a solid understanding of the differences between a blockchain and a traditional database. In particular you should be familiar with how nodes resolve discrepancies among themselves (achieve consensus). You should also be aware of the security issues involved, such as how a malicious node could deceive you if you are writing a front end application, and how to mitigate such effects.

ADM: What sort of apps will a user be able to create on blockchain technology while coding in JavaScript?


Clark: One major benefit of using a blockchain comes from its trustless nature. So any app where trust is an issue is a good source of ideas. For example, centralized messaging services can censor, delete, or modify your messages, intersperse them with advertising, or pass them on to abusive authorities. With decentralized applications there’s no single authority, so you can be sure such actions don’t occur without relying on trust.

Another benefit blockchain provides is in making the interactions in a network more efficient. For example, a decentralized marketplace removes the need for everybody to interact through a central authority, which means there’s no single entity taking a cut of every purchase. This is great for sellers and buyers.

The other major feature of blockchains is their immutability. Once data is in a block it is there forever, so this can help with situations where facts or timelines need to be proven. A use case here is for intellectual copyright: if you store a hash of some data on a blockchain, nobody can dispute that you had that data at that point in time.

It is still early days for this technology though, so we don’t yet know what the killer applications are.

ADM: Why are sidechains important when it comes to app development?


Clark: Sidechains are important for two reasons. One is simply space: some blockchain projects right now are experimenting with sharding and other ways of offloading storage requirements, but for now the norm is for every node on a network to store a full copy of the entire blockchain. When it comes to a decentralized application platform, that means that if every application uses the main blockchain (or “mainchain”) for data storage the size of the mainchain will grow extremely quickly. Sidechains allow a division of responsibility for data storage. As a node operator, you can choose which sidechains - if any - you run a node for. The mainchain only has data related to the platform itself, not the data specific to the applications which run on the platform.

The other reason is to isolate the functionality of the various applications from each other. If you have a single blockchain with unrestricted smart contracts, then it is possible for someone else’s application to affect yours. For example, if it turns out those contracts have a bug which allow somebody to stall the network, and somebody creates an application which bumps up against that bug (whether intentionally or not), then your unrelated application can suffer.

With Lisk, we have a limited number of transaction types on the mainchain, and no smart contracts. Application developers will be able to create a sidechain of their own, where the rules are up to them: whether they have smart contracts at all, what the restrictions are on smart contracts, which language those contracts must be written in, etc. Then if one sidechain introduces a vulnerability, all of the others are unaffected.

Will Clark, Full Stack Lead, Lisky

ADM: What level of experience with JavaScript is best to have when jumping into app development on blockchain technology?


Clark: JavaScript is multi-paradigm and there are a lot of great resources out there, so it should be fairly easy for experienced developers to pick up quickly even if they have no previous experience. As mentioned above, it is also a great language for beginners, but if you are going to be building decentralized applications, then it is probably a good idea to have experience building typical (centralized) server-client apps first. Having to deal with nodes and other aspects of blockchain development adds another level of complexity so it is not ideal for beginners.

Having said that, there is a lot of focus from various projects on making this technology more intelligible and user-friendly. In the coming years, as blockchain technology becomes more standard and learning resources such as the upcoming Lisk Academy grow, perhaps it’ll become more of a default and we can start recommending people learn to program with decentralized applications from the very beginning.

ADM: Do you see JavaScript remaining as a consistent code within the blockchain community, as it becomes more mainstream within different industries?


Clark: There are pros and cons to every language, so it depends on the aims of the individual project which language ultimately makes the most sense. But the benefits of JavaScript which are being felt in other industries apply just as much to the blockchain community, in particular the ability to reuse code across environments. To the extent there’s a conflict of philosophies in play, anyone in the decentralization space can certainly applaud the movement towards open source software that’s occurring in some of the major centralized technology companies, even if the motivations are sometimes unclear. Hopefully in the future we will see more high-profile contributions to the JavaScript ecosystem from blockchain companies, and a greater level of collaboration on these open source projects which benefit the whole JavaScript community.

About Will Clark


Will is the full stack lead for Lisky. He joined Lisk in July 2017 after working as a javascript developer at Pixsy. Will is a graduate of the University of Oxford with a BA in Philosophy and Psychology and an MA in Philosophy. You can follow Will on Twitter or Github.


Comments

There are no comments yet, be the first to leave your remarks.

Leave a Reply

co