Skip to content

Commit af2c011

Browse files
0xLuccanhussein11dawnkelly09eshaben
authored
Add node and runtime page (#369)
* Add node and runtime page * Apply suggestions from code review Co-authored-by: Nicolás Hussein <[email protected]> Co-authored-by: Dawn Kelly <[email protected]> * Apply suggestions * Update llms.txt * Apply suggestions from code review Co-authored-by: Dawn Kelly <[email protected]> * Move above Interoperability * Update llms.txt * Update llms.txt * update llms * llms * llms --------- Co-authored-by: Nicolás Hussein <[email protected]> Co-authored-by: Dawn Kelly <[email protected]> Co-authored-by: Erin Shaben <[email protected]>
1 parent 1e64440 commit af2c011

File tree

3 files changed

+196
-0
lines changed

3 files changed

+196
-0
lines changed

llms.txt

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Doc-Page: https://docs.polkadot.com/polkadot-protocol/basics/data-encoding/
106106
Doc-Page: https://docs.polkadot.com/polkadot-protocol/basics/
107107
Doc-Page: https://docs.polkadot.com/polkadot-protocol/basics/interoperability/
108108
Doc-Page: https://docs.polkadot.com/polkadot-protocol/basics/networks/
109+
Doc-Page: https://docs.polkadot.com/polkadot-protocol/basics/node-and-runtime/
109110
Doc-Page: https://docs.polkadot.com/polkadot-protocol/basics/randomness/
110111
Doc-Page: https://docs.polkadot.com/polkadot-protocol/glossary/
111112
Doc-Page: https://docs.polkadot.com/polkadot-protocol/
@@ -17275,6 +17276,105 @@ Key features of Chopsticks include:
1727517276
Chopsticks provides a controlled environment for developers to safely explore the effects of runtime changes. It ensures that network behavior is tested and verified before upgrades are deployed to live networks.
1727617277
--- END CONTENT ---
1727717278

17279+
Doc-Content: https://docs.polkadot.com/polkadot-protocol/basics/node-and-runtime/
17280+
--- BEGIN CONTENT ---
17281+
---
17282+
title: Node and Runtime
17283+
description: Learn how Polkadot SDK-based nodes function, how the client and runtime are separated, and how they communicate using SCALE-encoded data.
17284+
---
17285+
17286+
# Node and Runtime
17287+
17288+
## Introduction
17289+
17290+
Every blockchain platform relies on a decentralized network of computers, called nodes, that communicate with each other about transactions and blocks. In this context, a node refers to the software running on the connected devices rather than the physical or virtual machines in the network.
17291+
17292+
Polkadot SDK-based nodes consist of two main components, each with distinct responsibilities: the client (also called node) and the runtime.
17293+
17294+
If the system were a monolithic protocol, any modification would require updating the entire system. Instead, Polkadot achieves true upgradeability by defining an immutable meta-protocol (the client) and a protocol (the runtime) that can be upgraded independently.
17295+
17296+
This separation gives the [Polkadot Relay Chain](/polkadot-protocol/architecture/polkadot-chain){target=\_blank} and all connected [parachains](/polkadot-protocol/architecture/parachains){target=\_blank} an evolutionary advantage over other blockchain platforms.
17297+
17298+
## Architectural Principles
17299+
17300+
The Polkadot SDK-based blockchain architecture is fundamentally built on two distinct yet interconnected components:
17301+
17302+
- **Client (Meta-protocol)**
17303+
- Handles the foundational infrastructure of the blockchain
17304+
- Manages runtime execution, networking, consensus, and other off-chain components
17305+
- Provides an immutable base layer that ensures network stability
17306+
- Upgradable only through hard forks
17307+
17308+
- **Runtime (Protocol)**
17309+
- Defines the blockchain's state transition logic
17310+
- Determines the specific rules and behaviors of the blockchain
17311+
- Compiled to WebAssembly (Wasm) for platform-independent execution
17312+
- Capable of being upgraded without network-wide forking
17313+
17314+
### Advantages of this Architecture
17315+
17316+
- **Forkless upgrades** - runtime can be updated without disrupting the entire network
17317+
- **Modularity** - clear separation allows independent development of client and runtime
17318+
- **Flexibility** - enables rapid iteration and evolution of blockchain logic
17319+
- **Performance** - WebAssembly compilation provides efficient, cross-platform execution
17320+
17321+
## Node (Client)
17322+
17323+
The node, also known as the client, is the core component responsible for executing the Wasm runtime and orchestrating various essential blockchain components. It ensures the correct execution of the state transition function and manages multiple critical subsystems, including:
17324+
17325+
- **Wasm execution** - runs the blockchain runtime, which defines the state transition rules
17326+
- **Database management** - stores blockchain data
17327+
- **Networking** - facilitates peer-to-peer communication, block propagation, and transaction gossiping
17328+
- **Transaction pool (Mempool)** - manages pending transactions before they are included in a block
17329+
- **Consensus mechanism** - ensures agreement on the blockchain state across nodes
17330+
- **RPC services** - provides external interfaces for applications and users to interact with the node
17331+
17332+
## Runtime
17333+
17334+
The runtime is more than just a set of rules. It's the fundamental logic engine that defines a blockchain's entire behavior. In Polkadot SDK-based blockchains, the runtime represents a complete, self-contained description of the blockchain's state transition function.
17335+
17336+
### Characteristics
17337+
17338+
The runtime is distinguished by three key characteristics:
17339+
17340+
- **Business logic** - defines the complete application-specific blockchain behavior
17341+
- **WebAssembly compilation** - ensures platform-independent, secure execution
17342+
- **On-chain storage** - stored within the blockchain's state, allowing dynamic updates
17343+
17344+
### Key Functions
17345+
17346+
The runtime performs several critical functions, such as:
17347+
17348+
- Define state transition rules
17349+
- Implement blockchain-specific logic
17350+
- Manage account interactions
17351+
- Control transaction processing
17352+
- Define governance mechanisms
17353+
- Handle custom pallets and modules
17354+
17355+
## Communication Between Node and Runtime
17356+
17357+
The client and runtime communicate exclusively using [SCALE-encoded](/polkadot-protocol/basics/data-encoding){target=\_blank} communication. This ensures efficient and compact data exchange between the two components.
17358+
17359+
### Runtime APIs
17360+
17361+
The Runtime API consists of well-defined functions and constants a client assumes are implemented in the Runtime Wasm blob. These APIs enable the client to interact with the runtime to execute blockchain operations and retrieve information. The client invokes these APIs to:
17362+
17363+
- Build, execute, and finalize blocks
17364+
- Access metadata
17365+
- Access consensus related information
17366+
- Handle transaction execution
17367+
17368+
### Host Functions
17369+
17370+
During execution, the runtime can access certain external client functionalities via host functions. The specific functions the client exposes allow the runtime to perform operations outside the WebAssembly domain. Host functions enable the runtime to:
17371+
17372+
- Perform cryptographic operations
17373+
- Access the current blockchain state
17374+
- Handle storage modifications
17375+
- Allocate memory
17376+
--- END CONTENT ---
17377+
1727817378
Doc-Content: https://docs.polkadot.com/polkadot-protocol/basics/randomness/
1727917379
--- BEGIN CONTENT ---
1728017380
---

polkadot-protocol/basics/.pages

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ nav:
44
- 'Networks': networks.md
55
- 'Accounts': accounts.md
66
- blocks-transactions-fees
7+
- 'Node and Runtime': node-and-runtime.md
78
- 'Interoperability': interoperability.md
89
- 'Randomness': randomness.md
910
- 'Cryptography': cryptography.md
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: Node and Runtime
3+
description: Learn how Polkadot SDK-based nodes function, how the client and runtime are separated, and how they communicate using SCALE-encoded data.
4+
---
5+
6+
# Node and Runtime
7+
8+
## Introduction
9+
10+
Every blockchain platform relies on a decentralized network of computers, called nodes, that communicate with each other about transactions and blocks. In this context, a node refers to the software running on the connected devices rather than the physical or virtual machines in the network.
11+
12+
Polkadot SDK-based nodes consist of two main components, each with distinct responsibilities: the client (also called node) and the runtime.
13+
14+
If the system were a monolithic protocol, any modification would require updating the entire system. Instead, Polkadot achieves true upgradeability by defining an immutable meta-protocol (the client) and a protocol (the runtime) that can be upgraded independently.
15+
16+
This separation gives the [Polkadot Relay Chain](/polkadot-protocol/architecture/polkadot-chain){target=\_blank} and all connected [parachains](/polkadot-protocol/architecture/parachains){target=\_blank} an evolutionary advantage over other blockchain platforms.
17+
18+
## Architectural Principles
19+
20+
The Polkadot SDK-based blockchain architecture is fundamentally built on two distinct yet interconnected components:
21+
22+
- **Client (Meta-protocol)**
23+
- Handles the foundational infrastructure of the blockchain
24+
- Manages runtime execution, networking, consensus, and other off-chain components
25+
- Provides an immutable base layer that ensures network stability
26+
- Upgradable only through hard forks
27+
28+
- **Runtime (Protocol)**
29+
- Defines the blockchain's state transition logic
30+
- Determines the specific rules and behaviors of the blockchain
31+
- Compiled to WebAssembly (Wasm) for platform-independent execution
32+
- Capable of being upgraded without network-wide forking
33+
34+
### Advantages of this Architecture
35+
36+
- **Forkless upgrades** - runtime can be updated without disrupting the entire network
37+
- **Modularity** - clear separation allows independent development of client and runtime
38+
- **Flexibility** - enables rapid iteration and evolution of blockchain logic
39+
- **Performance** - WebAssembly compilation provides efficient, cross-platform execution
40+
41+
## Node (Client)
42+
43+
The node, also known as the client, is the core component responsible for executing the Wasm runtime and orchestrating various essential blockchain components. It ensures the correct execution of the state transition function and manages multiple critical subsystems, including:
44+
45+
- **Wasm execution** - runs the blockchain runtime, which defines the state transition rules
46+
- **Database management** - stores blockchain data
47+
- **Networking** - facilitates peer-to-peer communication, block propagation, and transaction gossiping
48+
- **Transaction pool (Mempool)** - manages pending transactions before they are included in a block
49+
- **Consensus mechanism** - ensures agreement on the blockchain state across nodes
50+
- **RPC services** - provides external interfaces for applications and users to interact with the node
51+
52+
## Runtime
53+
54+
The runtime is more than just a set of rules. It's the fundamental logic engine that defines a blockchain's entire behavior. In Polkadot SDK-based blockchains, the runtime represents a complete, self-contained description of the blockchain's state transition function.
55+
56+
### Characteristics
57+
58+
The runtime is distinguished by three key characteristics:
59+
60+
- **Business logic** - defines the complete application-specific blockchain behavior
61+
- **WebAssembly compilation** - ensures platform-independent, secure execution
62+
- **On-chain storage** - stored within the blockchain's state, allowing dynamic updates
63+
64+
### Key Functions
65+
66+
The runtime performs several critical functions, such as:
67+
68+
- Define state transition rules
69+
- Implement blockchain-specific logic
70+
- Manage account interactions
71+
- Control transaction processing
72+
- Define governance mechanisms
73+
- Handle custom pallets and modules
74+
75+
## Communication Between Node and Runtime
76+
77+
The client and runtime communicate exclusively using [SCALE-encoded](/polkadot-protocol/basics/data-encoding){target=\_blank} communication. This ensures efficient and compact data exchange between the two components.
78+
79+
### Runtime APIs
80+
81+
The Runtime API consists of well-defined functions and constants a client assumes are implemented in the Runtime Wasm blob. These APIs enable the client to interact with the runtime to execute blockchain operations and retrieve information. The client invokes these APIs to:
82+
83+
- Build, execute, and finalize blocks
84+
- Access metadata
85+
- Access consensus related information
86+
- Handle transaction execution
87+
88+
### Host Functions
89+
90+
During execution, the runtime can access certain external client functionalities via host functions. The specific functions the client exposes allow the runtime to perform operations outside the WebAssembly domain. Host functions enable the runtime to:
91+
92+
- Perform cryptographic operations
93+
- Access the current blockchain state
94+
- Handle storage modifications
95+
- Allocate memory

0 commit comments

Comments
 (0)