root.system / 0x0E / structure

One word.
Three scales.

A node in a data structure is a small struct on the heap holding a value and a pointer to its neighbour. A node on a network is a whole computer with an IP address. A node in a blockchain is a computer running protocol software that holds a copy of the chain. Same word, three scales, one essential pattern: a participant with an identity, holding state, connected to others. This page is about that pattern.

Beginner// level 01

The pattern: a value, plus a way to find related ones

The word node shows up in three very different contexts in computer science, and it is the same word for a reason. At every scale, a node is the same essential thing:

  • It has an identity (an address by which others can find it).
  • It holds some state (a value, or several).
  • It knows about some neighbours (one, two, or many).

Change the size of the node and the type of the connections, and you go from a tiny struct on the heap to a single computer to an entire participant in a global financial network. The shape never changes.

The picture at every scale

ONE WORD, THREE SCALESDATA STRUCTUREvalue: 42next: 0x40e0~16 bytes on the heapa struct with pointersNETWORK192.168.1.42laptop · router · servera whole computerwith an address on the wireBLOCKCHAINbitcoind / gethchain + mempool + peersa computer runningthe protocol softwarea participant with identity, holding state, connected to otherssame pattern, three orders of magnitude apart
// fractal, not analogical
The three scales aren't a metaphor for each other; they're the same idea applied at different orders of magnitude. A linked-list node is ~16 bytes on the heap, addressed by a pointer. A network node is a whole computer, addressed by an IP address. A blockchain node is a computer running specific software, addressed by a public-key hash. Same three properties (identity, state, neighbours) every time.

The data-structure node, in code

The linked-list page already covered the smallest version. A node there is a struct with a value and a next pointer. Variations follow naturally: a tree node has two neighbours, a graph node has many, and that is essentially the whole taxonomy of pointer-based data structures.

LINKED LIST: one next pointer per nodeanextbnextcnextBINARY TREE: two child pointers per noderootLRSAME node, more pointers per slot - list (1), tree (2), graph (many), hash-map bucket (chain).The data structure is just a choice about how many neighbours a single node can know.
Rust• • •
// The data-structure node, the smallest of the three meanings.
// A struct with a value and one or more pointers to other nodes.
struct ListNode<T> {
    value: T,
    next: Option<Box<ListNode<T>>>,
}

// A tree node knows two neighbours.
struct TreeNode<T> {
    value: T,
    left:  Option<Box<TreeNode<T>>>,
    right: Option<Box<TreeNode<T>>>,
}

// A graph node knows many.
struct GraphNode<T> {
    value: T,
    edges: Vec<NodeId>,        // indices into an arena of GraphNodes
}

// In all three: a node = "a value, plus a way to find related nodes."
// The data structure is just a choice about how many neighbours a node
// can know, and whether the connections form a chain, a tree, or a web.
C• • •
#include <stdint.h>
#include <stdlib.h>

// The C version of the same idea. Plain struct, raw pointers.
typedef struct ListNode {
    int               value;
    struct ListNode  *next;
} ListNode;

typedef struct TreeNode {
    int               value;
    struct TreeNode  *left;
    struct TreeNode  *right;
} TreeNode;

typedef struct GraphNode {
    int               value;
    uint32_t         *edge_ids;   // dynamic array of node IDs
    size_t            edge_count;
} GraphNode;

// Allocate a list node. Heap, malloc, raw pointer. Nothing magic.
ListNode *list_node_new(int value) {
    ListNode *n = malloc(sizeof *n);
    n->value = value;
    n->next  = NULL;
    return n;
}
// connect back to the linked-list page
The linked-list page introduced the smallest version of this idea: a node with one next pointer. Everything on this page extends that pattern. A binary tree is the same node with two pointers. A graph is the same node with a vector of pointers. A hash-map bucket chain is the linked-list version, head-pointed-at by a slot in an array. The rest of the data-structure landscape is just choices about how many neighbours a node can have and how it finds them.
Intermediate// level 02

A network node is the same idea, with an IP address

Walk away from the heap and onto the wire. A network node is any device that participates in a network: a laptop, a phone, a router, a server, a printer, an industrial sensor, a satellite. The thing that makes it a node and not just a chip is that it has an address on the network and can be communicated with using a shared protocol.

Map the three properties straight across from the data-structure version:

  • Identity. Instead of a heap address, an IP address (32 bits for IPv4, 128 for IPv6). Sometimes layered, with MAC addresses below and DNS names above.
  • State. Whatever the machine is doing internally. A router holds a routing table; a laptop holds your applications; a server holds the database. The state is bigger, but it's still just state.
  • Neighbours. The other nodes it has open connections to. A home laptop knows its router and a few cloud servers. A core internet router knows hundreds of peer routers. The connections are TCP sockets, not heap pointers, but the role is identical.

From struct pointer to IP address

Rust• • •
// What does it mean to ADDRESS a node?  The answer scales with
// the meaning of "node".
//
//   Data-structure node:  a heap address (a raw 64-bit pointer)
//   Network node:         an IP address  (32 bits for IPv4, 128 for IPv6)
//   Blockchain node:      a peer ID, often a public-key hash
//
// All three are "a number you can look up to find the node."
fn data_structure_address(node: &ListNode<i32>) -> *const ListNode<i32> {
    node as *const _                 // raw pointer; 8 bytes on 64-bit
}

// Network address: IPv4 packs four bytes into one u32.
fn network_address(a: u8, b: u8, c: u8, d: u8) -> u32 {
    ((a as u32) << 24) | ((b as u32) << 16) | ((c as u32) << 8) | (d as u32)
}

// Blockchain peer ID: a cryptographic hash of the node's public key.
// libp2p, Bitcoin, Ethereum all do this. The address IS the identity:
// only the holder of the private key can sign as that node.
fn peer_id(pubkey: &[u8]) -> Vec<u8> {
    use sha2::{Sha256, Digest};
    Sha256::digest(pubkey).to_vec()
}
C• • •
// What does it mean to ADDRESS a node?  The answer scales with
// the meaning of "node".
//
//   Data-structure node:  a heap address (a raw 64-bit pointer)
//   Network node:         an IP address  (32 bits for IPv4, 128 for IPv6)
//   Blockchain node:      a peer ID, often a public-key hash
//
// All three are "a number you can look up to find the node."
fn data_structure_address(node: &ListNode<i32>) -> *const ListNode<i32> {
    node as *const _                 // raw pointer; 8 bytes on 64-bit
}

// Network address: IPv4 packs four bytes into one u32.
fn network_address(a: u8, b: u8, c: u8, d: u8) -> u32 {
    ((a as u32) << 24) | ((b as u32) << 16) | ((c as u32) << 8) | (d as u32)
}

// Blockchain peer ID: a cryptographic hash of the node's public key.
// libp2p, Bitcoin, Ethereum all do this. The address IS the identity:
// only the holder of the private key can sign as that node.
fn peer_id(pubkey: &[u8]) -> Vec<u8> {
    use sha2::{Sha256, Digest};
    Sha256::digest(pubkey).to_vec()
}
// connect back to the binary page
An IP address is just a number, written in a friendly way. The binary page made the same point about 237 being identical to 11101101 being identical to 0xED. A network address is that same idea, scaled up: a 32-bit (or 128-bit) integer that uniquely names a participant. The dotted notation 192.168.1.42 is for humans; the wire only sees the bits.

What it means for two network nodes to be connected

For two data-structure nodes, "connected" means a pointer. For two network nodes, "connected" usually means a TCP session: a pair of socket file descriptors, one on each machine, holding buffers and sequence numbers, ready to ferry bytes either way. The connection is bidirectional and stateful: dropping it requires explicit teardown. Setting it up requires the three-way handshake the networking page will cover next.

This is also where the difference in scale becomes obvious. A linked list of ten thousand nodes is a tiny amount of memory. A network of ten thousand nodes is BGP, peering, sub-millisecond routing, undersea cables. Same word, vastly more machinery beneath it.

// looking ahead to the networking page
Everything on this page about network nodes is set up for the next page, which goes into detail: how addresses are assigned, how packets are routed between nodes, how TCP turns an unreliable network of nodes into a reliable byte stream, and how HTTPS layers cryptographic trust on top.
Advanced// level 03

A blockchain node is a network node with strong opinions

One more level up. A blockchain node is just a network node running specific protocol software. Bitcoin Core, geth, reth, lighthouse, solana-validator: each is a daemon you install on a computer, point at the internet, and let run. It opens TCP connections to other nodes running the same software, swaps "version" messages, and starts exchanging blocks and transactions according to the protocol.

Map the three properties one more time:

  • Identity. A peer ID, usually derived from a cryptographic key pair, so the identity is provable. The blockchain pages would call this "an address you can sign as."
  • State. A copy of the chain, a mempool of pending transactions, a peer table, and a wallet (optional). Some nodes keep everything; others keep just the headers.
  • Neighbours. Eight to a few dozen "peer" connections to other nodes in the network, found by gossip and bootstrap lists. Each peer is just an open TCP socket to another machine.

Not every blockchain node is the same

BLOCKCHAIN NODE TYPES - what each one stores and doesFULL NODEstoresevery block, every tx, since genesisroleverifies and forwards everything; the backbone of trustlessnessLIGHT / SPV NODEstoresblock headers only (~80 bytes each)roleyour phone wallet; trusts full nodes for tx inclusion proofsMINING / VALIDATORstoreseverything, plus the candidate next blockroleproposes new blocks; earns the reward when acceptedARCHIVE NODEstoresfull state at every historical blockrolepowers explorers and analytics; rarely needed by ordinary usersevery type speaks the same protocol over TCP/IP - the differences are in what they bother to keep

The protocol is a single specification, but real-world nodes specialise. Four common roles, with different storage and bandwidth costs:

  • Full node. Downloads every block from genesis, verifies every transaction, keeps the full unspent-output (UTXO) set or state trie in memory. This is the trustless backbone: a full node trusts nothing it cannot independently re-verify. Around 700 GB for Bitcoin, well over 1 TB for an Ethereum full node.
  • Light / SPV node. Downloads only block headers (~80 bytes each in Bitcoin, similar in Ethereum). Asks full nodes for Merkle proofs when it needs to verify that a specific transaction is included in a block. Wallet apps on your phone are light nodes; they trade some trust for not needing to download the whole chain.
  • Mining / validator. A full node, plus the extra job of proposing new blocks. In proof-of-work systems (Bitcoin), this means racing to find a nonce. In proof-of-stake (Ethereum after the Merge, Solana, Cosmos), it means being randomly selected to attest to or propose a block, after locking up a stake of native currency. The reward for a successful block goes to whoever proposed it.
  • Archive node. A full node that keeps not just the current state, but every historical state, at every block. Block explorers and analytics platforms (Etherscan, Dune) run on archive nodes. Storage is measured in many TB.
Rust• • •
// A blockchain node is just a TCP server. This sketch is what every
// Bitcoin / Ethereum / Solana node looks like at the network boundary.
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>

int main(void) {
    // Step 1: open a socket and listen for peers (port 8333 = Bitcoin).
    int s = socket(AF_INET, SOCK_STREAM, 0);
    struct sockaddr_in addr = { 0 };
    addr.sin_family = AF_INET;
    addr.sin_port   = htons(8333);
    addr.sin_addr.s_addr = INADDR_ANY;
    bind(s, (struct sockaddr*)&addr, sizeof addr);
    listen(s, 64);

    // Step 2: accept peers, exchange "version" messages, gossip.
    //   For each new peer:
    //     - send "version" message (our height, services, software)
    //     - read their "version", confirm with "verack"
    //     - now we can exchange "inv" announcements, request blocks,
    //       forward transactions through "tx" messages.
    //
    // Every Bitcoin Core, geth, and reth instance on the planet is
    // doing exactly this, with thousands of peers at once.
    return 0;
}
C• • •
// A blockchain node is just a TCP server. This sketch is what every
// Bitcoin / Ethereum / Solana node looks like at the network boundary.
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>

int main(void) {
    // Step 1: open a socket and listen for peers (port 8333 = Bitcoin).
    int s = socket(AF_INET, SOCK_STREAM, 0);
    struct sockaddr_in addr = { 0 };
    addr.sin_family = AF_INET;
    addr.sin_port   = htons(8333);
    addr.sin_addr.s_addr = INADDR_ANY;
    bind(s, (struct sockaddr*)&addr, sizeof addr);
    listen(s, 64);

    // Step 2: accept peers, exchange "version" messages, gossip.
    //   For each new peer:
    //     - send "version" message (our height, services, software)
    //     - read their "version", confirm with "verack"
    //     - now we can exchange "inv" announcements, request blocks,
    //       forward transactions through "tx" messages.
    //
    // Every Bitcoin Core, geth, and reth instance on the planet is
    // doing exactly this, with thousands of peers at once.
    return 0;
}

Why blockchains needed this whole vocabulary

Plain network nodes (a laptop talking to a server, the page after next) only need to address each other. A blockchain has the harder problem: thousands of mutually distrusting nodes, each running their own copy of the same software, somehow agreeing on the same history.

That is the entire reason the vocabulary gets denser at this level. Network nodes need addresses and a transport protocol; blockchain nodes need addresses, a transport protocol, and a consensus protocol on top. The consensus protocol is the rulebook for which sequence of blocks is "the" chain when peers disagree.

The other reason: a blockchain node's address is its public key. The identity is cryptographic, not just network-assigned. You can't fake being node X without holding X's private key, because every action a node takes (proposing a block, signing a transaction, signing an attestation) is signed. The hashing page covered the primitive. The pay-off is identity that cannot be impersonated.

// connect back to the hashing page
The thing that makes a blockchain node's identity strong is the same primitive that makes a Merkle root tamper-evident: cryptographic hashing. A peer ID is typically hash(public_key). Block validation is hash(block_header) compared to the chain's known tip. Transaction signing uses hash-based message authentication. Strip out cryptographic hashing and a blockchain is just a fragile, byzantine-fault-intolerant gossip network.

The three meanings, side by side

data-structure nodenetwork nodeblockchain node
physical forma struct on the heapa whole computera computer running protocol software
identityheap pointer (8 bytes)IP address (32 or 128 bits)public-key hash (256 bits)
statea value and pointer(s)OS + running applicationschain + mempool + peer table
neighboursone to many other nodes via pointersopen TCP sessions to other machines8 to 50 peer sockets, found by gossip
how connections formset a pointer fieldTCP three-way handshakeTCP handshake, then version exchange
trust modelsingle program, no question of trusttrust your ISP and the routes they picktrust nothing; verify everything cryptographically

Where to dig in next

This was the vocabulary page. The mechanics live on other pages:

  • Data-structure nodes: the linked-list page goes deep on lists, splices, and the cache penalty; from there, trees and graphs are natural extensions.
  • Network nodes: the very next page, on networking, covers IP addresses, packets, TCP, and routing in detail.
  • Blockchain nodes: the hashing page sets up the cryptographic primitive; the networking page covers gossip; later pages will cover consensus protocols (Nakamoto, BFT, proof-of-stake), Merkle proofs in practice, and how light clients trust full clients without trusting them.
  • Other "node" meanings worth knowing: the DOM in browsers (HTML is a tree of nodes), Kubernetes (a cluster is a set of nodes), and computational graphs in deep-learning frameworks. Same word, same essential pattern, applied yet again.
next up / 0x0F
One machine becomes many. Networking is where every previous topic shows up.
networking