Nodes

Last edit

Contributors

This topic previously appeared in the Starknet Book.

This topic explores the role and functionality of nodes in the Starknet ecosystem, their interactions with sequencers, and their overall importance.

Overview of nodes in the Starknet ecosystem

A node in the Starknet ecosystem is a computer equipped with Starknet software, contributing significantly to the network’s operation. Nodes are vital for the Starknet ecosystem’s functionality, security, and overall health. Without nodes, the Starknet network would not be able to function effectively.

Nodes in Starknet are categorized into two types:

  • Full nodes: Store the entire Starknet state and validate all transactions, crucial for the network’s integrity.

  • Light nodes: Do not store the entire Starknet state but rely on full nodes for information. Light nodes are faster and more efficient but offer less security than full nodes.

Core functions of nodes

Nodes are fundamental to the Starknet network, performing a variety of critical functions:

  • Transaction validation: Nodes ensure transactions comply with Starknet’s rules, helping prevent fraud and malicious activities.

  • Block Creation and Propagation: Nodes create and circulate blocks to maintain a consistent blockchain view across the network.

  • State maintenance: Nodes track the Starknet network’s current state, including user balances and smart contract code, essential for transaction processing and smart contract execution.

  • API endpoint provision: Nodes provide API endpoints, aiding developers in creating applications, wallets, and tools for network interaction.

  • Transaction relay: Nodes relay user transactions to other nodes, improving network performance and reducing congestion.

Interplay of nodes, sequencers, clients, and the mempool in Starknet

Nodes and sequencers

Nodes and sequencers are interdependent:

  • Nodes and block production: Nodes depend on sequencers to create blocks and update the network state. Sequencers integrate the transactions validated by nodes into blocks, maintaining a consistent and current Starknet state.

  • Sequencers and transaction validation: Sequencers rely on nodes for transaction validation and network consensus. Prior to executing transactions, sequencers work with nodes to confirm transaction legitimacy, deterring fraudulent activities. Nodes also contribute to the consensus mechanism, ensuring uniformity in the blockchain state.

Nodes and clients

The relationship between nodes and clients in the Starknet ecosystem is characterized by a client-server model:

  • Client requests and node responses: Clients send requests, like transaction submissions or state queries. Nodes process these requests, validating transactions, updating the network state, and providing clients with the requested data.

  • Client experience: Clients receive node responses, updating their local view with the latest network information. This loop enables user interaction with Starknet DApps, with nodes maintaining network integrity, while clients provide a user-friendly interface.

Nodes and the mempool

The mempool acts as a holding area for unprocessed transactions:

  • Transaction validation and mempool storage: Upon receiving a transaction, a node validates it. Valid transactions are added to the mempool and broadcast to other network nodes.

  • Transaction selection and block inclusion: Nodes select transactions from the mempool for processing, incorporating them into blocks that are added to the blockchain.

Node implementations in Starknet

Each Starknet node implementation has its own strengths:

  • Pathfinder, by Equilibrium: Pathfinder is a full node written in Rust. Pathfinder excels in high performance, scalability, and aligns with the Starknet Cairo specification.

  • Juno, by Nethermind: Juno, is a full node written in Golang. Juno is known for user-friendliness, ease of deployment, and compatibility with Ethereum tools.

  • Papyrus, by StarkWare: Papyrus is also a full node written in Rust. Papyrus focuses on security and robustness. It’s integral to the upcoming Starknet Sequencer, expected to boost network throughput.

These implementations are continuously being improved, with new features and enhancements. The choice of implementation depends on user or developer preferences and requirements.

Key characteristics of each node implementation are summarized below:

Node Implementation Language Strengths

Pathfinder

Rust

High performance, scalability, Cairo specification adherence

Papyrus

Rust

Security, robustness, Starknet Sequencer foundation

Juno

Golang

User-friendliness, ease of deployment, Ethereum compatibility