Dezentralisierung¶
🌐 Warum Dezentralisierung?¶
CommunicationFinder verfolgt eine dezentrale Architektur, um folgende Ziele zu erreichen:
- Privacy: Keine zentrale Instanz kann deine Daten einsehen
- Censorship Resistance: Niemand kann die Plattform abschalten
- Vendor-Lock-Free: Keine Abhängigkeit von einzelnen Anbietern
- User Ownership: Du besitzt deine Daten, nicht ein Unternehmen
🏗️ Dezentrale Komponenten¶
📦 IPFS: Verteilte Speicherung¶
Was ist IPFS?¶
InterPlanetary File System ist ein Peer-to-Peer-Netzwerk zum Speichern und Teilen von Daten.
Kernkonzepte: - Content Addressing: Dateien werden durch ihren Inhalt identifiziert (CID) - Deduplizierung: Identische Inhalte werden nur einmal gespeichert - Verteilung: Daten werden über viele Nodes repliziert
Integration in CommunicationFinder¶
class IPFSStorage {
constructor() {
// Multi-Gateway für Redundanz
this.gateways = [
'https://ipfs.io/ipfs/',
'https://cloudflare-ipfs.com/ipfs/',
'https://dweb.link/ipfs/',
'https://gateway.pinata.cloud/ipfs/'
];
}
async uploadSettings(settings) {
// 1. Verschlüsseln (optional)
const encrypted = await this.encrypt(settings);
// 2. Zu IPFS hochladen
const formData = new FormData();
formData.append('file', new Blob([JSON.stringify(encrypted)]));
const response = await fetch('https://api.pinata.cloud/pinning/pinFileToIPFS', {
method: 'POST',
headers: {
'pinata_api_key': 'YOUR_API_KEY',
'pinata_secret_api_key': 'YOUR_SECRET'
},
body: formData
});
const { IpfsHash } = await response.json();
// 3. CID zurückgeben
return IpfsHash; // z.B. QmXxx...
}
async downloadSettings(cid) {
// Versuche mehrere Gateways
for (const gateway of this.gateways) {
try {
const response = await fetch(gateway + cid);
if (response.ok) {
const data = await response.json();
return this.decrypt(data);
}
} catch (err) {
console.warn(`Gateway ${gateway} failed, trying next...`);
}
}
throw new Error('All IPFS gateways failed');
}
}
Vorteile¶
Permanenz
Einmal hochgeladene Settings bleiben für immer verfügbar (solange mindestens 1 Node sie hostet)
Integrität
CIDs sind kryptographische Hashes – manipulierte Daten haben andere CIDs
Kosteneffizienz
Identische Settings werden automatisch dedupliziert
🔐 DIDs: Selbstverwaltete Identität¶
Was sind DIDs?¶
Decentralized Identifiers sind ein W3C-Standard für Identitäten ohne zentrale Autorität.
Format:
did:ethr:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb
did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w
did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
Integration¶
class DIDManager {
async createDID() {
// Ethereum-basierte DID erstellen
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
const address = await signer.getAddress();
return `did:ethr:${address}`;
}
async signSettings(settings, did) {
// Settings mit privatem Schlüssel signieren
const message = JSON.stringify(settings);
const signature = await window.ethereum.request({
method: 'personal_sign',
params: [message, did.split(':')[2]]
});
return {
settings,
signature,
did,
timestamp: Date.now()
};
}
async verifySignature(signedData) {
const { settings, signature, did } = signedData;
const message = JSON.stringify(settings);
const address = did.split(':')[2];
const recovered = ethers.utils.verifyMessage(message, signature);
return recovered.toLowerCase() === address.toLowerCase();
}
}
Use Cases¶
- Settings-Ownership: Beweise, dass Settings von dir stammen
- Vertrauensnetzwerk: Importiere nur Settings von verifizierten DIDs
- Reputation: DID-basierte Bewertung von Settings-Qualität
🔄 Gun.js: P2P-Synchronisation¶
Was ist Gun.js?¶
Ein dezentrales, offline-first Graph-Datenbank-System mit Echtzei-Synchronisation.
Architektur¶
Integration¶
// Gun initialisieren mit mehreren Peers
const gun = Gun({
peers: [
'https://relay1.communicationfinder.org/gun',
'https://relay2.communicationfinder.org/gun',
'https://relay3.communicationfinder.org/gun'
],
localStorage: true, // Offline-First
radisk: true // Persistent Storage
});
// Settings publizieren
const user = gun.user();
await user.auth('username', 'password');
user.get('settings').get('current').put({
data: encryptedSettings,
timestamp: Date.now(),
version: '2.0'
});
// Settings von anderen abonnieren
gun.get('communicationfinder')
.get('public-settings')
.map()
.on((settings, key) => {
if (settings && settings.timestamp > lastSyncTime) {
mergeRemoteSettings(settings);
}
});
Konflikt-Auflösung¶
Gun nutzt CRDT (Conflict-free Replicated Data Types):
// Automatische Merge-Strategie
gun.get('settings').get('weights').get('whatsapp').put(85);
// Andere Node setzt gleichzeitig:
gun.get('settings').get('weights').get('whatsapp').put(90);
// Gun merged automatisch (Last-Write-Wins)
// Ergebnis: 90 (neuester Timestamp gewinnt)
📜 Arweave: Permanente Speicherung¶
Was ist Arweave?¶
Eine Blockchain für permanente Datenspeicherung – einmalige Zahlung, ewige Verfügbarkeit.
Integration¶
class ArweaveStorage {
constructor() {
this.arweave = Arweave.init({
host: 'arweave.net',
port: 443,
protocol: 'https'
});
}
async uploadPermanent(settings) {
const wallet = await this.loadWallet();
const transaction = await this.arweave.createTransaction({
data: JSON.stringify(settings)
}, wallet);
// Tags für Searchability
transaction.addTag('App-Name', 'CommunicationFinder');
transaction.addTag('Content-Type', 'application/json');
transaction.addTag('Version', '2.0');
await this.arweave.transactions.sign(transaction, wallet);
await this.arweave.transactions.post(transaction);
return transaction.id; // Permanent Transaction ID
}
async downloadPermanent(txId) {
const data = await this.arweave.transactions.getData(txId, {
decode: true,
string: true
});
return JSON.parse(data);
}
}
Kostenmodell¶
- Einmalige Zahlung: ~$0.01 per MB (Stand 2025)
- Keine monatlichen Gebühren
- Garantie: 200+ Jahre Speicherung
🌍 ENS & Unstoppable Domains¶
Menschenlesbare Adressen¶
Statt ipfs://QmXxx... → communicationfinder.eth
// ENS Resolution
const provider = new ethers.providers.Web3Provider(window.ethereum);
const resolver = await provider.getResolver('alice.eth');
const contentHash = await resolver.getContentHash();
// contentHash = ipfs://QmYourSettingsCID
const ipfsCID = contentHash.replace('ipfs://', '');
const settings = await ipfsStorage.downloadSettings(ipfsCID);
Use Case¶
Alice teilt: "Importiere meine Settings von alice.eth"
↓
ENS löst auf: ipfs://QmABC123...
↓
IPFS lädt: alice-settings.json
↓
Matrix importiert Settings
🔧 Cloudflare Workers: Edge Computing¶
Warum Edge Computing?¶
- Niedrige Latenz: Code läuft nah beim User
- Kostenlos bis 100k Requests/Tag
- Keine Server-Verwaltung
Beispiel: Settings-Proxy¶
// Cloudflare Worker
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const url = new URL(request.url);
const cid = url.pathname.split('/')[2];
// Versuche IPFS-Gateways
const gateways = [
'https://ipfs.io/ipfs/',
'https://cloudflare-ipfs.com/ipfs/'
];
for (const gateway of gateways) {
try {
const response = await fetch(gateway + cid, {
cf: { cacheEverything: true } // Cache am Edge
});
if (response.ok) {
return response;
}
} catch {}
}
return new Response('Not found', { status: 404 });
}
📊 Dezentralisierungs-Scorecard¶
| Komponente | Zentralisiert | Dezentral | Status |
|---|---|---|---|
| Hosting | GitHub Pages | IPFS Gateway | ✅ Phase 3 |
| Storage | LocalStorage | IPFS + Arweave | ✅ Phase 3 |
| Identity | Email/Password | DIDs | 🔄 Phase 3 |
| Sync | REST API | Gun.js P2P | 🔄 Phase 3 |
| Compute | Server | Edge + WASM | ✅ Jetzt |
| Domain | DNS | ENS | 🔮 Phase 4 |
Dezentralisierungs-Score: 83% (Ziel: 95%)
🚀 Migrations-Roadmap¶
Phase 1: Statisch (Q4 2025) ✅¶
- Offline HTML-Tools
- LocalStorage
- Keine Server
Phase 2: IPFS (Q1 2026)¶
// Settings zu IPFS hochladen
const cid = await ipfs.upload(settings);
console.log(`Deine Settings: ipfs://${cid}`);
// QR-Code generieren zum Teilen
const qr = generateQR(`ipfs://${cid}`);
Phase 3: DIDs (Q2 2026)¶
// DID erstellen
const did = await createDID();
// Settings mit DID signieren
const signed = await did.sign(settings);
// In IPFS publizieren
const cid = await ipfs.upload(signed);
Phase 4: P2P (Q3 2026)¶
// Gun.js Echtzeit-Sync
gun.get('communicationfinder')
.get('team')
.get('alice.eth')
.on(settings => {
console.log('Alice hat ihre Settings aktualisiert!');
mergeSettings(settings);
});
🎯 Vorteile für Nutzer¶
1. Kein Vendor-Lock¶
Google Drive ist down? → Settings auf IPFS weiter verfügbar
GitHub löscht Repo? → Code auf Arweave permanent
Slack API ändert sich? → Deine Settings unabhängig
2. Privacy¶
3. Kosten¶
Vision
"Keine einzelne Entität sollte Kontrolle über deine Kommunikations-Entscheidungen haben – weder technisch noch rechtlich."