You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

11 KiB

layout description permalink image
learn Blockstack Zero-to-DApp tutorial /:collection/:path.html /assets/img/zero-to-dapp.png

1 - About DApps and App Mining

{:.no_toc}

Zero-to-DApp 1 of 4

Welcome to the Blockstack Zero-to-DApp tutorial. The tutorial uses the Blockstack platform to teach you about blockchain technology and the Blockstack Ecosystem. The tutorial teaches you what makes a DApp different than a traditional application. You'll build and run a DApp. You'll also learn about the Application Mining program which awards funds to DApp developer every month.

The tutorial has four parts of which this is first, and it contains the following topics:

  • TOC {:toc}

You can complete the entire Zero-to-DApp tutorial in less than 45 minutes. If you prefer a 10-minute hello-world code sample, see the Hello, Blockstack Tutorial.

Skills you need to follow this tutorial

{:.no_toc}

This tutorial is written for developers and others who want to learn about DApps and how the Blockstack ecosystem supports their development. As a result, the target audience is intentionally broad. Anyone with access to a Windows, Mac, or Linux computer and some familiarity with a command line should be able to follow along.

If you are good at following directions, chances are you can complete this tutorial even if you have no programming experience. Knowledgeable developers should easily be able to complete the tutorial within an hour by following along.

If you are a developer superhero, you may want to skim or move quickly through the pages and that's fine too.

{% include note.html content="For best results, use the Chrome browser for this tutorial. Currently, the Blockstack Browser works best in Chrome and you can encounter problems using browsers such as Safari or Firefox. Currently, IE and the Edge browsers are not supported." %}

How traditional and decentralized applications differ

In this tutorial, you build, run, modify, and deploy a decentralized application (DApp) called Animal Kingdom. A DApp uses blockchain technology for the authentication and data storage components of an application’s platform. Blockchain applications are decentralized applications, meaning they move data control and identity management from central authorities and organizations to individual users.

Anyone who has had their identity stolen or lost money because of a data breach, understands that centralized applications come with personal risk. Anyone who has lived in or visited a foreign country and lost access to a site, to a service, or to information because of government censorship also understands how centralization impacts how people live.

Users and businesses see DApps as valuable because they solve the centralization problems of traditional applications. The following table describes the features of traditional applications and the features of blockchain applications:

Traditional application Decentralized application
Users must create many username and password combinations for each service or application. Each combination must be managed and maintained. Also, each creation requires the user to provide important or unique information into the care of a third-party. Users create and own one or more identities. They use their identities with all applications and services. For example, a user could use the same identity for buying books online as they use for social media.
Multiple third-party applications and services store personal data from individual users in backend servers. These backend servers are under the control of the application or service. Users leaving the application leave their data behind. Personal information and data is encrypted and remains under the control of the user. Users leaving an application leave no data behind because none was stored with the application.
Multiple accounts across many servers make personal data subject to attack, misuse, and uncontrolled collection. Users can audit access to their data and know who accessed their data and which data were accessed.
Central authorities and middlemen control network access enabling them to censor applications and/or users that use them. Companies are developing blockchains that run over peer-to-peer networks. These future networks can make shutting down or entirely blocking a decentralized application close to impossible.

The blockchain technology you build a DApp with determines the features available to your application.

Try your first DApp by creating an identity

The Blockstack Web browser is a DApp for the web. Users can use it to create and manage identities in the Blockstack Ecosystem. DApps built with the Blockstack platform, use the on-boarding sequence provided by the browser to onboard their users. Currently, users can create a Blockstack ID for free or buy their own ID.

If you haven't already created your own Blockstack ID, do this now. As you create an ID, consider what interactions are familiar to you from traditional applications, and which are not.

{% include create_id.md %}

If you already have a Blockstack ID, launch the browser and try resetting it. Or trying logging on from a device or browser software you haven't used before.

Seeding DApp market with application mining

Blockchain applications are a new paradigm for both application developers and application users. New paradigms in any market, think solar power or electric vehicles, need public and private coalitions to grow. The centralized hosting and services known as cloud computing were once new paradigms. It was the investment of billions in funds and incentives from governments and private companies that grew the cloud computing market.

App Mining Eligibility Requirements

DApps that are eligible for application mining must:

  • Implement Blockstack authentication
  • Invite registration and use by the general public

Storing data in a Gaia storage hub is optional. Potentially in the future it may be required.

As you work through this Zero-to-DApp tutorial, you’ll build and deploy a sample application that meets these requirements. While the application you build won't be eligible for application mining, completing the tutorial makes you eligible for a free, limited edition t-shirt:

You'll learn how to get your t-shirt in part 4 of this tutorial.

Overview of the DApp you will build

You are going to build a DApp called AnimalKingdom. Animal Kingdom is a DApp for the web. Users log into it and create an animal persona that rules over a specific territory. The combination of persona and territory is a kingdom. Once you create a kingdom, you can add subjects from other kingdoms.

The Animal Kingdom interacts with two Blockstack services, the Blockstack Browser (https://browser.blockstack.org) and the Gaia data storage hub (https://hub.blockstack.org/). The Blockstack Browser is itself a DApp. The storage hub is purely a service without user-facing functionality.

The following table describes the key interactions and screens in the DApp.

Click to enlarge Description

Users log in (authenticate) with a Blockstack identity. By authenticating, the user gives the application the ability to get and put data in the user's Gaia storage hub.

The Blockstack login dialogs are part of the Blockstack Browser which is itself a DApp. Once a user authenticates, the DApp code automatically returns them to the Kingdom they were attempting to enter.

First-time visitors to a kingdom are prompted to create an animal persona and a territory to rule. Once they make a selection, users click Done to create a kingdom to rule. Behind the scenes, the data about the user's selection is stored in the user's Gaia hub.

Each kingdom has animals and territories. Users can edit their original persona/animal combination. You'll learn how to modify the Animal Kingdom code to add new animals and territories.

Users can add subjects from territories in their own Animal Kingdom. The DApp updates the user's Gaia hub each time the user adds a subject. Users can also visit other Animal Kingdom installations and add subjects from these as well. You'll learn how to modify the Other Kingdoms available in your installation.

You can try a completed version of this application for yourself by using your Blockstack identity to log into the Blockstack Animal Kingdom.

Where to go next

{:.no_toc}

This section introduced you to the benefits of a decentralized application (DApp). You also learned that, similar to other new paradigms, both the public and private companies are committing serious resources to developing blockchain tech. Finally, you learned Blockstack is designed so that you can quickly build a DApp and enter this emerging market.

In the next section, you learn more about developing DApps and how they are different from traditional applications. You’ll also learn about the resources Blockstack provides for DApp developers that help you clarify where to put your efforts and how to fund them.

Continue to 2 of 4, Zero-to-DApp.