-1

I'm confused to understand nodes in blockchain. Here are my questions:

  1. Not sure but I heard that a node is software. So, is all the chain data stored on the client side? The client might not be able to store so much data, or am I wrong?
  2. How do they synchronize? what if a node is offline when a transaction happens?

I already have searched Stackoverflow for similar questions but there weren't accepted good answers

Thanks!

Jakhongir
  • 73
  • 1
  • 8

2 Answers2

1

In this context, nodes are members of a peer-to-peer (P2P) network. All of them are hierarchically equal - unlike the client-server model for example, where the client only initiates requests and the server only responds to them.

For example with Ethereum, all computers (nodes) that are connected to the network are able to

  • broadcast transactions to other nodes
  • validate blocks incoming from other nodes
  • propose new blocks (in according with the rules of the Ethereum network, e.g. need to have staked at least 32 ETH)
  • and receive/send other types of messages.

What you possibly heard in connection with the word "client", is a "node client software". This is for example Go Ethereum or EthereumJS or other software that can connect your computer (node) to the Ethereum network, listen for incoming messages (e.g. new blocks), and broadcast messages (e.g. new transactions that you want to include in a future block).

Running your own node is not easy. If you're planning to develop a simple app that leverages blockchain, you can just connect to a 3rd party node provider (most of them have limited free plans, and less limited paid plans) and communicate with it over RPC API or using RPC wrapper libraries such as web3js and ethers.js.


Not sure but I heard that a node is software.

Node is a member of a network, but you need a software (node client sw) in order to communicate with other members of the network.

So, is all the chain data stored on the client side?

Each node holds the same data.

To be more specific - all nodes hold the latest state (e.g. current balance of all addresses), and some opt in to also hold the archival state (e.g. balances of all addresses at all blocks prior to the current one).

The client might not be able to store so much data, or am I wrong?

The current state currently takes about 1.2 TB (chart). The archival state is currently about 15 TB (chart). It might not be manageable on a regular laptop, but businesses with large enough infrastructure are still able to store this amount of data fairly easily.

Having said that, there are some initiatives for sharding the current state between multiple nodes (the node could hold less than the full 1.2 TB and could ask others for the remaining data when needed), but they are still mostly in the research and proof-of-concept phase.

How do they synchronize?

Each node has a list of "bootstrap nodes" where it initially connects to, and asks for "their neighbors" - other nodes that this bootstrap node knows of. Then it asks these neighbors for the list of their neighbors, ... until it reaches a limit number of known neighbors (configurable in your node client software).

Once your node receives a message (e.g. that there is a new block), it's supposed to rely this message to its neighbors.

This communication standard is called DevP2P.

what if a node is offline when a transaction happens?

When the node comes back online, it asks its neighbors for the latest state, and updates its own database.

Petr Hejda
  • 40,554
  • 8
  • 72
  • 100
  • finally my gaps were covered, now I can move on to the next step of my journey like types of nodes, etc. it would be great if you provide any additional links for newcomers like me to this field, thanks a lot! – Jakhongir Aug 04 '23 at 23:37
1

Let me explain nodes in a blockchain in simple terms:

What is a Node in a Blockchain? A node in a blockchain is indeed software that participates in the network and helps maintain the blockchain's integrity by validating and propagating transactions and blocks. Nodes can be run by individuals, organizations, or even companies, and they collectively form the decentralized network of the blockchain.

Is All the Chain Data Stored on the Client Side? Yes, nodes store a copy of the entire blockchain data. This is what makes blockchains decentralized and secure. Each node has its own local copy of the blockchain, containing all the transactions and blocks that have ever occurred on the network. Since every node has a copy, there's no single point of failure, and the data is distributed across the network.

Storage Concerns: You are correct that storing the entire blockchain can become a concern for some clients, especially if they are running on devices with limited storage capacity. This is more relevant for full nodes that store the entire blockchain. In some blockchains, like Bitcoin, the full blockchain can be several hundred gigabytes in size. To address this issue, some users choose to run "light" or "pruned" nodes that only store a subset of the blockchain data, relying on other full nodes to provide the missing information when needed.

How Do Nodes Synchronize? When a new node joins the blockchain network, it needs to synchronize its local copy of the blockchain with the rest of the network. It does this by connecting to other nodes and exchanging blocks and transactions. The process of catching up with the blockchain's current state is known as "synchronization" or "initial block download."

Offline Transactions: If a node is offline when a transaction happens, it won't immediately know about the transaction. However, once the node comes back online and synchronizes with the network, it will receive the latest blocks and transactions from other nodes and update its local copy accordingly. Transactions are included in blocks, and when a new block is mined or added to the blockchain, it contains a list of the most recent transactions.

In short, nodes in a blockchain network are software that stores a copy of the entire blockchain data and help maintain the network's integrity. They synchronize with other nodes to stay up-to-date with the latest transactions and blocks. If a node is offline during a transaction, it will catch up with the network when it comes back online.

nudoiba
  • 22
  • 2