Skip to content

Commit af875d8

Browse files
authored
Merge pull request #8 from Sam-Max/user-manual
Add user manual content with structured sections and table of contents
2 parents 6b9cf20 + 04c1a3a commit af875d8

29 files changed

+1762
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup Hugo
2525
uses: peaceiris/actions-hugo@v3
2626
with:
27-
hugo-version: '0.133.1'
27+
hugo-version: '0.141.0'
2828
extended: true
2929

3030
# Setup Rust environment

hugo-site/content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ links:
88
text: "Video Talks"
99
icon: "fas fa-video"
1010
color: "is-medium-blue"
11-
- url: "https://docs.freenet.org/"
11+
- url: "/resources/manual/"
1212
text: "User Manual"
1313
icon: "fas fa-book"
1414
color: "is-medium-teal"
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: "Freenet Manual"
3+
date: 2025-04-13
4+
draft: false
5+
layout: "single"
6+
---
7+
8+
This guide provides **comprehensive documentation** on Freenet's components, architecture, and
9+
usage. Use the table of contents below to navigate through the manual.
10+
11+
---
12+
13+
## 📚 Table of Contents
14+
15+
1. [Introduction](introduction)
16+
2. [Components](#components)
17+
3. [Architecture](#architecture)
18+
4. [Developer Guide](#developer-guide)
19+
5. [Examples](#examples)
20+
6. [Community and Support](#community-and-support)
21+
7. [Reference](#reference)
22+
23+
---
24+
25+
## 📝 Introduction
26+
27+
Learn the basics of Freenet and its purpose.
28+
29+
- [Introduction](introduction)
30+
31+
---
32+
33+
## Components
34+
35+
Explore the key components of Freenet:
36+
37+
- [Overview](components/overview): A high-level overview of Freenet's components.
38+
- [Contracts](components/contracts): Details about contracts in Freenet.
39+
- [Delegates](components/delegates): Explanation of delegates and their roles.
40+
- [User Interfaces](components/ui): Information on available user interfaces.
41+
42+
---
43+
44+
## 🏗️ Architecture {#architecture}
45+
46+
Understand Freenet's architecture and how it works:
47+
48+
- [P2P Network](architecture/p2p-network): Explore the peer-to-peer network structure.
49+
- [Intelligent Routing](architecture/irouting): Understand Freenet's intelligent routing mechanisms.
50+
- [Transport](architecture/transport): Learn about the transport layer in Freenet.
51+
52+
---
53+
54+
## 👩‍💻 Developer Guide {#developer-guide}
55+
56+
Resources for developers working with Freenet:
57+
58+
- [Tutorial: Create an App](tutorial): Step-by-step guide to creating an app on Freenet.
59+
- [Contract Interfaces](contract-interface): Reference for contract interfaces.
60+
- [Manifest Format](manifest): Details about the `freenet.toml` configuration format.
61+
62+
---
63+
64+
## 🛠️ Examples {#examples}
65+
66+
- [Antiflood Tokens](examples/antiflood-tokens)
67+
- [Blind Trust Tokens](examples/blind-trust-tokens)
68+
69+
---
70+
71+
## 🌐 Community and Support {#community-and-support}
72+
73+
Get involved with the Freenet community:
74+
75+
- [Community](community)
76+
77+
---
78+
79+
## 📖 Reference {#reference}
80+
81+
Additional resources and glossary:
82+
83+
- [Glossary](glossary)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "Architecture"
3+
date: 2025-04-13
4+
draft: false
5+
---
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: "Intelligent Routing"
3+
date: 2025-04-13
4+
draft: false
5+
weight: 2
6+
---
7+
8+
Freenet's request routing mechanism plays a crucial role in the efficiency of
9+
the network.
10+
11+
It is responsible for deciding which peer to route a request to when attempting
12+
to read, create, or modify a contract's state. The mechanism is designed to
13+
select the peer that can complete the request the fastest, which may not always
14+
be the peer closest to the contract's location - the traditional approach for
15+
routing in a small-world network, known as [greedy
16+
routing](https://en.wikipedia.org/wiki/Small-world_routing#Greedy_routing).
17+
18+
### Isotonic Regression
19+
20+
Freenet uses [isotonic regression](https://github.com/sanity/pav.rs), a method
21+
for estimating a monotonically increasing or decreasing function given a set of
22+
data, to predict the response time from a peer based on its ring distance from
23+
the target location of the request.
24+
25+
This estimation is then adjusted by the average difference between the isotonic
26+
regression estimate and the actual response time from previous interactions with
27+
the peer. This process enables a form of adaptive routing that selects the peer
28+
with the lowest estimated response time.
29+
30+
### Router Initialization and Event Handling
31+
32+
When a new
33+
[Router](https://github.com/freenet/freenet-core/blob/main/crates/core/src/router.rs)
34+
is created, it's initialized with a history of routing events. These events are
35+
processed to generate the initial state of the isotonic estimators. For example,
36+
failure outcomes and success durations are computed for each event in the
37+
history and used to initialize the respective estimators. The average transfer
38+
size is also computed from the history.
39+
40+
The Router can add new events to its history, updating its estimators in the
41+
process. When a successful routing event occurs, the Router updates its response
42+
start time estimator, failure estimator, and transfer rate estimator based on
43+
the details of the event. If a failure occurs, only the failure estimator is
44+
updated.
45+
46+
### Peer Selection
47+
48+
To select a peer for routing a request, the Router first checks whether it has
49+
sufficient historical data. If not, it selects the peer with the minimum
50+
distance to the contract location. If it does have sufficient data, it predicts
51+
the outcome of routing the request to each available peer and selects the one
52+
with the best predicted outcome.
53+
54+
### Outcome Prediction
55+
56+
To predict the outcome of routing a request to a specific peer, the Router uses
57+
its isotonic estimators to predict the time to the start of the response, the
58+
chance of failure, and the transfer rate. These predictions are used to compute
59+
an expected total time for the request, with the cost of a failure being assumed
60+
as a multiple of the cost of success. The peer with the lowest expected total
61+
time is selected for routing the request.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: "P2P Network"
3+
date: 2025-04-13
4+
draft: false
5+
---
6+
7+
# Freenet Network Topology
8+
9+
## Small-World Network
10+
11+
Freenet is structured as a decentralized peer-to-peer network, based on the idea of
12+
a [small-world network](https://en.wikipedia.org/wiki/Small-world_network). This
13+
network topology is scalable and efficient, allowing contract state to be found
14+
quickly and without any reliance on a central authority.
15+
16+
![Small World Network](/p2p-network.svg)
17+
18+
## Freenet Peers
19+
20+
In Freenet, a "peer" is any computer running the [Freenet
21+
Core](https://github.com/freenet/freenet-core) software. The peers are organized
22+
in a ring-like structure, with each peer assigned a specific numerical value
23+
between 0.0 and 1.0, indicating its location in the network's topology. This
24+
location is derived from the peer's IP address.
25+
26+
## Establishing Neighbor Connections
27+
28+
Every Freenet peer, also referred to as a node, forms two-way connections with a
29+
set of other peers, termed "neighbors." These connections utilize the User
30+
Datagram Protocol (UDP) and can do [Firewall hole punching](<https://en.wikipedia.org/wiki/Hole_punching_(networking)>) when necessary. Peers manage their resource usage —
31+
bandwidth, memory, CPU, and storage — based on limits set by the user.
32+
33+
## Adaptive behavior
34+
35+
Peers keep track of their neighbor's performance and learn to prefer faster
36+
connections over time.
37+
38+
Peers can also identify bad behavior by other peers like excess resource usage and
39+
will disconnect from them.

0 commit comments

Comments
 (0)