OpenTTT LangChain Integration
Problem: DEX swaps get front-run. Your agent can't prove transaction ordering.
Solution: verify_proof_of_time generates cryptographic timestamps from 3+ atomic clock sources (NIST, Google, Apple) and verifies swap ordering on-chain.
Result: Your agent detects MEV attacks in one tool call.
Installation
npm install openttt @langchain/core zod
Quick Start
import { VerifyProofOfTimeTool } from "openttt/integrations/langchain";
import { ChatOpenAI } from "@langchain/openai";
import { createToolCallingAgent, AgentExecutor } from "langchain/agents";
import { ChatPromptTemplate } from "@langchain/core/prompts";
// 1. Create the tool
const potTool = new VerifyProofOfTimeTool();
// 2. Wire into your agent
const llm = new ChatOpenAI({ model: "gpt-4o" });
const prompt = ChatPromptTemplate.fromMessages([
["system", "You are a DeFi security agent. Use verify_proof_of_time to check transaction ordering."],
["human", "{input}"],
["placeholder", "{agent_scratchpad}"],
]);
const agent = createToolCallingAgent({ llm, tools: [potTool], prompt });
const executor = new AgentExecutor({ agent, tools: [potTool] });
// 3. Run
const result = await executor.invoke({
input: "Verify ordering for tx 0xabc123... on Base (chain 8453) pool 0xdef456...",
});
Tool Details
| Field | Value |
|---|---|
| Name | verify_proof_of_time |
| Inputs | txHash (string), chainId (number), poolAddress (string) |
| Output | JSON with verified, proof (timestamp, confidence, sources), sourceReadings |
Configuration
// Custom time sources
const tool = new VerifyProofOfTimeTool({
timeSources: ["nist", "google", "cloudflare"],
});
What the Proof Contains
{
"verified": true,
"proof": {
"timestamp": "1742000000000000000",
"uncertainty_ms": 2.5,
"sources": 3,
"stratum": 1,
"confidence": 1.0,
"nonce": "a1b2c3...",
"expiresAt": "1742000060000",
"onChainHash": "0x..."
},
"sourceReadings": [
{ "source": "nist", "timestamp": "...", "uncertainty_ms": 1.2 },
{ "source": "apple", "timestamp": "...", "uncertainty_ms": 3.1 },
{ "source": "google", "timestamp": "...", "uncertainty_ms": 2.0 }
]
}
How It Works
- Queries 3+ independent atomic clock sources simultaneously
- Synthesizes a median timestamp with confidence score
- Self-verifies cross-source consistency (stratum-adaptive tolerance)
- Applies nonce + expiration for replay protection
- Computes
keccak256hash for optional on-chain contract verification
Learn More
Metadata
Release files for langchain-openttt 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_openttt-0.3.0.tar.gz | 7.1 kB | Without provenance | Details for langchain_openttt-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_openttt-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_openttt-0.3.0-py3-none-any.whl |
Total release size: 15.3 kB
Release files / langchain_openttt-0.3.0.tar.gz
| Download URL | langchain_openttt-0.3.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae9de954ea00fac531d530330b33927740e63c812b7a25a63d33018543b6e3b9
|
|
BLAKE2b-256 checksum How to use checksums |
683591611eebfa0524f1c7b52b6d54a95b3aec7ac5cdb7426e00d569858a95c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / langchain_openttt-0.3.0-py3-none-any.whl
| Download URL | langchain_openttt-0.3.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8cb24d45482e73ebccc102a8048f578c66a8ac8d38e5538ffa0d13b31672632
|
|
BLAKE2b-256 checksum How to use checksums |
f905ad14efacabeb7d3f7810c6287b9f4cc71666419387195f913ac8f7c99b25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for langchain-openttt 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.