|
| 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. |
0 commit comments