Skip to content

Commit f3918a8

Browse files
committed
WIP: Add user manual content and update site navigation
- Updated the site navigation to include a link to the new user manual under the Resources menu.
1 parent 6b9cf20 commit f3918a8

25 files changed

+1726
-2
lines changed

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: "/manual/"
1212
text: "User Manual"
1313
icon: "fas fa-book"
1414
color: "is-medium-teal"

hugo-site/content/manual/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
**NOTE:** This document is a work in progress. You can [submit an issue](https://github.com/freenet/freenet-core/issues/new?labels=A-documentation) if you find a problem or have a suggestion. The source for this documentation is in our repository at [freenet-core/docs/src](https://github.com/freenet/freenet-core/tree/main/docs/src). We welcome pull requests.
2+
3+
# Introduction
4+
5+
## What is Freenet?
6+
7+
Freenet is a global, [observable](https://en.wikipedia.org/wiki/Small-world_network), decentralized key-value store. Values are arbitrary blocks of data, called the contract's "state." Keys are cryptographic contracts that specify:
8+
9+
- Whether a given state is permitted under this contract
10+
- How the state can be modified over time
11+
- How two valid states can be merged
12+
- How to efficiently synchronize a contract's state between peers
13+
14+
Freenet is a true decentralized peer-to-peer network, and is robust and scalable, through its use of a [small-world network](https://en.wikipedia.org/wiki/Small-world_network).
15+
16+
Applications on Freenet can be built in any language that is supported by web browsers, including JavaScript and WebAssembly. These applications are distributed over Freenet and can create, retrieve, and update contracts through a WebSocket connection to the local Freenet peer.
17+
18+
## Writing a Contract
19+
20+
Freenet contracts can be written in any language that compiles to WebAssembly.
21+
This includes [Rust](https://www.rust-lang.org/), and
22+
[AssemblyScript](https://www.assemblyscript.org/), among many others.
23+
24+
A contract consists of the WebAssembly code itself and its "parameters," which are additional data like cryptographic keys. This makes it easy to configure contracts without having to recompile them.
25+
26+
A contract can be retrieved using a key, which is a cryptographic hash derived from the contract's WebAssembly code together with its parameters.
27+
28+
## Small world routing
29+
30+
Freenet peers self-organize into a [small-world network](https://en.wikipedia.org/wiki/Small-world_routing) to allow contracts to be found in a fast, scalable, and decentralized way.
31+
32+
Every peer in Freenet is assigned a number between 0 and 1 when it first joins the network, this is the peer's "location". The small world network topology ensures that peers with similar locations are more likely to be connected.
33+
34+
Contracts also have a location, which is derived from the contract's key. Peers cache contracts close to their locations.
35+
36+
## Writing an Application
37+
38+
Creating a decentralized application on Freenet is very similar to creating a normal web application. You can use familiar frameworks like React, Bootstrap, Angular, Vue.js, and so on.
39+
40+
The main difference is that instead of connecting to a REST API running on a server, the web application connects to the Freenet peer running on the local computer through a [WebSocket](https://en.wikipedia.org/wiki/WebSocket) connection.
41+
42+
Through this the application can:
43+
44+
- Create new contracts and their associated state
45+
- Retrieve contracts and their state
46+
- Modify contract state when permitted by the contract
47+
48+
## How to use Contracts
49+
50+
Contracts are extremely flexible. they can be used to create decentralized data structures like hashmaps, inverted indices for keyword search, or efficient buffers for streaming audio and video.
51+
52+
## Delegate Ecosystem
53+
54+
Applications in Freenet don't need to be built from scratch, they can be built on top of components provided by us or others.
55+
56+
### Reputation system
57+
58+
Allows users to build up reputation over time based on feedback from those they interact with. Think of the feedback system in services like Uber, but with Freenet it will be entirely decentralized and cryptographically secure. It can be used for things like spam prevention (with IM and email), or fraud prevention (with an online store).
59+
60+
This is conceptually similar to Freenet's [Web of Trust](http://www.draketo.de/english/freenet/friendly-communication-with-anonymity) plugin.
61+
62+
### Arbiters
63+
64+
Arbiters are trusted services that can perform tasks and authenticate the results, such as verifying that a contract had a particular state at a given time, or that external blockchains (Bitcoin, Ethereum, Solana etc) contain specific transactions. Trust is achieved through the reputation system.

hugo-site/content/manual/_index.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "Manual"
3+
date: 2025-04-13 # For blog-style ordering or metadata
4+
draft: false # Prevents Hugo from skipping the page in output
5+
weight: 3 # Controls order in listings (lower = higher)
6+
---
7+
8+
9+
# Manual Index
10+
11+
## Introduction
12+
13+
- [Introduction](introduction)
14+
15+
## Components
16+
17+
- [Overview](components/overview)
18+
- [Contracts](components/contracts)
19+
- [Delegates](components/delegates)
20+
- [User Interfaces](components/ui)
21+
22+
## Architecture
23+
24+
- [P2P Network](architecture/p2p-network)
25+
- [Intelligent Routing](architecture/irouting)
26+
- [Transport](architecture/transport)
27+
28+
## Developer Guide
29+
30+
- [Tutorial: Create an App](tutorial)
31+
- [Contract interfaces](contract-interface)
32+
- [freenet.toml format](manifest)
33+
34+
## Examples
35+
36+
- [Antiflood Tokens](examples/antiflood-tokens)
37+
- [Blind Trust Tokens](examples/blind-trust-tokens)
38+
39+
## Community and Support
40+
41+
- [Community](community)
42+
43+
## Reference
44+
45+
- [Glossary](glossary)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title: "Intelligent Routing"
3+
date: 2025-04-13
4+
draft: false
5+
weight: 2
6+
---
7+
8+
## Intelligent Routing
9+
10+
Freenet's request routing mechanism plays a crucial role in the efficiency of
11+
the network.
12+
13+
It is responsible for deciding which peer to route a request to when attempting
14+
to read, create, or modify a contract's state. The mechanism is designed to
15+
select the peer that can complete the request the fastest, which may not always
16+
be the peer closest to the contract's location - the traditional approach for
17+
routing in a small-world network, known as [greedy
18+
routing](https://en.wikipedia.org/wiki/Small-world_routing#Greedy_routing).
19+
20+
### Isotonic Regression
21+
22+
Freenet uses [isotonic regression](https://github.com/sanity/pav.rs), a method
23+
for estimating a monotonically increasing or decreasing function given a set of
24+
data, to predict the response time from a peer based on its ring distance from
25+
the target location of the request.
26+
27+
This estimation is then adjusted by the average difference between the isotonic
28+
regression estimate and the actual response time from previous interactions with
29+
the peer. This process enables a form of adaptive routing that selects the peer
30+
with the lowest estimated response time.
31+
32+
### Router Initialization and Event Handling
33+
34+
When a new
35+
[Router](https://github.com/freenet/freenet-core/blob/main/crates/core/src/router.rs)
36+
is created, it's initialized with a history of routing events. These events are
37+
processed to generate the initial state of the isotonic estimators. For example,
38+
failure outcomes and success durations are computed for each event in the
39+
history and used to initialize the respective estimators. The average transfer
40+
size is also computed from the history.
41+
42+
The Router can add new events to its history, updating its estimators in the
43+
process. When a successful routing event occurs, the Router updates its response
44+
start time estimator, failure estimator, and transfer rate estimator based on
45+
the details of the event. If a failure occurs, only the failure estimator is
46+
updated.
47+
48+
### Peer Selection
49+
50+
To select a peer for routing a request, the Router first checks whether it has
51+
sufficient historical data. If not, it selects the peer with the minimum
52+
distance to the contract location. If it does have sufficient data, it predicts
53+
the outcome of routing the request to each available peer and selects the one
54+
with the best predicted outcome.
55+
56+
### Outcome Prediction
57+
58+
To predict the outcome of routing a request to a specific peer, the Router uses
59+
its isotonic estimators to predict the time to the start of the response, the
60+
chance of failure, and the transfer rate. These predictions are used to compute
61+
an expected total time for the request, with the cost of a failure being assumed
62+
as a multiple of the cost of success. The peer with the lowest expected total
63+
time is selected for routing the request.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "P2P Network"
3+
date: 2025-04-13
4+
draft: false
5+
weight: 1
6+
---
7+
8+
# Freenet Network Topology
9+
10+
## Small-World Network
11+
12+
Freenet is structured as a decentralized peer-to-peer network, based on the idea of
13+
a [small-world network](https://en.wikipedia.org/wiki/Small-world_network). This
14+
network topology is scalable and efficient, allowing contract state to be found
15+
quickly and without any reliance on a central authority.
16+
17+
![Small World Network](p2p-network.svg)
18+
19+
## Freenet Peers
20+
21+
In Freenet, a "peer" is any computer running the [Freenet
22+
Core](https://github.com/freenet/freenet-core) software. The peers are organized
23+
in a ring-like structure, with each peer assigned a specific numerical value
24+
between 0.0 and 1.0, indicating its location in the network's topology. This
25+
location is derived from the peer's IP address.
26+
27+
## Establishing Neighbor Connections
28+
29+
Every Freenet peer, also referred to as a node, forms two-way connections with a
30+
set of other peers, termed "neighbors." These connections utilize the User
31+
Datagram Protocol (UDP) and can do [Firewall hole punching](<https://en.wikipedia.org/wiki/Hole_punching_(networking)>) when necessary. Peers manage their resource usage —
32+
bandwidth, memory, CPU, and storage — based on limits set by the user.
33+
34+
## Adaptive behavior
35+
36+
Peers keep track of their neighbor's performance and learn to prefer faster
37+
connections over time.
38+
39+
Peers can also identify bad behavior by other peers like excess resource usage and
40+
will disconnect from them.

hugo-site/content/manual/architecture/p2p-network.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)