Web of Trust - a collaborative spam filter for Freenet
The Freenet plugin Web of Trust (WoT) tries to solve the problem of
spam being an important threat to address in an anonymous, censorship-resistant network:
Where an attacker cannot take down content they will attempt to get rid of it by drowning it in spam.
Conventional spam filters cannot work in such an environment:
- An attacker is anonymous like everyone else so they cannot be blocked by e.g. an IP address.
- Because Freenet is a peer-to-peer network its available bandwidth is scarce and thus spam must not even be downloaded before filtering it out in order to avoid denial of service - filtering spam by e.g. lists of bad words won't work.
WoT deals with these issues by allowing each user to create so-called identities which can assign
trust values to the identities of other users and optionally publish these.
These constitute a democratic vote among users, where the distance of other users' identities in the social graph is used to weigh their votes in your local WoT. This is similar to the concept of subsidiarity in democracy.
The result of this poll decides if a particular identity is considered as legitimate or as a spammer. The content of spammers is completely ignored then, it won't cause any network traffic.
Thus each user has their own view and final decision on what they consider as spam, depending on who they voted for or against.
While WoT does have a user interface of its own which can be used to manage identites and trusts, it is intended to be used as a general-purpose library to allow actual Freenet applications to be built upon it. As of 2019 these are:
- Sone - social networking
- FlogHelper - blogging
- Freemail - email
- Freetalk - forum systems (in development)
For an in-depth explanation of how WoT works see the whitepaper / core developer's manual.
While the repository for the officially shipped WoT binary is hosted on
Freenet's GitHub, you may consider to instead create your pull
requests at xor-freenet's WoT repository
to receive extended and accelerated review:
He wrote most of WoT's code and works on it every week.
After his review xor will submit your code to the official Freenet developers for inclusion in the main repository.
- file a bug in the Web of Trust project on the Freenet bugtracker
- or, to remain anonymous by using Freenet, post on the
By the way: News about the current WoT development are posted to that board about every week.
Clone the fred and plugin-WebOfTrust repositories into the same
Compile fred by command line using
( cd fred && ./gradlew jar copyRuntimeLibs ), or for
compiling it with Eclipse use the below instructions.
Compiling by command line
# With the Ant build script reference implementation: ant # If you get errors about missing classes check build.xml for whether the JAR locations are correct. # With the new Gradle builder - it is fully tested against Ant (see tools/) but lacks some features. # Its advantages are: # - parallel unit test execution on all available CPU cores. # - incremental builds are supported (leave out "clean jar"). gradle clean jar # Wrong JAR locations can be fixed in the file build.gradle
WebOfTrust.jar will be in the
You can load it on the
Plugins page of the Freenet web interface.
Additional compilation options
# Compile and produce test coverage and code complexity statistics as HTML. sudo apt install cobertura ant -Dtest.coverage=true firefox test-coverage/html/index.html # Skip unit tests. ant -Dtest.skip=true # With Ant gradle -x test # With Gradle # Run a single unit test. ant -Dtest.class=plugins.WebOfTrust.CLASSNAME # Show test stdout/stderr with Gradle to debug failures, especially by obtaining the test's PRNG # seed which can be used to reproduce a run by hardcoding it into the AbstractJUnit3/4BaseTest # classes. Ant will show the output by default. WOT__SHOW_GRADLE_TEST_OUTPUT=1 gradle test # Benchmark all unit tests and produce sorted output to figure out the slowest ones tools/benchmark-unit-tests # Benchmark a single unit test and produce average runtime to improve it tools/benchmark-unit-test TEST_CLASS TEST_FUNCTION NUMBER_OF_ITERATIONS
Compiling with Eclipse
These instructions have been written for the Eclipse package
Eclipse IDE for Java Developers of
Linux 64-bit, which you can get
- Import the fred project into Eclipse:
File / Import... / Gradle / Existing Gradle Project.
- Configure the project to use Gradle version
Right click the project / Properties / Gradle.
Automatic project Synchronizationthere as well.
- Enable Eclipse's
Gradle tasksviews at
Window / Show view / Other....
- In the
Gradle Tasksview, right click
Run Default Gradle Tasks.
Wait for Gradle to finish. You can see its output and error messages in the
- Once the above step is finished, the green
Runbutton in the main toolbar will show a run configuration for fred in its dropdown menu.
Open the UI to edit it at
Run / Run Configurations...and there set:
Gradle Tasks / Gradle tasks: jar copyRuntimeLibs
The latter ensures Gradle copies all dependency JARs of Freenet to a single directory which WoT will use.
TODO: Prefix with
cleantask once it doesn't break
Arguments / Program Arguments: -x testoptionally to skip running the fred unit tests at every build.
- Re-run fred's Gradle with the above run configuration via
Run / <configuration name>.
- Import the WoT project as type
General / Existing Projects into Workspace- that type is what to use here because the WoT repository already contains an Eclipse project configuration.
- Ensure a Gradle run configuration for WoT is created by running the default tasks like you did
Set its Gradle tasks to
clean jarif you want to ensure the JAR is always fully rebuilt. Not fully rebuilding may cause e.g. deleted classes to persist in the JAR, though I have not tested if this still applies to a build system as modern as Gradle.
If you want to run the unit tests through Eclipse's UI for that you also need to add
testJarto the tasks to ensure the JAR containing the tests gets built.
Notice: Building using
Project / Build project or
Project / Build Automatically or the
toolbar buttons does not seem to trigger Gradle with the said Eclipse version!
It seems that this only triggers Eclipse's internal Java builder which is used to empower Eclipse's own features.
As a consequence, manually run Gradle using the aforementioned
Run button in case you need the
WoT JAR as output, e.g. for the following
Running the unit tests is also done by that - using a Gradle run configuration which includes the
test task - or by Eclipse's own UI for running tests.
The Eclipse UI however does not exclude certain slow tests which WoT's Gradle would only run optionally. So ideally you would use Gradle to run all tests in bulk, and the Eclipse UI to selectively repeat only single failing ones in order to debug them with the Eclipse debugger.
Notice: Should Eclipse show errors about missing JARs such as
db4o.jar and say they prevent it
from building: Notice that the JARs likely have in fact been created by the fred/WoT Gradle
builders on the filesystem already, so you can fix Eclipse to notice them by:
Right click the project / Gradle / Refresh Gradle Project.
Project / Build Projectto manually start a build. Automatic building might have to be disabled in the same menu.
- Run fred's class
freenet.node.NodeStarterusing the Eclipse debugger.
- Browse to Freenet's Plugins page.
- Use the
Load Pluginbox to load
- After the plugin is loaded, WoT will be accessible at the
- Read the debugging instructions for further details.
Do not use the following tool upon your database while Freenet is running!
Backup your database before using it!
# Validate semantic integrity of the database and recompute all score values (= "computed trust" in the UI). # This currently is mostly of diagnostic character for development purposes, it is unlikely to fix your # database if WoT does not start, sorry. tools/wotutil -testAndRepair DATABASE_FILE # Execute a "Freenet Client Protocol" call upon the database. # FCP is the protocol which applications built upon WoT use to access its API. # For available functions see src/plugins/WebOfTrust/ui/fcp/FCPInterface.java tools/wotutil -fcp DATABASE_FILE Message=WOT_FCP_CALL key1=value1 key2=value2 ...