header-langage
简体中文
繁體中文
English
Tiếng Việt
한국어
日本語
ภาษาไทย
Türkçe
Scan to Download the APP

Knowing this, let’s be a Web3.0 developer

Read this article in 23 Minutes
Web3 is a protocol stack for fully decentralized applications.
Original title: "Defining the web3 stack"
Original author: Nader Dabit
Original compilation: The Graph community member


Want to build on web3? Nader Dabit points out the building blocks of the web3 technology stack in an introductory guide


In the next chapter of "Building on web3", Edge & Node Developer Relations Engineer Nader Dabit explains the web3 stack and how developers conceptualize the various layers of building on web3.


I'm transitioning to web3 in April 2021 after about 10 years of traditional Full stack developer. While diving into all these new technologies and ideas, the first thing I wondered was "what is a web3 stack?".


When building a traditional web or mobile app, I often rely on certain builds Modules to get the job done:


- API/Application Server (REST or GraphQL)

- Authentication Layer (Managed or Manual)

- Databases

- Client Frameworks, Platforms and Libraries

- File Storage


Using these core components, I can build most types of applications I want, or at least achieve most purposes. So, what does this look like in web3?


As it turns out, the answer to this question is not so straightforward because:

< p>

- This paradigm is completely different in many ways

- web3 tools, technologies and ecosystems are not as mature as web2

< br>

It's also harder for me to understand how to get up, running and build a web3 application since I'm in the same world as the web2 world way to deal with the problem.


After work, research, experimentation and building over the last 8 months or so, I want to share my experience with you.


What is web3?


Before we define the web3 stack, let's try to define web3:


Web3 is a protocol stack for fully decentralized applications.


With this decentralized With a standardized technology stack, we can start to build decentralized applications, which have their own meaning and characteristics.


Some features of web3 are:


- Decentralized Network Infrastructure

- Ownership (Data, Content and Platform)

- Native Digital Payments

- Self-Sovereign Identity

- Distributed, trustless, robust infrastructure

- Open, public, composable backend


While some applications built on decentralized technology stacks will replace their predecessors, the new vernaculars enabled by blockchains also enable new application paradigms.


Native digital payments and public backend infrastructure -- such as machine learning, mobile devices, Virtual reality and other technology primitives, platforms and building blocks -- enabling entirely new types of applications to be built, some not yet imagined.


Does this mean that everything will be replaced by web3? uncertain. While I think for some types of applications, building on a decentralized tech stack is a better option - like almost any tech decision, it depends on what you're building.


Now let's start digging into the web3 stack, divided into the following categories:


- Blockchain

- Blockchain Development Environment

- File Storage

- P2P Database

- API (Index and Query)

- Identity

- Client (Framework and Libraries)

- Other protocols

- Other protocols

- p>


Blockchain


< /p>

There are countless blockchains you can choose to build on. No one is "best", instead you should consider the various trade-offs between them.


One thing that is often important to me when learning something new is that Applying the Pareto Principle to what I've learned. That is, what is the most efficient way to get results for that amount of time and effort. Following this idea, I can learn new things in the shortest amount of time while gaining the most traction and motivation.


In the field of blockchain, learning Solidity and EVM (or Ethereum virtual machine) may be used as The best choice for blockchain developers when getting started. Using this skill set (and tech stack), you can build not only for Ethereum, but for other Ethereum second layers, sidechains, and even other blockchains like Avalanche, Fantom, and Celo.


That is to say, Rust is becoming more and more popular in the blockchain field, Solana , NEAR, Polkadot, and more all have first-class Rust support. You can probably go wrong learning both languages, but for beginners, if someone asked me today, I would say Solidity would still be the better choice.


In addition to these suggestions, here is a non-comprehensive A solid mix of utility, community, momentum and future viability:


- Ethereum - The Original Smart Contract Platform

- ZKrollups: ZKSync, Starknet, Hermez - High throughput Ethereum layer 2, but not natively compatible with EVM

- Optimistic rollups: Arbitrum & Optimism - Ethereum layer 2, compatible with EVM (Learn more about the difference between Optimistic rollups and ZKrollups here).

- Polygon - Ethereum sidechain

- Solana - high throughput, low transaction costs, fast block times, but harder to learn than EVM (Rust)

- NEAR - the underlying blockchain, smart contracts can be written in Rust or Assemblyscript

- Cosmos - an ecosystem of interoperable blockchains

- Polkadot - based on A computing platform for blockchains that enables blockchains built upon it to execute transactions between them, creating an internet of interconnected blockchains

- Fantom - EVM-compatible underlying blockchain

- Avalanche - EVM Compatible Underlying Blockchain

- Celo - EVM Compatibly Underlying Blockchain, designed to make it easy for anyone with a smartphone to send, receive and storage cryptocurrency

- Tezos - non-EVM compatible underlying blockchain, many NFT projects are using it


Blockchain development environment


For EVM development, There are several good development environments to use:


- Hardhat (JavaScript) is a newer option, but it is gaining traction. Their documentation is great, the tooling and developer experience is great, and I personally use it all the time to build decentralized applications.


- Truffle (JavaScript) is a set of tools for building and developing applications on the EVM. It's mature, battle-tested, and well documented. It has been around for a while and many developers use it.


- Foundry is a new Solidity development environment from Paradigm that shows a lot of promise. Its main features are the ability to write tests in Solidity, support for fuzzing, and speed (it's written in Rust). I wrote a separate introduction to it here.


- Brownie is a Python-based smart contract development and testing framework for Solidity/EVM development.


For Solana development, Anchor is quickly becoming the entry point for new developers. It provides a CLI, scaffolding for building and testing Solana programs, and client libraries you can use to build frontends. It also includes a DSL that abstracts away many of the complexities developers often encounter when starting to develop with Solana and Rust.


File Storage


Where do we store pictures, videos and other files in web3? Storing such large files on-chain is usually very expensive, so we probably don't want to store them there.


Instead we can use one of the few file storage protocols:


- IPFS--Peer-to-Peer File System Protocol


- Pros: It's reliable and has good documentation , with a huge ecosystem


- Cons: If data is not secured, it is lost.


- Arweave - Allows you to store data permanently for one transaction fee. I'm a fan of Arweave and wrote a blog post about it here.


- Filecoin - From Protocol Labs, the same team that built IPFS, a protocol designed to provide a persistent data storage system. There are ways for developers to build on Filecoin, including web3.storage, which is nice.


- Skynet - I haven't used it in production yet, but have tried it and it seems to work fine. The API here looks great. I have some questions like how long the data is persisted and the interoperability of Skynet with other protocols.


< h3>P2P database


In addition to file storage and on-chain storage, you may also need Store data externally. You can use these types of solutions similar to how you would use databases in a traditional tech stack, but they are replicated across N nodes on a decentralized network and thus more reliable (at least in theory).


A few options are:


- Ceramic Network - A decentralized open source platform for creating, hosting and sharing data. Ceramic also has a nice identity protocol, which I'll touch on later. Probably my current favorite off-chain storage solution. Here's a pretty good demo.


- Textile ThreadDB - A multi-party database built on IPFS and Libp2p. If I understand correctly, it may be undergoing a big API change at the moment. I tried it and it shows some prospects, but documentation and DX need some improvement.


- GunDB - A decentralized, peer-to-peer database. Gun has been around for quite some time, and some pretty interesting applications have been built with it.


In terms of maturity, my opinion is that the ecosystem of off-chain storage solutions Not to the extent needed to establish more advanced use cases that some developers might want. Some of the challenges here are live data, conflict detection and resolution, write authorization, documentation, and general developer experience.


Combining off-chain data solutions with blockchain protocols is what we are able to One of the last big hurdles to cross before supporting a fully decentralized protocol stack for any type of application.


API (Index and Query)


The way we interact with and build on top of blockchains is a lot different than databases in traditional tech stacks. With a blockchain, data is not stored in a format that can be efficiently or easily consumed directly from other applications or front-ends.


The blockchain is optimized for write operations. You often hear about innovations centered around transactions per second, block times, and transaction costs. Blockchain data is written in blocks over a period of time, making all but basic read operations impossible.


In most applications, you need things like relational data, sorting, filtering, full-text search , pagination, and many other types of query capabilities. In order to do this, the data needs to be indexed and organized for efficient retrieval.


Traditionally, this is what databases do in centralized technology stacks, but in The indexing layer is missing in the web3 stack.


The Graph is a protocol for indexing and querying blockchain data, which enables this This process becomes easier and provides a decentralized solution for doing so. Anyone can build and publish open GraphQL APIs, called subgraphs, that make blockchain data easily queryable.


To learn more about The Graph, check here (https://thegraph .com/docs/) or my tutorial here (https://dev.to/dabit3/building-graphql-apis-on-ethereum-4poa).


Authentication


In web3, authentication is a completely different paradigm. In web2, authentication is almost always based on the user's personal information. This information is usually collected through a form or OAuth provider, requiring the user to hand over this information in exchange for access to the application.


In web3, identity revolves entirely around the concept of wallets and public key cryptography.


While the name "wallet" has its place, I find that people new to web3 Find this term confusing as it has to do with authentication and identity. I hope in the future we can figure out some other way to express what a wallet is, because it combines not only aspects of finance, but also identity and reputation.


As a developer, you will need to understand how to access users' wallets and address and interact with it.


On a very basic level (and a very common requirement), you might want to Request access to the user's wallet. To do this, you can usually access the user's wallet in a windowed environment (web browser), or use a wallet adapter like WalletConnect or Solana.


For example, if they have an Ethereum wallet available, you will be able to access window.ethereum. The same is true for Solana (window.solana), Arweave (window.arweaveWallet) and a handful of other wallets. WalletConnect is great for mobile web and React Native because it allows users to authorize with their mobile wallet directly from the device.  


If you want to handle the authentication yourself, you can have the user sign the transaction and then in some to authenticate the user, but this usually requires a server. Here's an example using the EVM wallet, and here's an example using Solana/Phantom.


How about managing user data in a decentralized way? Ceramic Network provides the most powerful suite of protocols and tools for managing decentralized identities. They recently published a blog post outlining some of their recent updates and giving some guidance on how all the tools work together. I'd like to start there, then explore their docs to gain an understanding of how to start building, and consider looking at my example project here using Ceramic self.id .


If you want to get a user's ENS text record, ensjs library provides a nice API to get user data:




SpruceID is also something that looks promising, but I haven't tried it yet.


Ceramic and Spruce both implement the W3C DID specification, which itself is what I think is web3 a component. That being the case, any centralized implementation of DID goes against the very philosophy that the specification is trying to achieve.


Client


As far as JavaScript frameworks go, you can really build with anything you want, since client-side blockchain SDKs are mostly Framework independent. That said, the vast majority of projects and examples are built in React. There are also libraries like Solana Wallet Adapter that provide additional tools for React, so I'd say learning or getting familiar with React might be a smart move.


For the client SDK of Ethereum, there are web3.js and ethers.js. For me, Ethers is more accessible and has better documentation, although web3.js has been around longer.


In Solana, you may use @solana/web3.js and/or Anchor. I've found the Anchor client library to be my first choice for building Solana programs, since I'm using the Anchor framework anyway, and I find it easier to understand than @solana/web3.js.


Other agreements


Radicle is a decentralized code collaboration protocol built on Git. It can be thought of as a decentralized version of GitHub.


Livepeer is a decentralized video streaming network. It's mature and widely used, with over 70,000 GPUs live on the web.


Chainlink is an oracle that enables access to real-world data and off-chain computation while maintaining The inherent security and reliability guarantees of blockchain technology.


Summary


< /p>

This article will be a living document that I keep up with as I learn, experiment and gather feedback from web3 developers.


If you have any feedback or thoughts on what I'm missing here, please share with me your thoughts. It's exciting to see all the activity happening around web3 as developers jump in and get involved. While the infrastructure is still evolving, the vision of building truly decentralized protocols and applications that allow people to coordinate without having to relinquish power and control to large corporations is important, and we are getting closer to realizing that vision .


Original Title


Welcome to join the official BlockBeats community:

Telegram Subscription Group: https://t.me/theblockbeats

Telegram Discussion Group: https://t.me/BlockBeats_App

Official Twitter Account: https://twitter.com/BlockBeatsAsia

举报 Correction/Report
Choose Library
Add Library
Cancel
Finish
Add Library
Visible to myself only
Public
Save
Correction/Report
Submit