Skip to content

Commit bf965c5

Browse files
committed
thesis
1 parent 2bd9af4 commit bf965c5

File tree

14 files changed

+131
-45
lines changed

14 files changed

+131
-45
lines changed

README.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ console.log(info);
214214

215215
> Learn more about [`lookup`](/packages/lookup/) library
216216
217-
## Development
217+
## Quickstart
218218

219219
```bash
220220
# clone the repository
@@ -227,9 +227,6 @@ yarn install
227227
# build
228228
yarn build
229229

230-
# run sample agents from the examples directory
231-
yarn examples
232-
233230
# or run a specific example
234231
yarn examples gm
235232
```
@@ -240,7 +237,3 @@ Use a `.env` file for your environment variables:
240237
ENCRYPTION_KEY= # the private key of the wallet
241238
FIXED_KEY= # a second encryption key for encryption (can be random)
242239
```
243-
244-
## Contribute
245-
246-
We welcome contributions! Check out the [contributing](CONTRIBUTING.md) file for more information on how to get started.

THESIS.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Why organizations should consider E2EE when sharing sensitive data
2+
3+
## Abstract
4+
5+
Artificial intelligence (AI) is driving the transition to **Web4**, a “web of agents” in which specialized AI programs autonomously connect and collaborate in real time. The greatest opportunities for AI solutions increasingly stem not from public web data—already widely available—but from **private, high-value datasets** that hold sensitive or commercially valuable information.
6+
7+
However, sharing this proprietary data securely over open networks requires a robust approach to encryption and identity management. In these emerging **multi-agent systems**, an **Agent Computer Interface (ACI)** allows AI agents to interact with data sources and tools with minimal human supervision. At the same time, **end-to-end encryption (E2EE)** becomes critical for safeguarding these valuable datasets and ensuring compliance with sector-specific regulations in finance, healthcare, government, and beyond. This paper explores how open protocols like **XMTP** address these challenges by offering strong E2EE, metadata minimization, and decentralized trust guarantees—essential features for the growing **AI private data market**.
8+
9+
## Multi-agent systems
10+
11+
![1](/media/1.webp)
12+
13+
Under **Web4**, autonomous agents don’t rely exclusively on publicly indexed content. Instead, they tap into **restricted datasets** licensed by enterprises, governments, and other institutions. This new paradigm unlocks significant value and innovation but demands robust controls for:
14+
15+
1. **Authentication** – Ensuring only authorized AI agents can access the private data.
16+
2. **Encryption** – Guaranteeing end-to-end confidentiality, from data origin to the agent’s environment.
17+
3. **Compliance** – Enabling secure audit trails and cryptographic proofs while shielding message content from unauthorized eyes.
18+
19+
Increasingly, organizations sell or lease access to real-time financial data, anonymized healthcare records, or specialized databases. These shared resources form a multi-agent ecosystem powered by advanced compute and specialized data—making airtight security paramount.
20+
21+
## MCP from Anthropic
22+
23+
![1](/media/2.webp)
24+
25+
MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various peripherals and accessories, MCP provides a standardized way to connect AI models to different data sources and tools.
26+
27+
### [\*\*](https://modelcontextprotocol.io/introduction#why-mcp)Why MCP?\*\*
28+
29+
MCP helps you build agents and complex workflows on top of LLMs. LLMs frequently need to integrate with data and tools, and MCP provides:
30+
31+
- A growing list of pre-built integrations that your LLM can directly plug into
32+
- The flexibility to switch between LLM providers and vendors
33+
- Best practices for securing your data within your infrastructure
34+
35+
### [\*\*](https://modelcontextprotocol.io/introduction#general-architecture)General architecture\*\*
36+
37+
At its core, MCP follows a client-server architecture where a host application can connect to multiple servers:
38+
39+
- **MCP Hosts**: Programs like Claude Desktop, IDEs, or AI tools that want to access data through MCP
40+
- **MCP Clients**: Protocol clients that maintain 1:1 connections with servers
41+
- **MCP Servers**: Lightweight programs that each expose specific capabilities through the standardized Model Context Protocol
42+
- **Local Data Sources**: Your computer’s files, databases, and services that MCP servers can securely access
43+
- **Remote Services**: External systems available over the internet (e.g., through APIs) that MCP servers can connect to
44+
45+
## LLMs private data
46+
47+
While public web data is abundant and broadly indexed, **high-value, private datasets** represent the next frontier for AI innovation—whether in law, finance, healthcare, or government. AI systems that harness these specialized resources can deliver unprecedented capabilities. For instance:
48+
49+
- **AI-driven legal research** – Quickly processing case law, contracts, or patent filings from private databases.
50+
- **Financial intelligence** – Analyzing large volumes of real-time trading or market data under strict privacy regulations.
51+
- **Healthcare insights** – Mining patient records or medical imaging data (with protected health information) to advance research.
52+
53+
E2EE at the query and response level ensures compliance with data privacy mandates—especially important in heavily regulated sectors where server-side decryption is disallowed.
54+
55+
### Example use case: Legal AI with proprietary datasets
56+
57+
![1](/media/3.webp)
58+
59+
Platforms like **Harvey**—a legal AI system—illustrate how specialized data feeds power next-generation capabilities. Governments, financial institutions, and corporations maintain proprietary records and reference materials, typically stored in vector databases (e.g., Pinecone, Activeloop) and accessed through retrieval-augmented generation (RAG). By sending encrypted queries and receiving encrypted results, legal AI platforms can efficiently answer complex questions without compromising confidentiality.
60+
61+
## Conclusion
62+
63+
As we enter the **web of agents (Web4)** and an **AI private data market** defined by proprietary intelligence, secure messaging and data exchange are crucial for unlocking the true potential of AI. **XMTP** offers a unique blend of benefits:
64+
65+
### **Why TLS Isn’t Enough**
66+
67+
- **Transit-only encryption** – TLS protects data in transit, but servers typically decrypt data on their end. Many legal and financial regulations forbid server-side data exposure.
68+
- **Operational overhead** – Juggling multiple encrypted messaging tools (email, secure APIs, etc.) is cumbersome for enterprise teams and difficult to scale
69+
- **Group collaboration** – The Messaging Layer Security (MLS) standard, which XMTP builds upon, supports secure group messaging among multiple agents and humans
70+
71+
### Why XMTP for interoperable E2EE?
72+
73+
![1](/media/4.webp)
74+
75+
- **True end-to-end encryption (E2EE):** Unlike TLS, which encrypts only in transit and typically decrypts on the server side, XMTP can preserve confidentiality from the originating client all the way to the intended recipients—ideal for sensitive data in finance, healthcare, legal services, and more
76+
- **Metadata protection:** XMTP’s design obscures who sent or received a message, a crucial feature for high-privacy or regulated scenarios.
77+
- **Group and multi-agent support:** Built atop standards like the Messaging Layer Security (MLS), XMTP supports secure group communication among many agents (and humans), which is central to multi-agent workflows.
78+
- **Interoperable ecosystem:** As an open protocol, XMTP plugs into existing AI tools or enterprise environments with minimal friction, providing flexibility for organizations to combine secure E2EE with advanced multi-agent services.
79+
80+
By combining standardized protocols like **MCP** with next-generation messaging layers such as **XMTP**, AI-driven organizations can confidently harness private data while meeting critical security and compliance requirements.

examples/README.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,33 @@ Here, you will find various examples and tutorials to help you get started with
99
- [railway](/examples/railway/): A tutorial on how to deploy your agent on Railway.
1010
- [replit](/examples/replit/): A tutorial on how to deploy your agent on Replit.
1111

12-
### Contribute
12+
## Development
1313

14-
Learn how to [contribute](/CONTRIBUTING.md) to the examples directory.
14+
```bash
15+
# clone the repository
16+
git clone https://github.com/ephemeraHQ/xmtp-agents/
17+
cd xmtp-agents
18+
19+
# install dependencies
20+
yarn install
21+
22+
# build
23+
yarn build
24+
25+
# run sample agents from the examples directory
26+
yarn examples
27+
28+
# or run a specific example
29+
yarn examples gm
30+
```
31+
32+
Use a `.env` file for your environment variables:
33+
34+
```bash
35+
ENCRYPTION_KEY= # the private key of the wallet
36+
FIXED_KEY= # a second encryption key for encryption (can be random)
37+
```
38+
39+
## Contribute
40+
41+
We welcome contributions! Check out the [contributing](CONTRIBUTING.md) file for more information on how to get started.

media/1.webp

40 KB
Binary file not shown.

media/2.webp

50.5 KB
Binary file not shown.

media/3.webp

41.7 KB
Binary file not shown.

media/4.webp

19.1 KB
Binary file not shown.

packages/agent-starter/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"build:watch": "yarn build -w",
2222
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
2323
"publish": "npm publish",
24-
"test": "yarn build && vitest"
24+
"test": "vitest"
2525
},
2626
"dependencies": {
2727
"@changesets/changelog-git": "^0.2.0",

packages/agent-starter/tests/Encryption.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ describe("Encryption Tests", () => {
99
const agentB = await xmtpClient({
1010
name: "alice1",
1111
});
12-
console.log("agentA", agentA.address);
13-
console.log("agentB", agentB.address);
12+
// console.log("agentA", agentA.address);
13+
// console.log("agentB", agentB.address);
1414
const message = "Hello, World!";
1515
const { nonce, ciphertext } = await agentA.encrypt(
1616
message,
1717
agentB.address as string,
1818
);
19-
console.log("message", message);
20-
console.log("nonce", nonce);
21-
console.log("ciphertext", ciphertext);
19+
// console.log("message", message);
20+
// console.log("nonce", nonce);
21+
// console.log("ciphertext", ciphertext);
2222

2323
await new Promise((resolve) => setTimeout(resolve, 2000));
2424
const decryptedMessage = await agentB.decrypt(
2525
nonce,
2626
ciphertext,
2727
agentA.address as string,
2828
);
29-
console.log("decryptedMessage", decryptedMessage);
29+
//console.log("decryptedMessage", decryptedMessage);
3030

3131
expect(decryptedMessage).toBe(message);
3232
}, 1000000);

packages/lookup/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ yarn add @xmtp/lookup
5757
To resolve an ENS name to an Ethereum address:
5858

5959
```tsx
60-
import { lookup } from "@your-package/lookup";
60+
import { lookup } from "@xmtp/lookup";
6161

6262
async function resolveENS() {
6363
const data = await lookup("vitalik.eth");

packages/lookup/package.json

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@xmtp/lookup",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"license": "MIT",
55
"type": "module",
66
"exports": {
@@ -21,29 +21,24 @@
2121
"build:watch": "yarn build -w",
2222
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
2323
"publish": "npm publish",
24-
"test": "yarn build && vitest",
25-
"test:client": "vitest run tests/client",
26-
"test:e2e": "vitest run tests/encryption"
24+
"test": "vitest"
2725
},
2826
"dependencies": {
29-
"@changesets/changelog-git": "^0.2.0",
30-
"@changesets/cli": "^2.27.5",
31-
"dotenv": "^16.4.5",
32-
"jsdom": "^26.0.0",
33-
"typescript": "^5.4.5",
3427
"viem": "^2.16.3"
3528
},
3629
"devDependencies": {
30+
"@changesets/changelog-git": "^0.2.0",
31+
"@changesets/cli": "^2.27.5",
3732
"@rollup/plugin-typescript": "^11.1.6",
38-
"@types/jsdom": "^21.1.7",
3933
"@types/node": "^20.14.2",
4034
"@vitest/coverage-v8": "^2.1.4",
41-
"node-fetch": "^3.3.2",
35+
"dotenv": "^16.4.5",
4236
"prettier": "^3.3.1",
4337
"rollup": "^4.18.0",
4438
"rollup-plugin-dts": "^6.1.1",
4539
"ts-node": "^10.9.2",
4640
"turbo": "^2.2.3",
41+
"typescript": "^5.4.5",
4742
"vitest": "^2.1.4"
4843
},
4944
"packageManager": "yarn@4.5.1",

packages/lookup/rollup.config.js

-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ import { defineConfig } from "rollup";
33
import { dts } from "rollup-plugin-dts";
44

55
const external = [
6-
"jsdom",
76
"cross-fetch",
8-
"node-fetch",
97
"dns",
108
"path",
119
"viem",

packages/lookup/src/index.ts

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { isAddress } from "viem";
2-
import { JSDOM } from "jsdom";
32
import dns from "dns";
43
export const converseEndpointURL = "https://converse.xyz/profile/";
54

@@ -262,19 +261,14 @@ export async function getEvmAddressFromHeaderTag(
262261
try {
263262
const response = await fetch(website);
264263
const html = await response.text();
265-
const dom = new JSDOM(html);
266-
const metaTags = dom.window.document.getElementsByTagName("meta");
267-
for (let i = 0; i < metaTags.length; i++) {
268-
const metaTag = metaTags[i];
269-
const name = metaTag.getAttribute("name");
270-
const content = metaTag.getAttribute("content");
271264

272-
if (name === "xmtp" && content) {
273-
const match = content.match(/^0x[a-fA-F0-9]+$/);
274-
if (match) {
275-
return match[0];
276-
}
277-
}
265+
// Use regex to find the meta tag with name="xmtp"
266+
const metaTagRegex =
267+
/<meta\s+name=["']xmtp["']\s+content=["'](0x[a-fA-F0-9]+)["']/i;
268+
const match = html.match(metaTagRegex);
269+
270+
if (match && match[1]) {
271+
return match[1];
278272
}
279273
} catch (error) {
280274
console.error("Failed to fetch or parse the website:", error);

packages/lookup/tests/Lookup.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ describe("Client Private Key Configuration Tests", () => {
2121

2222
//Converse username lookup
2323
data = await lookup("@fabri");
24-
console.log(data);
2524
expect(data?.address?.toLowerCase()).toBe(
2625
"0x93e2fc3e99dfb1238eb9e0ef2580efc5809c7204".toLowerCase(),
2726
);

0 commit comments

Comments
 (0)