How yayoucef/trust-model works
The repository combines an off-chain Python anomaly-detection experiment with a JavaScript Web3 interface and a documented blockchain simulation workflow. The Python entry point generates datasets, runs three detectors, evaluates their predictions, writes split CSVs, and plots F1 scores. The README also describes peer trust updates and score retrieval through a local blockchain. Some documented blockchain capabilities, including contract deployment and on-chain trust handling, have no implementation source in the tree; those connections are shown only where the README supports them.
Main entry points: main.py Experiment runner · web3.js Web3 facade · simulate.js Peer simulator · index.js Contract interface
Components 15
Off-chain analysis
- Experiment runner
main.py - Synthetic data
data/synthetic/synthetic_data_generator.py - Isolation Forest
models/isolation_forest.py - Local Outlier Factor
models/lof.py - Autoencoder
models/autoencoder.py - Split datasets
data/outputs
Evaluation
- Prediction metrics
evaluation/metrics.py - Result plots
evaluation/plots.py
Blockchain interface
- Peer simulator
simulate.js - Web3 facade
web3/web3.js - HTTP provider
web3/providers/httpProvider.js - Contract interface
web3/eth/index.js - Trust contract ABI
web3/packages/TrustABI.json
Other components
- Researcher
- Local blockchain RPC
Connections 14
- Researcher → Experiment runner: runs
README.md - Experiment runner → Synthetic data: generates data
main.py - Experiment runner → Isolation Forest: runs detector
main.py - Experiment runner → Local Outlier Factor: runs detector
main.py - Experiment runner → Autoencoder: runs detector
main.py - Experiment runner → Prediction metrics: evaluates predictions
main.py - Experiment runner → Split datasets: writes CSVs
main.py - Experiment runner → Result plots: plots results
main.py - Researcher → Peer simulator: runs simulation
README.md - Web3 facade → HTTP provider: creates provider
web3/web3.js - Web3 facade → Contract interface: creates interface
web3/web3.js - Contract interface → Trust contract ABI: loads ABI
web3/eth/index.js - Web3 facade → Local blockchain RPC: connects via
- Peer simulator → Local blockchain RPC: uses blockchain