xmtp
Safe, ergonomic Rust SDK for the XMTP messaging protocol.
Wraps the xmtp-sys FFI bindings with idiomatic Rust types, providing a high-level Client → Conversation → Message API for E2E encrypted DMs, groups, content types, identity management, ENS resolution, and real-time streaming.
Linking
The underlying xmtp-sys crate links a pre-built Rust staticlib that bundles its own
copy of std. This causes duplicate symbol errors (e.g. rust_eh_personality) when
building a Rust binary. Add one of the following workarounds to your binary crate:
Option A — build.rs:
Option B — .cargo/config.toml:
[]
= ["-C", "link-arg=-Wl,--allow-multiple-definition"]
[]
= ["-C", "link-arg=/FORCE:MULTIPLE"]
[]
= ["-C", "link-arg=-Wl,-multiply_defined,suppress"]
Quick Start
use ;
// Create a client and register identity.
let signer = random?;
let client = builder
.env
.db_path
.build?;
// Send a DM.
let conv = client.dm?;
conv.send_text?;
// Stream messages in real time.
let _handle = stream_all_messages?;
Feature Flags
| Feature | Default | Description |
|---|---|---|
content |
✅ | Content type codecs (text, reactions, replies, attachments, read receipts) |
alloy |
Local private key signer via alloy-signer-local |
|
ledger |
Ledger hardware wallet signer via alloy-signer-ledger |
|
ens |
ENS name resolution via alloy-ens + alloy-provider |
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.