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:
- How traditional and decentralized applications differ
- Try your first DApp by creating an identity
- Seeding DApp market with application mining
- Overview of the DApp you will build
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
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.
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.
To create an initial Blockstack ID, do the following:
The application prompts you to create or restore an ID.
Choose Create new ID.
The browser prompts you to register a unique username in the
id.blockstackdomain. The username must be between 8 and 38 letter longs and can only contain characters, numbers and underscore (
_). This is a free Blockstack identity and the format of the ID is:
You’ll use this initial ID to access the Blockstack Browser and other DApps.
The Check Availability buttom makes sure your name is unique.
Press Continue when you find an available name you like.
The application prompts you to enter a password. Blockstack uses this password to encrypt your recovery code. You must record and save this initial password.Note: The Blockstack team cannot restore your password for you.
Enter a password, confirm it, and press Register ID.
Blockstack creates an id for you and then prompts you for an email.
Blockstack uses this email address to send you recovery information. This email is only sent once.
Blockstack presents you with the completed ID.
The system prompts you to save your recovery code.
Click Secret Recovery Key to record your key.
The system warns you to save your key:
Click Secret Recovery Key to record your key.
A recovery code is a sequence of words. These words allow you to recover an
id.blockstackthat you’ve created. You should store the words along with their order, for example,
#1 appliedand so forth.
Copy your Secret Recovery Key and press Continue.
The system confirms you have saved your key by asking you to select two words.
Choose Go to Blockstack.
It may take several moments for your username to be recorded on the blockchain. You can still use it but you may see a computer-friendly ID sequence such as
ID-1G9318bjf6FAZvD3gnaSyzUojM6f8xKWK1until the recording is finalized.
Congratulations you have created your first ID. You are now ready to start using DApps.
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
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.