Seim0 is a revolutionary memory layer that stores AI memories directly on the Sei blockchain, ensuring decentralized, immutable, and globally accessible memory storage. Built on top of Sei's high-performance EVM-compatible blockchain, Seim0 combines the power of decentralized storage with IPFS for content and smart contracts for indexing.
- π Blockchain-Native: Memories stored directly on Sei blockchain with immutable transaction hashes
- π‘ IPFS Integration: Content stored on IPFS for decentralized, censorship-resistant access
- β‘ High Performance: Built on Sei's optimized blockchain for fast transaction processing
- π Smart Contract Indexing: Efficient memory discovery through on-chain smart contracts
- π° Cost Effective: Leverages Sei's low transaction costs for affordable memory operations
- π‘οΈ Decentralized: No central authority - your memories are truly yours
- π Cryptographic Security: All operations secured by blockchain cryptography
npm install seim0Create a .env file in your project root:
PINATA_API_KEY=your_pinata_api_key
PINATA_SECRET_KEY=your_pinata_secret_key
# Required for on-chain transactions
PRIVATE_KEY=your_wallet_private_key
GOOGLE_API_KEY="your_gemini_or_openai_api_key"import { MemoryClient } from "seim0";
import { ethers } from "ethers";
const provider = new ethers.providers.JsonRpcProvider(
"https://evm-rpc-testnet.sei-apis.com",
);
const signer = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const memory = new MemoryClient({
network: "testnet",
signer: signer,
llm: {
provider: "google",
config: {
apiKey: process.env.GOOGLE_API_KEY,
model: "gemini-2.0-flash",
},
},
embedder: {
provider: "google",
config: {
apiKey: process.env.GOOGLE_API_KEY,
model: "text-embedding-004",
},
},
});// Add a memory to the blockchain
const conversation = [
{
role: "user" as const,
content:
"Hi, I'm David and I work as a blockchain developer at Ethereum Foundation. I specialize in smart contract security and love DeFi protocols.",
},
{
role: "assistant" as const,
content:
"Nice to meet you David! Smart contract security is crucial in DeFi. What are your favorite protocols to work with?",
},
{
role: "user" as const,
content:
"I really enjoy working with Uniswap and Compound. I also contribute to OpenZeppelin's security audits on weekends.",
},
];
const addResult = await memory.add(conversation, {
user_id: "david_blockchain_dev",
agent_id: "sei-assistant",
run_id: "onboarding-001",
metadata: { topic: "intro", project: "sei_memory_test" },
});
console.log("Memory stored on blockchain!");
console.log("Transaction Hash:", addResult.txHash);
console.log("IPFS CID:", addResult.cid);// Search memories on the blockchain
const searchResults = await memory.search("What do you know about me?", {
user_id: "david_blockchain_dev",
agent_id: "sei-assistant", // optional
run_id: "onboarding-001", // optional
limit: 3,
});
console.log(`Found ${searchResults.length} memories:`);
searchResults.forEach((memory, index) => {
console.log(`${index + 1}. ${memory.memory}`);
});// Get all memories for a user
const allUserMemories = await memory.getAll({
user_id: "david_blockchain_dev",
});
// Get all memories for a user for a specific agent
const agentMemories = await memory.getAll({
user_id: "david_blockchain_dev",
agent_id: "sei-assistant",
});
// Get all memories for a specific conversation/run
const runMemories = await memory.getAll({
user_id: "david_blockchain_dev",
run_id: "onboarding-001",
});
// Narrow to a specific agent + run
const scopedMemories = await memory.getAll({
user_id: "david_blockchain_dev",
agent_id: "sei-assistant",
run_id: "onboarding-001",
});
console.log(
`Totals: user=${allUserMemories.length}, agent=${agentMemories.length}, run=${runMemories.length}, scoped=${scopedMemories.length}`,
);All writes go on-chain/IPFS. Use the trio of identifiers to control organization and retrieval.
// Store with full context
await memory.add("User prefers vegetarian food", {
user_id: "alice",
agent_id: "diet-assistant",
run_id: "consultation-001",
});
// Retrieve memories with different scopes
const allUser = await memory.getAll({ user_id: "alice" });
const byAgent = await memory.getAll({
user_id: "alice",
agent_id: "diet-assistant",
});
const byRun = await memory.getAll({
user_id: "alice",
run_id: "consultation-001",
});
const agentRun = await memory.getAll({
user_id: "alice",
agent_id: "diet-assistant",
run_id: "consultation-001",
});
// Search with context
const general = await memory.search("What do you know about me?", {
user_id: "alice",
});
const agentSearch = await memory.search("What do you know about me?", {
user_id: "alice",
agent_id: "diet-assistant",
});
const runSearch = await memory.search("What do you know about me?", {
user_id: "alice",
run_id: "consultation-001",
});That's it! The package automatically handles:
β
Network Selection: Just specify "testnet" or "mainnet"
β
Smart Contracts: Pre-deployed contracts are used automatically
β
IPFS Gateway: Your Pinata credentials are used for storage
β
Blockchain RPC: Optimal RPC endpoints are selected automatically
No contract addresses, no RPC URLs, no complex setup needed!
Seim0 uses a multi-layered architecture:
-
Smart Contracts: Pre-deployed contracts handle:
- Memory indexing and metadata management
- Access control and permissions
- Transaction fees and payments
-
IPFS Storage: Your Pinata account stores:
- Decentralized content storage
- Immutable content addressing
- Global accessibility
-
Blockchain Integration: Sei testnet/mainnet provides:
- Fast transaction processing
- Immutable transaction history
- Cryptographic verification
npm run buildnpm run sei:exampleContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
If you have any questions or need assistance:
- GitHub Issues: Report bugs or request features
- Documentation: Check the examples in
src/oss/examples/