33 releases (6 breaking)
Uses new Rust 2024
| new 0.7.6 | Feb 26, 2026 |
|---|---|
| 0.7.5 | Feb 26, 2026 |
| 0.6.1 | Feb 25, 2026 |
| 0.5.3 | Feb 25, 2026 |
| 0.1.9 | Feb 23, 2026 |
#1192 in Network programming
Used in xmtp-cli
285KB
6K
SLoC
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.
Quick Start
use xmtp::{Client, Env, AlloySigner};
// Create a client and register identity.
let signer = AlloySigner::random()?;
let client = Client::builder()
.env(Env::Dev)
.db_path("./alice.db3")
.build(&signer)?;
// Send a DM.
let conv = client.dm(&"0xBob...".into())?;
conv.send_text("hello from Rust")?;
// Stream messages in real time.
let _handle = xmtp::stream::stream_all_messages(
&client, None, &[], |msg_id, conv_id| {
println!("new message {msg_id} in {conv_id}");
},
)?;
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.
Dependencies
~2–25MB
~327K SLoC