The IXO Matrix provides encrypted data storage and secure messaging capabilities for the Spatial Web through Matrix protocol integration. It enables private data rooms, real-time communication, and secure file storage with end-to-end encryption.

Spatial Web Architecture

IXO Matrix functions as the data persistence and communication layer within the broader Spatial Web Stack architecture, providing sovereign data storage for digital twins and secure communication channels between entity domains and users.

Core Components

Data Rooms

Encrypted spaces for storing sensitive data with controlled access

Messaging

Secure real-time communication channels between entities

File Storage

End-to-end encrypted file storage with access control

State Management

Room state and configuration management through IXO Matrix State Bot

Data Room Architecture

Implementation Guide

Creating Data Rooms

import { MatrixClient } from '@ixo/matrixclient-sdk'

// Initialize Matrix client
const matrix = new MatrixClient({
  baseUrl: 'https://matrix.ixo.world',
  accessToken: 'YOUR_ACCESS_TOKEN'
})

// Create encrypted room
const room = await matrix.createRoom({
  name: 'Project Data Room',
  encryption: true,
  preset: 'private_chat',
  initialState: [{
    type: 'm.room.encryption',
    state_key: '',
    content: { algorithm: 'm.megolm.v1.aes-sha2' }
  }]
})

// Set room permissions
await matrix.setRoomPermissions(room.id, {
  readAccess: ['@alice:ixo.world'],
  writeAccess: ['@bob:ixo.world']
})

Storing Data

// Store encrypted data
await matrix.sendEvent(room.id, 'data.store', {
  type: 'ProjectMetrics',
  data: encryptedData,
  metadata: {
    timestamp: Date.now(),
    version: '1.0'
  }
})

// Store file
const fileEvent = await matrix.sendFile(room.id, {
  file: fileData,
  filename: 'metrics.json',
  mimetype: 'application/json'
})

Real-Time Messaging

// Send secure message
await matrix.sendMessage(room.id, {
  msgtype: 'm.text',
  body: encryptedMessage
})

// Listen for messages
matrix.on('room.message', (event) => {
  if (event.getType() === 'm.room.message') {
    console.log('New message:', event.getContent().body)
  }
})

State Management

import { createMatrixStateBotClient } from "@ixo/matrixclient-sdk";

// Initialize IXO Matrix State Bot
const stateBot = await createMatrixStateBotClient({
  baseUrl: "https://matrix.ixo.world",
  accessToken: "BOT_TOKEN"
});

// Get room state
const state = await stateBot.getRoomState(room.id);

// Update state
await stateBot.setState(
  room.id,
  "custom.state.type",
  "",
  { key: "value" }
);

Integration Components

IXO MultiClient SDK

import { IxoClient } from '@ixo/impactxclient-sdk';

// Initialize the client
const client = new IxoClient({
  matrix: {
    baseUrl: 'https://matrix.ixo.world',
    accessToken: 'YOUR_ACCESS_TOKEN'
  },
  blockchain: {
    rpcUrl: 'https://rpc.ixo.earth'
  },
  oracles: {
    baseUrl: 'https://oracles.ixo.earth'
  }
});

// Create a data room for a digital twin
const room = await client.matrix.createRoom({
  name: 'Digital Twin Data Room',
  encryption: true,
  visibility: 'private'
});

// Store data in the room
await client.matrix.sendEvent(room.roomId, 'data.store', {
  type: 'TwinState',
  data: encryptedData
});

IXO Matrix Room Bot

import { createMatrixRoomBotClient } from '@ixo/matrixclient-sdk';

// Initialize room bot
const bot = await createMatrixRoomBotClient({
  baseUrl: 'https://matrix.ixo.world',
  accessToken: 'BOT_TOKEN'
});

// Create entity room
const entityRoom = await bot.createEntityRoom({
  entityDid: 'did:ixo:entity/123',
  name: 'Entity Data Room',
  members: ['@alice:ixo.world', '@bob:ixo.world']
});

// Handle invites
await bot.handleInvites();

Automated Room Creation

IXO Matrix provides automated room creation for domain entities registered on the IXO blockchain. This process is managed by the Matrix Server Bot, which monitors the blockchain for new entity registrations and creates corresponding Matrix rooms.

Matrix MCP Server and AuthIXO

Use Cases

Digital Twin Data

Store and manage digital twin state and history with secure access controls

IoT Telemetry

Collect and process device data streams with real-time updates

Verification Data

Store verification results and evidence for audit and compliance

Collaboration

Enable secure team communication with end-to-end encryption

Security Considerations

Best Practices

Room Management

  • Create separate rooms for different purposes
  • Use clear naming conventions
  • Document room purposes
  • Regular access reviews
  • Monitor room sizes

Data Handling

  • Validate data before storage
  • Implement error handling
  • Use appropriate event types
  • Monitor storage usage
  • Regular data cleanup

Performance

  • Batch operations when possible
  • Implement caching
  • Handle rate limits
  • Monitor API usage
  • Optimize file sizes

Next Steps