---
id: building-blocks
title: Building Blocks
description: Learn what are the main building blocks of Web3 apps
---

# Building Blocks of Decentralized Apps

Decentralized applications (also known as `dApps` or `Web3` apps) are made up of four different components that work together to provide an awesome user experience:

1. A **decentralized network** that keeps everything running smoothly
2. **Accounts & Smart Contracts** that store data and funds
3. **Wallets** to manage the account
4. A **Frontend** that users interact with

---

## Infrastructure Level

At the infrastructure level, we have the **decentralized network** that keeps `accounts` and `smart contracts` secure and operational.

### The Decentralized Network
      Decentralized networks such as NEAR Protocol are made up of many independent computers that work together to provide secure and transparent services

      No single entity controls the network, making it censorship-resistant and highly secure

        - <a>Keep all accounts secure</a>
        - <a>Validates and records transactions between accounts</a>
        - <a>Executes decentralized code (smart contracts)</a>

### Accounts & Contracts
      The decentralized network hosts all users `accounts`, each of which can have a small program called `smart contracts`

      Contracts can, for example, automate investment payments or store digital art. They are completely transparent - anyone can see what code is running

        - <a>Store funds and data on the blockchain</a>
        - <a>Handle transfers without human intervention</a>
        - <a>Expose functions so users can interact with them</a>

---

## User Level

On the user side, we have **wallets** that allow you easily manage your accounts and assets, and the applications (**frontend**) that provides the user interface to interact with everything.

### Wallets
      Wallets are applications that allow you to easily create and access your accounts, and its associated digital keys and assets.

      You can access multiple accounts from a single wallet, or use different wallet apps to access the same account.

        - <a>Hold your account's address</a>
        - <a>Hold your digital assets</a>
        - <a>Hold your account's credentials</a>

### The Frontend
      The website or mobile apps you interact with are what we call `frontends`. These applications can be hosted anywhere, be that some cloud service or your local computer

      The frontend of a decentralized app knows how to:

        - <a>Retrieve data from the chain</a>
        - <a>Let you login using your wallet</a>
        - <a>Call functions on smart contract to read or write data</a>

---

## How It All Works Together

Let's walk through a simple example on how these pieces fit together using a [digital guestbook](https://near-examples.github.io/guest-book-examples/) where people can leave messages:

<video autoplay loop controls width="100%">
  <source src="/assets/docs/quest/dapps/guest-book.mp4" type="video/mp4" />
</video>
*Main view of our Guest Book example app*

1. **You visit the app** - The frontend shows you a simple interface to leave a message
2. **You connect your NEAR wallet** - If you don't have one, you'll be prompted to create one
3. **You write a message** - The app shows you a form to enter your greeting
4. **Your message is stored forever** - It's now permanently saved on the blockchain

The beautiful thing is that once your message is stored, it can't be deleted, changed, or lost. Even if the frontend disappears, your message will remain stored in the guestbook smart contract.

---

## Quiz
