JavaScript dapps: Using decentralized storage in Blockstack


Last week we put together a basic component that allowed our users to and see their profile. Since then, I’ve made some to incorporate , , and . Most of these changes are merely structural, but one change does alter functionality. We’ll look at that change below.

I also spent some time laying out the app and adding . With the functional base of our application complete, we’re in a good position to start exploring more decentralized behavior. This week we’ll look into adding decentralized persistence using convenient methods provided to us by the Blockstack JavaScript library, Blockstack.js.

Before we get into adding persistence to our snippets application, let’s review my change to the log-in flow and introduce the basic snippet functionality I’ve added since last week.

Routing with React Router

I added React Router to help manage the application and adjusted some functionality to handle a new log-in from a separate route. Now, after we click the log-in button and we are redirected to the Blockstack Browser for authentication, Blockstack sends us back to a /callback endpoint. This type of hand-off to a dedicated endpoint is relatively common with OAuth workflows, so you may be familiar with it already.