JavaScript dapps: Build decentralized apps with Blockstack

Blockstack demystifies app development on the blockchain, providing the tools and network that put users in full control of their data

JavaScript dapps: Build decentralized apps with Blockstack
Cybrain / Getty Images

While Bitcoin has its ups and downs, decentralized apps or “dapps” remain a hot topic in software development circles. “Smart contracts” tend to be part of the same conversations, implying that you need to learn new programming languages, development practices, deployment strategies, security testing, and the list goes on. But writing dapps doesn’t have to be so complicated.

Blockstack is an open source project and an internet for decentralized apps. Blockstack combines a technology stack and set of libraries that enable simple development of dapps, where users are always in full control of their own information and key interactions are persisted to the blockchain. In the next few weeks, we’ll get to know Blockstack and build a simple app that demonstrates how easy it is to get started.

What is Blockstack?

I won’t go into the full description of the components, motivations, and functionality of Blockstack here, but we can dig into enough of the basics to build a dapp ourselves. From an application development standpoint, all you need to know about Blockstack is that it provides two things for you: a user authentication layer and a storage layer.

The user authentication layer allows for single-sign on within any Blockstack application. This is essentially a federated authentication mechanism that allows a user to sign up once and immediately be able to use any number of Blockstack applications with the same credentials. When users sign up, their user IDs are recorded on the blockchain, and they can begin associating metadata with those IDs, such as personal profile details or social media accounts.

The other key layer in Blockstack is the storage layer, which gives users the ability to configure self-owned data lockers. Any data users want to save that relates to the application they’re using goes to their own locker instead of some centralized server owned by the company that developed the application. For example, when you write and store files in a cloud service like Google Docs, the service has full control over your content. Google can remove your content without warning—and in fact has done so in the past. By contrast, with a Blockstack application like Graphite, the content you write is in your control at all times.

How to use Blockstack

You can work with the Blockstack authentication layer and storage layer by using a JavaScript library called Blockstack.js. This library gives you hooks into the Blockstack ecosystem that make it easy to manage what would otherwise be some tricky interactions. With Blockstack.js, writing a decentralized app feels almost exactly the same as writing a front-end application that has no dedicated back-end. It’s like writing a mobile app against a service like Firebase, albeit with a less rich API. All of your logic lives in front-end code and you deploy your dapp on traditional front-end infrastructure. As a developer you don’t need to know or understand the blockchain interactions at all, since all of it is abstracted away from you.

In the next few posts, we’ll step through the process of building a dapp that authenticates against Blockstack, pulls in user profile information, and allows us to save and retrieve application data that always resides in the user’s control. In the end, we’ll have a simple, private version of something like CodePen, a browser-based development environment that allows you to create and edit web development snippets. In the meantime, if you want to check out some of the motivation or detail behind Blockstack, check out the project’s documentation or video series and join the Slack channel. Questions or comments? Continue the conversation on Twitter: @freethejazz.

Copyright © 2019 IDG Communications, Inc.

How to choose a low-code development platform