Why are web 3 apps protocols, not just applications

Why are web 3 apps protocols, not just applications?

Why interacting with a Web 3 protocol like Aave appears like a bank, but differs “under the hood”

It's no secret that tech talent is flocking to Web3 - shifting from building Web 2 applications like Google and Facebook to working on building blockchain protocols.

One question often asked is "What's the difference between a Web 2 application like Facebook and a Web 3 protocol?"

I understand the confusion, after using DeFi protocols like Uniswap for exchanging Ethereum tokens and using Aave for lending and borrowing, I empathise with the average internet user, the application interfaces look similar.

Discord, a Web2 application differs from Aether, a Web3 protocol… why?

Discord
Aether vs Discord
Aether vs Discord
Aether

By definition, an application and protocol are different

The differences between an application like Google and a Protocol like Aave become more obvious as you look deeper into the protocol's application architecture. With this knowledge, you should be able to tell the difference between a web app and a blockchain protocol.

A protocol — e.g. HTTPS — is what your browser uses to connect to this blog. It's a set of rules that shares data between the server and your browser

A web application — e.g. Medium blog — is built using different protocols for different uses. It sends data using HTTPS to your browser.

Applications require trust, ownership, management

Applications are managed by a single entity, for example, a banking application. When a user logs into a banking app, the user needs to trust the bank will keep their credentials safe, and won't let other users into their account. The user is trusting their bank balance is 100% available to use and can be fully withdrawn when needed. Hypothetically, engineers can alter records and applications as they use a mutable database.

Banks need to own and manage their whole banking infrastructure including keeping the database secure and ensuring uptime and transaction throughput.

A Blockchain protocol like Uniswap is a trustless protocol because a user interacts with a smart contract (more on that soon), the blockchain is immutable and can't be altered, therefore your balance only shows the funds you can spend. The Uniswap interface is a web application, but the web application interacts with the Uniswap smart contracts, built on the public blockchain for anyone to use, even without the web application.

Blockchain protocols depend on the underlying blockchain infrastructure for security, uptime, and transaction throughput. This has significant advantages for a chain like Ethereum as thousands of engineers contribute to the infrastructure and similarly, many applications depend on it.

How Web 2 and Web 3 application architecture differs

Preethi Kasireddy's article on Web 3 application architecture (opens in a new tab) illustrates the differences between Web 2 and Web 3 application architecture in great detail, I'd recommend you read it, the notes and illustrations below are borrowed from it.

The reason Web 2 banking apps look similar to Web 3 apps like Aave is that they share the Front-end application component. These are both web applications built for internet users.

Web2 Stack
Web2 Stack
Web3 Stack
Web 3 Stack

Why blockchains and smart contracts are both protocols

Ethereum is a protocol, and smart contracts power the protocols built on Ethereum, like Uniswap and Aave.

The Distributed Immutable Data Objects Wiki (opens in a new tab) illustrates the 4 Web 3 layers used when building a Decentralized Finance (DeFi) application — starting from Settlement (Blockchain), Protocol (Smart Contract), Application (Web Application) and Aggregation

4 Protocol Layers
4 Protocol Layers

Settlement Layer

Settlement refers to the core processes of a blockchain reaching consensus for the transactions on its network.

Bitcoin: was the first mainstream digital money protocol to successfully incentivise its network to honestly validate transactions through Proof of Work whilst ensuring transactors couldn't spend the same coin twice.

Bitcoin is a protocol because there are rules on how to sign and make a transaction, and rules on how the network ensures user accounts have enough coins in their balance to spend.

Bitcoin and other blockchains enable the transfer of coins (value) on the settlement layer

Protocol Layer

Smart contracts are computer programs stored on the blockchain, smart contracts are crypto protocols because the contract is a set of rules governing how interaction with the contract works.

Ethereum isn't the only smart contract protocol, most blockchains that were created after Ethereum enabled smart contracts.

When we hear the term “New exciting protocol” — most likely they're referring to the protocol layer — the smart contracts and the product built around the smart contracts.

Users can interact directly with a smart contract by interacting directly with the smart contract address (found publicly). However, protocols like Uniswap build web application interfaces for users to more easily and intuitively interact with their smart contracts.

Application Layer

The application layer describes the application interface, the application layer isn't a protocol, but is a tool for users to interact with the smart contracts.

What does the Application, Protocol, and Settlement layer look like?

Application Layer

In the middle of the page, you can see the Uniswap router enabling users to swap between currencies.

Protocol Layer

Users interacting with the application trigger interaction with the protocol via smart contracts. Uniswap smart contracts are found at their contract address

https://etherscan.io/address/0xE592427A0AEce92De3Edee1F18E0157C05861564#code#F1#L84 (opens in a new tab)

///... example from Uniswap contract
    /// @inheritdoc IUniswapV3SwapCallback
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata \_data
    ) external override {
        require(amount0Delta > 0 || amount1Delta > 0); // swaps entirely within 0-liquidity regions are not supported
        SwapCallbackData memory data = abi.decode(\_data, (SwapCallbackData));
        (address tokenIn, address tokenOut, uint24 fee) = data.path.decodeFirstPool();
        CallbackValidation.verifyCallback(factory, tokenIn, tokenOut, fee);

        (bool isExactInput, uint256 amountToPay) =
            amount0Delta > 0
                ? (tokenIn < tokenOut, uint256(amount0Delta))
                : (tokenOut < tokenIn, uint256(amount1Delta));
        if (isExactInput) {
            pay(tokenIn, data.payer, msg.sender, amountToPay);
        } else {
            // either initiate the next swap or pay
            if (data.path.hasMultiplePools()) {
                data.path = data.path.skipToken();
                exactOutputInternal(amountToPay, msg.sender, 0, data);
            } else {
                amountInCached = amountToPay;
                tokenIn = tokenOut; // swap in/out because exact output swaps are reversed
                pay(tokenIn, data.payer, msg.sender, amountToPay);
            }
        }
    }
    ///... example from Uniswap contract

https://etherscan.io/address/0xE592427A0AEce92De3Edee1F18E0157C05861564#code#F1#L1 (opens in a new tab)

Settlement Layer

All transactions sent through the protocol will be logged on the settlement layer i.e. the blockchain. You can find all transactions for the Uniswap router at the contract address

Uniswap transactions (opens in a new tab) on the settlement layer

So protocols like Uniswap and Aave are both applications and protocols?

For ease of access, Web 3 protocols like Uniswap and Aave both have web 2-like components — the front-end interface you see when you use the website. However, blockchains and smart contracts are protocols, they're a set of rules governing how users can transact.

Unlike centralized, trusted applications, blockchain protocols are decentralized, trustless, and run on the underlying blockchain.