DEV Community

Loading Blocks
Loading Blocks

Posted on

Core Concepts in Web3

Preface

As a senior front-end developer in the Web2 world, I am transitioning into web3 recently.

Although I have heard many times about blockchain, wallet, decentralization etc. frankly, I only had a surface-level understanding before.

Now, I have learned these foundational concepts: decentralization, ledger, wallet, blocks, pow, pos, nodes, Transactions.

What is Decentralization?

In the web2 world, we rely on centralized applications or systems.

For instance: Whats app, Github store all data stored on centralized servers.

Decentralization means there is no single point of control. In the web3 World every node can validate, record and propagate data. No centralized server has exclusive control; instead, consensus mechanisms define all data and rules.

As result, I realized that decentralization is not only technical's change but also a shift of control & trust shift from companies to users.

Blockchain ledger

In the web2 world, we use databases such as MySQL to store data, These databased allows easy modification but are immutable. In contrast, the Ledger in web3 is immutable because of the consensus mechanism. There are no UPDATE operations, data can only be APPENDED.

The current state is derived from the full transcation history. Anyone can download full node and verify state independently.

I realized web3's data model is not about where data is stored but about who can prove its validity.

This design makes trust rely on consensus network, not on a central company server.

Wallets

Wallets is not merely a login plugin or payment app. It is an identity and a cryptographic signer.

It stores our private key and represents blockchain address/account.

It can sign transactions to interact with smart contracts.

The important thing is that the wallet is self-custodied — users control their private keys directly.

Transactions:

In Web2, a transaction is an API call. I send a POST request to a server, it validates my credentials, and updates a database. It's a command sent to a central server.

In Web3, a transaction is a fundamentally difference. It is a self-contained, cryptographically signed data package broadcasted to the entire network.

A standard transaction, like on the Bitcoin network, is composed of several key fields:

Inputs: This is where the funds come from. Instead of a simple "balance," you reference previous transactions where you received funds that you haven't yet spent (these are called Unspent Transaction Outputs or UTXOs). The sum of these inputs proves you have sufficient funds.

Outputs: This defines where the funds go. It typically includes:

The amount being sent to the recipient's address.

The "change" being sent back to your own address. Since you must spend a UTXO in its entirety, if the input is 1 BTC and you only want to send 0.8 BTC, the remaining ~0.2 BTC (minus the fee) is sent back to you as change.

  • Amount: The value being sent to the recipient.
  • Fee/Gas: A small amount paid to the network's miners or validators as an incentive to include your transaction in a block. Higher fees generally lead to faster confirmation times.
  • Signature: A digital signature generated using your private key. This proves that you authorized the transaction and that its contents have not been altered.

Ethereum's Special Fields

Ethereum transactions include all the above but add two special fields to support smart contracts:

  • Nonce: A transaction counter for your account that starts at 0 and increments with every transaction you send. It's a security feature that prevents the same transaction from being processed twice (a replay attack).
  • Data: An optional field used to interact with smart contracts. It can contain the code to deploy a new contract or the specific function you want to call on an existing contract.

Blocks

In Web2, I think of data in terms of database rows or commits in a Git repo. They are collections of changes.

In Web3, a Block is a container for a batch of transactions, but its true power lies in how it connects to other blocks. This connection is what makes the ledger a

blockchain. Every block contains a few critical pieces of information:

  • A list of transactions: The actual data being recorded.
  • A Timestamp: When the block was created.
  • A Nonce: A number found by miners during the Proof-of-Work process, acting as their "proof".
  • The Previous Block's Hash: This is the magic ingredient. Each block contains a cryptographic hash (a unique fingerprint) of the block that came before it.

This creates an unbreakable chain. If an attacker tries to alter a single transaction in an old block, the hash of that block would completely change. This change would cause a mismatch with the "Previous Block Hash" stored in the next block, invalidating it, which in turn invalidates the block after that, and so on, breaking the entire chain from that point forward.

Security

Web2 security is about building a fortress around a central database. We trust the company to maintain the walls.

Web3 security is built into the protocol itself through cryptography and economic incentives. The system is designed to make cheating prohibitively expensive. Two main threats are addressed:

Double-Spend Attack: The risk of spending the same digital currency twice. The public ledger solves this. Once a transaction using a specific input (UTXO) is confirmed in a block, that input is considered "spent" and cannot be used again. Any node on the network will automatically reject a new transaction that attempts to reuse an old input.

51% Attack: The primary theoretical vulnerability. If a single entity controls more than 50% of the network's power, they could potentially approve fraudulent transactions or reverse their own recent transactions, effectively creating an alternate version of the truth. For large networks like Bitcoin or Ethereum, acquiring this much power is computationally and financially astronomical, making such an attack highly impractical.

Proof of Work (PoW):

"Miners" use powerful hardware to solve a complex mathematical puzzle over and over again.

The first to find the solution gets to propose the next block and earns a reward (newly created coins + transaction fees).

  • Pro: Extremely secure and battle-tested.
  • Con: Enormous energy consumption, as all competing miners are doing redundant work.

Proof of Stake (PoS)

"Validators" lock up (or "stake") a significant amount of the network's native currency as a bond.

The protocol randomly selects a validator to create the next block, with the chance of being selected often proportional to the amount staked.

  • Incentive: If they act honestly, they earn the transaction fees from the block.
  • Penalty: If they try to cheat, a portion or all of their staked collateral is destroyed ("slashed").
  • Pro: Up to 99% more energy-efficient and allows for greater decentralization without specialized hardware.

Consensus is the engine of a decentralized network. PoW uses expended energy as proof of honesty, while PoS uses economic capital as proof of honesty.

Nodes & Masternodes:

In Web2, we have server farms. In Web3, the network is composed of Nodes.

Nodes: A node is any computer running the blockchain software to maintain the ledger.

Full Nodes: These are the guardians of the network. They download and store the

entire blockchain history and independently verify every transaction and block against the protocol's rules.

Partial/Light Nodes: These are for everyday users (like mobile wallets). They only download a small part of the blockchain (like block headers) to save space and rely on full nodes to get the full picture.

Masternodes: These are a special class of full nodes that perform extra services for the network beyond simple validation, such as enabling instant transactions, private transactions, or participating in governance voting. To become a masternode operator, you typically need to stake a very large amount of collateral and ensure high uptime, and in return, you earn a share of the block rewards.

Conclusion

Decentralization = control via consensus, not corporations.

Ledgers = public, verifiable, immutable record.

Wallet combine identity + key + signer.

Transactions = Self-contained, signed proofs of value transfer.

Blocks = Cryptographically chained containers that ensure immutability.

Security = An economic game where honesty is the best policy.

Consensus (PoW/PoS) = The engine that determines truth without a centralization.

Nodes = The distributed computers that are the network itself.

Top comments (0)