MCPcopy Index your code
hub / github.com/ducqmomo/CrossMesh

github.com/ducqmomo/CrossMesh @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
410 symbols 726 edges 27 files 129 documented · 31%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CrossMesh

License: MIT TypeScript Rust Python Solidity

CrossMesh is a decentralized cross-chain message passing protocol that enables secure, low-latency, and verifiable communication between different blockchain networks. It serves as the foundational communication layer for multi-chain DApps, supporting DEX, NFT, DAO, and other cross-chain scenarios.

🌟 Features

  • 🔗 Cross-Chain Communication: Seamless message passing between EVM and non-EVM chains
  • 🛡️ Security First: Light client verification with Merkle proofs and economic incentives
  • ⚡ High Performance: Low-latency message delivery with optimized relay network
  • 💰 Fee Market: Decentralized fee mechanism with relayer incentives
  • 🔄 Retry Logic: Automatic retry and recovery for failed message deliveries
  • 🛠️ Developer Friendly: Multi-language SDKs (TypeScript, Rust, Python)
  • 📊 Monitoring: Comprehensive monitoring and analytics tools

🏗️ Architecture

CrossMesh consists of three main layers:

1. On-Chain Contract Layer

  • MessageBridge: Core contract for message storage, verification, and forwarding
  • LightClientVerifier: Maintains target chain block headers with SPV verification
  • FeeMarket: Handles fee settlement and relayer incentive mechanisms
  • RetryManager: Manages retry logic for failed cross-chain messages

2. Off-Chain Relay Layer

  • Relay Nodes: Monitor source chain events and collect cross-chain messages
  • Proof Generator: Creates Merkle proofs and submits to target chain verification contracts
  • Relayer Network: Decentralized relay network with staking and penalty mechanisms

3. Developer Interface Layer

  • SDKs: Multi-language SDKs for easy integration
  • APIs: Standardized APIs for message sending and receiving
  • Tools: Development and monitoring tools

🚀 Quick Start

Installation

TypeScript/JavaScript

npm install @crossmesh/sdk

Python

pip install crossmesh-sdk

Rust

[dependencies]
crossmesh-relay = "0.1.0"

Basic Usage

TypeScript

import { CrossMeshClient } from '@crossmesh/sdk';

const client = new CrossMeshClient({
  chains: [
    {
      chainId: 1,
      name: 'Ethereum',
      rpcUrl: 'https://mainnet.infura.io/v3/YOUR_PROJECT_ID',
      nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }
    },
    {
      chainId: 137,
      name: 'Polygon',
      rpcUrl: 'https://polygon-rpc.com',
      nativeCurrency: { name: 'MATIC', symbol: 'MATIC', decimals: 18 }
    }
  ],
  contractAddresses: {
    messageBridge: '0x...',
    lightClient: '0x...',
    feeMarket: '0x...',
    retryManager: '0x...'
  },
  rpcUrls: ['https://mainnet.infura.io/v3/YOUR_PROJECT_ID']
});

// Send a cross-chain message
const txHash = await client.sendMessage({
  dstChainId: 137,
  receiver: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
  payload: new TextEncoder().encode('Hello CrossMesh!')
});

// Monitor message status
const status = await client.monitorMessage(txHash);
console.log('Message status:', status);

Python

from crossmesh import CrossMeshClient

client = CrossMeshClient({
    'chains': [
        {
            'chain_id': 1,
            'name': 'Ethereum',
            'rpc_url': 'https://mainnet.infura.io/v3/YOUR_PROJECT_ID',
            'native_currency': {'name': 'Ether', 'symbol': 'ETH', 'decimals': 18}
        }
    ],
    'contract_addresses': {
        'message_bridge': '0x...',
        'light_client': '0x...',
        'fee_market': '0x...',
        'retry_manager': '0x...'
    },
    'rpc_urls': ['https://mainnet.infura.io/v3/YOUR_PROJECT_ID']
})

# Send a cross-chain message
tx_hash = await client.send_message({
    'dst_chain_id': 137,
    'receiver': '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
    'payload': b'Hello CrossMesh!'
})

# Monitor message status
status = await client.monitor_message(tx_hash)
print(f'Message status: {status}')

📖 Documentation

🛠️ Development

Prerequisites

  • Node.js 16+
  • Rust 1.70+
  • Python 3.8+
  • Hardhat

Setup

# Clone the repository
git clone https://github.com/ducqmomo/CrossMesh.git
cd CrossMesh

# Install dependencies
npm install

# Compile contracts
npm run compile

# Run tests
npm test

# Deploy contracts
npm run deploy

Running Relay Node

# Initialize relay node configuration
crossmesh-relay init --output config.toml

# Start relay node
crossmesh-relay start --config config.toml

🧪 Testing

# Run all tests
npm test

# Run contract tests
npx hardhat test

# Run SDK tests
cd sdk/typescript && npm test
cd sdk/python && pytest
cd sdk/rust && cargo test

# Run with coverage
npm run coverage

📊 Supported Chains

Chain Chain ID Status Notes
Ethereum 1 ✅ Supported Mainnet
Polygon 137 ✅ Supported Mainnet
BSC 56 ✅ Supported Mainnet
Arbitrum 42161 🚧 Coming Soon Testnet
Optimism 10 🚧 Coming Soon Testnet
Avalanche 43114 🚧 Coming Soon Testnet

🔒 Security

CrossMesh implements multiple security mechanisms:

  • Light Client Verification: SPV-style verification of cross-chain transactions
  • Economic Security: Staking and slashing mechanisms for relayers
  • Merkle Proofs: Cryptographic proofs for message authenticity
  • Multi-Signature: Threshold signatures for critical operations
  • Audit Ready: Comprehensive test coverage and security reviews

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Workflow

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Ethereum Foundation for the Ethereum protocol
  • Cosmos for IBC inspiration
  • All contributors and community members

📞 Support

🗺️ Roadmap

Q1 2024

  • [ ] Mainnet deployment
  • [ ] Additional chain support
  • [ ] Enhanced monitoring tools

Q2 2024

  • [ ] IBC compatibility
  • [ ] Rollup support
  • [ ] Advanced analytics

Q3 2024

  • [ ] Multi-signature integration
  • [ ] Cross-chain governance
  • [ ] Enterprise features

Built with ❤️ by the CrossMesh Team

Extension points exported contracts — how you extend this code

CrossChainMessage (Interface)
(no doc)
sdk/typescript/src/types.ts
MessageProof (Interface)
(no doc)
sdk/typescript/src/types.ts
MerkleProof (Interface)
(no doc)
sdk/typescript/src/types.ts
RelayerInfo (Interface)
(no doc)
sdk/typescript/src/types.ts
FeeInfo (Interface)
(no doc)
sdk/typescript/src/types.ts

Core symbols most depended-on inside this repo

sendMessage
called by 15
sdk/typescript/src/client.ts
registerRelayer
called by 14
sdk/typescript/src/relay.ts
_handle_contract_error
called by 8
sdk/python/src/crossmesh/client.py
receiveMessage
called by 8
sdk/typescript/src/client.ts
handleContractError
called by 8
sdk/typescript/src/client.ts
payFee
called by 8
sdk/typescript/src/relay.ts
distributeReward
called by 7
sdk/typescript/src/relay.ts
executeMessage
called by 6
sdk/typescript/src/client.ts

Shape

Method 245
Class 128
Interface 25
Function 10
Enum 2

Languages

TypeScript44%
Rust32%
Python25%

Modules by API surface

sdk/typescript/src/errors.ts63 symbols
sdk/python/src/crossmesh/exceptions.py45 symbols
sdk/rust/src/utils.rs32 symbols
sdk/python/src/crossmesh/types.py28 symbols
sdk/python/src/crossmesh/client.py28 symbols
sdk/typescript/src/client.ts27 symbols
sdk/typescript/src/types.ts25 symbols
sdk/typescript/src/utils.ts23 symbols
sdk/rust/src/client.rs23 symbols
sdk/typescript/src/message.ts22 symbols
sdk/typescript/src/relay.ts18 symbols
sdk/rust/src/blockchain.rs17 symbols

For agents

$ claude mcp add CrossMesh \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact