dchat
/install dchat
dchat — Decentralized P2P Messaging Skill
You have access to dchat, a decentralized peer-to-peer messaging system over the NKN relay network. Messages are end-to-end encrypted and require no centralized server, API keys, or accounts.
Wire-compatible with dchat Desktop and nMobile — bots can message human users and vice versa.
Commands
Run these commands using your shell execution tool. The dchat wrapper is in the skill directory at {baseDir}.
Identity (no network needed)
{baseDir}/dchat init # Generate bot identity (first time, auto-run at install)
{baseDir}/dchat address # Print bot's NKN address
Contacts (no network needed)
{baseDir}/dchat contacts add \x3Caddress> \x3Calias> # Add a contact with alias
{baseDir}/dchat contacts remove \x3Calias> # Remove a contact
{baseDir}/dchat contacts list # List all contacts
Once a contact is added, use the alias instead of the 64-char address in send, history, and other commands.
Messaging (connects to NKN, ~5-8s per send)
{baseDir}/dchat send \x3Caddress> Hello world! # Send text message
{baseDir}/dchat send-image \x3Caddress> ./photo.jpg # Send image (encrypted, via IPFS)
{baseDir}/dchat send-audio \x3Caddress> ./voice.aac # Send audio file
{baseDir}/dchat send-file \x3Caddress> ./report.pdf # Send any file (encrypted, via IPFS)
Output on success: Connecting... then Sent: \x3Cmessage-id>.
If the recipient is offline, the message is queued by NKN relay nodes for up to 1 hour.
Receiving
{baseDir}/dchat listen # Listen for messages (daemon, Ctrl+C to stop)
Output format:
[HH:MM:SS] \x3Csender-prefix>...: \x3Ctext>
[HH:MM:SS] \x3Csender-prefix>...: [image] /path/to/downloaded.jpg
[HH:MM:SS] \x3Csender-prefix>...: [audio] /path/to/downloaded.aac
[HH:MM:SS] \x3Csender-prefix>...: [file: report.pdf] /path/to/downloaded.pdf
History (no network needed)
{baseDir}/dchat history \x3Caddress> # Show last 50 messages with peer
{baseDir}/dchat history \x3Caddress> 100 # Show last 100 messages
Interactive REPL
{baseDir}/dchat interactive # Full interactive mode with /send /file etc.
Options
{baseDir}/dchat --seed \x3C64-char-hex> address # Use specific seed
{baseDir}/dchat --data-dir /custom/path init # Custom data directory
When to Use
Use this skill when the user or another agent wants to:
- Send or receive messages to/from another bot or NKN user
- Transfer files, images, or audio to a peer
- Set up a listening bot that reacts to incoming messages
- Check message history with a peer
- Get the bot's NKN address to share with others
Key Concepts
- NKN Address: 64-char hex public key. Each bot gets a unique address derived from its seed. Can be derived offline.
- Seed: 64-char hex Ed25519 private key. Auto-generated at install, saved encrypted to
~/.dchat-clawhub/identity.enc. - Media: Encrypted with AES-128-GCM, uploaded to IPFS, key sent over NKN. Recipients auto-download and decrypt.
- History: All messages stored in SQLite at
~/.dchat-clawhub/messages.db. - Receipts: Delivery and read receipts are automatic.
Security
- AES-128-GCM encryption for all media before IPFS upload
- Identity encrypted at rest (AES-256-GCM + PBKDF2, 100K iterations). Encryption key (.passkey) stored in separate OS config directory (
/.config/dchat-clawhub/) from the ciphertext (/.dchat-clawhub/), both with file permissions 0600 - No centralized server — messages travel through NKN relay nodes
- SSRF protection: ad-hoc IPFS gateways from incoming messages are DNS-resolved and all IPs verified as public (rejects RFC 1918, loopback, link-local, ULA, IPv4-mapped IPv6)
Network & Storage
- Connects to NKN seed RPC servers (seed.nkn.org) for P2P relay
- Uploads/downloads encrypted media via public IPFS gateways (ipfs.io, dweb.link)
- Stores messages in local SQLite database (~/.dchat-clawhub/messages.db)
- Caches downloaded media in ~/.dchat-clawhub/media-cache/
- Install pulls 3 production npm packages: nkn-sdk, better-sqlite3, form-data
Limitations
- Each send takes ~5-8 seconds (NKN connect + 3s stabilization + relay dispatch)
- Offline messages held by NKN relay nodes for up to 1 hour
- Max file size: 100 MB
- Requires internet access to reach NKN seed nodes
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install dchat - After installation, invoke the skill by name or use
/dchat - Provide required inputs per the skill's parameter spec and get structured output
What is dchat?
Decentralized P2P bot-to-bot messaging over NKN. Send and receive text, images, audio, and files without any centralized server. Private, encrypted, serverless. It is an AI Agent Skill for Claude Code / OpenClaw, with 272 downloads so far.
How do I install dchat?
Run "/install dchat" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is dchat free?
Yes, dchat is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does dchat support?
dchat is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created dchat?
It is built and maintained by Zheng "Bruce" Li (@zbruceli); the current version is v0.4.0.