<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[neuraiproject - Medium]]></title>
        <description><![CDATA[Neurai is a Layer-1 blockchain with ASIC resistant and NFT/FT onchain focused on IoT and AI. - Medium]]></description>
        <link>https://medium.com/neuraiproject?source=rss----836ed1e2af40---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>neuraiproject - Medium</title>
            <link>https://medium.com/neuraiproject?source=rss----836ed1e2af40---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 18:52:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/neuraiproject" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Neurai: DePIN Messaging]]></title>
            <link>https://medium.com/neuraiproject/neurai-depin-messaging-84c26eb620ce?source=rss----836ed1e2af40---4</link>
            <guid isPermaLink="false">https://medium.com/p/84c26eb620ce</guid>
            <category><![CDATA[neurai]]></category>
            <category><![CDATA[depin]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[rwa]]></category>
            <dc:creator><![CDATA[NeurAI Project]]></dc:creator>
            <pubDate>Sat, 06 Dec 2025 14:16:03 GMT</pubDate>
            <atom:updated>2025-12-06T14:27:32.700Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Al53dMEib8z7hXyZBpR3xA.jpeg" /></figure><h3>Introduction</h3><p>Blockchain keeps evolving, but two things are still critical: privacy and secure communication. On the Neurai blockchain, DePIN Messaging (Decentralized Physical Infrastructure Network Messaging) is a peer-to-peer messaging system that uses blockchain assets to control who gets access, while keeping messages end-to-end encrypted and stored only temporarily.</p><p>Instead of saving messages permanently on-chain, as many blockchain messaging systems do, DePIN Messaging relies on an off-chain message pool (mempool). This allows real-time communication, avoids unnecessary growth of the blockchain, and helps protect user privacy.</p><p>In this article we’ll take a closer look at how DePIN Messaging works in Neurai: its architecture, the encryption it uses, the network protocols behind it, and some practical ways it can be used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3a0YRbDR-O1wplTc4sbtOA.jpeg" /></figure><h3>Core Architecture</h3><h3>1. Token-Gated Access Control</h3><p>DePIN Messaging implements a unique <strong>token-gated</strong> access model where communication rights are tied to blockchain asset ownership. Unlike traditional messaging systems that rely on centralized authentication servers, DePIN uses on-chain asset ownership as the authorization mechanism.</p><p><strong>Key Components:</strong></p><ul><li><strong>Access Token</strong>: Any Neurai asset (standard, unique, restricted, or DEPIN) can serve as an access token</li><li><strong>Ownership Verification</strong>: Real-time blockchain queries verify token ownership</li><li><strong>Decentralized Authorization</strong>: No central authority controls access rights</li><li><strong>Asset Index Requirement</strong>: Requires -assetindex flag for efficient ownership lookups</li></ul><pre>Message Flow:<br>User → Owns Token → Can Send/Receive Messages → Token Holders Only</pre><p><strong>Architecture Benefits:</strong></p><ol><li><strong>Decentralized Access Control</strong>: No central authentication server required</li><li><strong>Transferable Access Rights</strong>: Access can be transferred by transferring the token</li><li><strong>Provable Ownership</strong>: Cryptographic proof of ownership via blockchain</li><li><strong>Flexible Scoping</strong>: Different tokens create isolated communication channels</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XPouIxtL-OfZYD7Qtb6OTA.jpeg" /></figure><h3>2. Message Pool Architecture</h3><p>The DePIN Message Pool (CDepinMsgPool) is an in-memory data structure that stores encrypted messages temporarily, similar to Bitcoin&#39;s transaction mempool but designed for chat messages.</p><p><strong>Data Structures:</strong></p><pre>class CDepinMsgPool {<br>private:<br>    std::string activeToken;                    // Active access token<br>    std::map&lt;uint256, CDepinMessage&gt; mapMessages; // Hash → Message<br>    std::multimap&lt;int64_t, uint256&gt; mapByTime;  // Timestamp → Hash</pre><pre>    // Configuration<br>    unsigned int nMaxMessageSize;       // Max message size (default: 1KB)<br>    unsigned int nMessageExpiryHours;   // Message TTL (default: 168h = 7 days)<br>    unsigned int nMaxPoolSizeMB;        // Pool size limit (default: 100MB)<br>};</pre><p><strong>Storage Model:</strong></p><ul><li><strong>Ephemeral Storage</strong>: Messages exist only in RAM, not on blockchain</li><li><strong>Time-Based Expiry</strong>: Automatic cleanup after configurable period (default: 7 days)</li><li><strong>Size-Limited Pool</strong>: Prevents resource exhaustion (default: 100MB max)</li><li><strong>Optional Persistence</strong>: Can be saved to disk on shutdown (-depinpoolpersist)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZSYcy1keBMJlAFkQ6Uqx7Q.jpeg" /></figure><p><strong>Configuration Parameters:</strong></p><pre>| Parameter           | Default   | Maximum     | Description             |<br>|---------------------|-----------|-------------|-------------------------|<br>| `-depinmsgsize`     | 1024 bytes| 10240 bytes | Maximum message size    |<br>| `-depinmsgexpire`   | 168 hours | 720 hours   | Message expiration time |<br>| `-depinpoolsize`    | 100 MB    | 1000 MB     | Maximum pool size       |<br>| `-depinpoolpersist` | false     |      -      | Save pool on shutdown   |</pre><h3>Hybrid Encryption: ECIES Implementation</h3><p>One of the most sophisticated aspects of DePIN Messaging is its <strong>ECIES (Elliptic Curve Integrated Encryption Scheme)</strong> hybrid encryption system, which enables efficient multi-recipient encryption.</p><h3>Why Hybrid Encryption?</h3><p>Traditional public-key encryption (like RSA) would require encrypting the entire message separately for each recipient, resulting in:</p><pre>Message Size per Recipient = Original Size × Number of Recipients</pre><p>For a 1KB message sent to 20 recipients, this would create 20KB of encrypted data!</p><p><strong>DePIN’s Solution</strong>: Encrypt the message <strong>once</strong> with AES-256-CBC, then encrypt only the AES key for each recipient using ECDH (Elliptic Curve Diffie-Hellman).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iXB02Ft7OvmDtctJ5CtErQ.jpeg" /></figure><h3>ECIES Encryption Process</h3><p>The encryption process follows a sophisticated multi-step protocol:</p><h4>Step 1: Generate Ephemeral Key Pair</h4><p>For each message, a <strong>one-time ephemeral key pair</strong> is generated:</p><pre>CKey ephemeralKey;<br>ephemeralKey.MakeNewKey(true); // Compressed public key<br>CPubKey ephemeralPubKey = ephemeralKey.GetPubKey();</pre><p><strong>Purpose</strong>: The ephemeral key ensures perfect forward secrecy. Even if a recipient’s private key is compromised later, past messages remain secure.</p><h4>Step 2: Encrypt Message with AES-256-CBC</h4><p>The plaintext message is encrypted once using AES-256-CBC:</p><pre>1. Generate random AES-256 key (32 bytes)<br>2. Generate random IV (16 bytes)<br>3. Encrypt message: AES-256-CBC(plaintext, key, IV)<br>4. Compute HMAC-SHA256 for integrity verification<br>5. Package: [IV || encrypted_data || HMAC]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kLO_EUGqBzIKPEU2zWgm3A.jpeg" /></figure><h4>Step 3: Encrypt AES Key for Each Recipient</h4><p>For each recipient, the AES key is encrypted using ECDH:</p><pre>For each recipient:<br>    1. Retrieve recipient&#39;s public key from blockchain<br>    2. Compute shared secret: ECDH(ephemeral_privkey, recipient_pubkey)<br>    3. Derive encryption key: SHA-256(shared_secret)<br>    4. Encrypt AES key with derived key<br>    5. Compute HMAC for integrity<br>    6. Store: recipientKeys[address_hash] = [encrypted_aes_key || HMAC]</pre><p><strong>Data Structure:</strong></p><pre>class CECIESEncryptedMessage {<br>    CPubKey ephemeralPubKey;                    // Ephemeral public key (33 bytes)<br>    std::vector&lt;unsigned char&gt; encryptedPayload; // AES-encrypted message<br>    std::map&lt;uint160, std::vector&lt;unsigned char&gt;&gt; recipientKeys; // Per-recipient encrypted keys<br>};</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vh5GRdoGQ06oPk5-W0JHNQ.jpeg" /></figure><h3>ECIES Decryption Process</h3><p>Decryption reverses the process:</p><pre>1. Extract ephemeral public key from message<br>2. Compute shared secret: ECDH(recipient_privkey, ephemeral_pubkey)<br>3. Derive decryption key: SHA-256(shared_secret)<br>4. Locate encrypted AES key for this recipient<br>5. Decrypt AES key<br>6. Verify HMAC integrity check<br>7. Decrypt message payload using recovered AES key</pre><p><strong>Cryptographic Properties:</strong></p><ul><li><strong>Perfect Forward Secrecy</strong>: Ephemeral keys prevent retroactive decryption</li><li><strong>Authenticated Encryption</strong>: HMAC ensures message integrity</li><li><strong>Multi-Recipient Efficiency</strong>: Single encrypted payload shared by all recipients</li><li><strong>Elliptic Curve Security</strong>: secp256k1 curve (same as Bitcoin)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n0gG0vXvOdgYyNiLCHh9Rw.jpeg" /></figure><h3>Message Structure and Validation</h3><h3>CDepinMessage Structure</h3><p>Every DePIN message contains:</p><pre>class CDepinMessage {<br>    std::string token;                      // Access token name<br>    std::string senderAddress;              // Sender&#39;s blockchain address<br>    int64_t timestamp;                      // UNIX timestamp<br>    std::vector&lt;unsigned char&gt; signature;   // Sender&#39;s signature<br>    std::vector&lt;unsigned char&gt; encryptedPayload; // ECIES encrypted data<br>};</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wtk94Y3dqwkNpTj_mfohVw.jpeg" /></figure><h3>Validation Pipeline</h3><p>Before accepting a message into the pool, multiple validation checks are performed:</p><pre>Validation Steps:<br>1. Token Match: message.token == activeToken<br>2. Timestamp Check: not too far in future (60s tolerance)<br>3. Expiry Check: not already expired<br>4. Size Check: encryptedPayload.size() ≤ maxSize × maxRecipients<br>5. Pool Size Check: currentPoolSize + messageSize ≤ maxPoolSize<br>6. Signature Verification: VerifySignature(senderAddress, message)<br>7. Token Ownership: sender owns token on blockchain<br>8. Duplicate Check: message hash not already in pool</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7yQ7sbxnbOTgx43deoV7fg.jpeg" /></figure><h3>Signature Scheme</h3><p>Messages are signed using Bitcoin’s standard ECDSA signature scheme:</p><pre>// Signing<br>1. Construct message to sign: token + senderAddress + timestamp + encryptedPayload<br>2. Hash message: SHA-256(message)<br>3. Sign hash with sender&#39;s private key: ECDSA(hash, privkey)<br>4. Attach signature to message</pre><pre>// Verification<br>1. Reconstruct message: token + senderAddress + timestamp + encryptedPayload<br>2. Hash message: SHA-256(message)<br>3. Recover public key from signature<br>4. Verify signature: VerifyECDSA(signature, hash, pubkey)<br>5. Check pubkey matches sender&#39;s address</pre><p>This ensures:</p><ul><li><strong>Authentication</strong>: Only the address owner can send messages</li><li><strong>Integrity</strong>: Messages cannot be tampered with in transit</li><li><strong>Non-repudiation</strong>: Sender cannot deny sending the message</li></ul><h3>Network Protocol</h3><p>DePIN Messaging operates as a <strong>distributed message relay network</strong> where nodes can run message pool servers and clients can query multiple servers for messages.</p><h3>Server Architecture</h3><p>The CDepinMsgPoolServer implements a lightweight TCP server:</p><p><strong>Configuration:</strong></p><pre># Node configuration<br>-depinmsgtoken=&quot;&amp;MYTOKEN&quot;     # Token to gate access<br>-depinmsgport=19002           # Server port (default)<br>-depinmsgmaxusers=20          # Max recipients per message</pre><p><strong>Server Responsibilities:</strong></p><ol><li><strong>Listen for Connections</strong>: TCP socket on configured port</li><li><strong>Authenticate Clients</strong>: Challenge-response authentication</li><li><strong>Accept Messages</strong>: Validate and store in pool</li><li><strong>Serve Messages</strong>: Return messages for authenticated addresses</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XMtY_wKHcaGNm1l9sv0pdg.jpeg" /></figure><h3>Challenge-Response Authentication</h3><p>To prevent unauthorized access, DePIN uses a <strong>challenge-response protocol</strong>:</p><pre>Client                                    Server<br>  |                                         |<br>  |------ Request Challenge ---------------&gt;|<br>  |                                         |<br>  |                             [Verify token ownership]<br>  |                              [Generate random nonce]<br>  |                                         |<br>  |&lt;----- Challenge (nonce, expiry) --------|<br>  |                                         |<br>       [Sign challenge with private key]    |<br>  |                                         |<br>  |------ Signed Challenge ----------------&gt;|<br>  |                                         |<br>  |                               [Verify signature] <br>  |                              [Check token ownership]<br>  |                                         |<br>  |&lt;----- Access Granted -------------------|</pre><p><strong>Challenge Types:</strong></p><ul><li><strong>RECEIVE</strong>: Authenticate to retrieve messages</li><li><strong>SEND</strong>: Authenticate to submit new messages</li></ul><p><strong>Security Properties:</strong></p><ul><li><strong>Replay Attack Prevention</strong>: Nonce valid for 30 seconds only</li><li><strong>Token Verification</strong>: Must own token on blockchain</li><li><strong>Signature Verification</strong>: Must control address private key</li><li><strong>IP-Bound Challenges</strong>: Challenges tied to client IP</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WP2VDHRYoKg0Mp2gzxHh1g.jpeg" /></figure><h3>JSON-RPC API</h3><p>The DePIN server exposes a JSON-RPC interface for programmatic access:</p><h4>Get Server Info</h4><pre>// Request<br>{<br>  &quot;method&quot;: &quot;depingetmsginfo&quot;,<br>  &quot;params&quot;: []<br>}</pre><pre>// Response<br>{<br>  &quot;result&quot;: {<br>    &quot;token&quot;: &quot;&amp;MYTOKEN&quot;,<br>    &quot;message_count&quot;: 157,<br>    &quot;expiry_hours&quot;: 168,<br>    &quot;max_message_size&quot;: 1024,<br>    &quot;max_recipients&quot;: 20<br>  }<br>}</pre><h4>Request Authentication Challenge</h4><pre>// Request<br>{<br>  &quot;method&quot;: &quot;depinrequestchallenge&quot;,<br>  &quot;params&quot;: {<br>    &quot;token&quot;: &quot;&amp;MYTOKEN&quot;,<br>    &quot;address&quot;: &quot;NXxa8YdFz...&quot;,<br>    &quot;type&quot;: &quot;receive&quot;<br>  }<br>}</pre><pre>// Response<br>{<br>  &quot;result&quot;: {<br>    &quot;challenge&quot;: &quot;d4f9e8b7c6a5...&quot;,<br>    &quot;expires_in&quot;: 30<br>  }<br>}</pre><h4>Query Messages</h4><pre>// Request<br>{<br>  &quot;method&quot;: &quot;depinquerymessages&quot;,<br>  &quot;params&quot;: {<br>    &quot;token&quot;: &quot;&amp;MYTOKEN&quot;,<br>    &quot;addresses&quot;: [&quot;NXxa8YdFz...&quot;, &quot;NYyb9ZeGa...&quot;],<br>    &quot;auth_address&quot;: &quot;NXxa8YdFz...&quot;,<br>    &quot;challenge&quot;: &quot;d4f9e8b7c6a5...&quot;,<br>    &quot;signature&quot;: &quot;H5gK3mN9p...&quot;<br>  }<br>}</pre><pre>// Response<br>{<br>  &quot;result&quot;: {<br>    &quot;messages&quot;: [<br>      {<br>        &quot;hash&quot;: &quot;a1b2c3d4...&quot;,<br>        &quot;sender&quot;: &quot;NZzc0AfHb...&quot;,<br>        &quot;timestamp&quot;: 1699123456,<br>        &quot;encrypted_payload&quot;: &quot;0x48656c6c6f...&quot;<br>      }<br>    ]<br>  }<br>}</pre><h4>Submit Message</h4><pre>// Request<br>{<br>  &quot;method&quot;: &quot;depinsubmitmessage&quot;,<br>  &quot;params&quot;: {<br>    &quot;serialized_message&quot;: &quot;0x48656c6c6f...&quot;  // Hex-encoded CDepinMessage<br>  }<br>}</pre><pre>// Response<br>{<br>  &quot;result&quot;: {<br>    &quot;status&quot;: &quot;accepted&quot;,<br>    &quot;hash&quot;: &quot;a1b2c3d4...&quot;<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DHH58c7Zl7uRnNAKPV9Luw.jpeg" /></figure><h3>Use Cases and Applications</h3><h3>1. Private Group Chat</h3><p><strong>Scenario</strong>: A DAO wants to provide secure chat for token holders.</p><p><strong>Implementation:</strong></p><ol><li>Create unique asset: #DAOCHAT (quantity: 1000)</li><li>Distribute tokens to DAO members</li><li>Run DePIN server: -depinmsgtoken=&quot;#DAOCHAT&quot;</li><li>Members install wallet, connect to server</li><li>Chat automatically limited to token holders</li></ol><p><strong>Benefits:</strong></p><ul><li><strong>Automatic Access Control</strong>: Only token holders can participate</li><li><strong>Transferable Access</strong>: Send token to grant chat access</li><li><strong>Revocable Access</strong>: Retrieve token to revoke access</li><li><strong>Provable Membership</strong>: On-chain proof of participation rights</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wd3g4SVaL3_D82sBC-b8vw.jpeg" /></figure><h3>2. Customer Support Channels</h3><p><strong>Scenario</strong>: Company provides support to product owners via NFTs.</p><p><strong>Implementation:</strong></p><ol><li>Create unique asset per product: &amp;PRODUCT_SERIAL_001</li><li>Issue asset to customer on purchase</li><li>Customer can contact support by proving ownership</li><li>Support channels gated by product ownership</li></ol><p><strong>Benefits:</strong></p><ul><li><strong>Ownership Verification</strong>: Automatic customer authentication</li><li><strong>Product-Specific Support</strong>: Separate channels per product line</li><li><strong>Transferable Warranty</strong>: Support rights transfer with product</li><li><strong>No Account Required</strong>: Wallet serves as authentication</li></ul><h3>3. Secure Document Delivery</h3><p><strong>Scenario</strong>: Legal firm delivers confidential documents to clients.</p><p><strong>Implementation:</strong></p><ol><li>Create restricted asset: $LEGAL_CLIENT_001</li><li>Send asset to client’s address</li><li>Encrypt document using DePIN encryption</li><li>Client retrieves via DePIN messaging</li><li>Automatic expiry after 7 days (configurable)</li></ol><p><strong>Benefits:</strong></p><ul><li><strong>End-to-End Encryption</strong>: Documents never transmitted in plaintext</li><li><strong>Ephemeral Storage</strong>: Automatic deletion after expiry</li><li><strong>Access Revocation</strong>: Freeze asset to revoke access</li><li><strong>Audit Trail</strong>: Blockchain records asset transfers</li></ul><h3>4. IoT Device Communication</h3><p><strong>Scenario</strong>: IoT devices communicate via blockchain-gated channels.</p><p><strong>Implementation:</strong></p><ol><li>Create DEPIN asset per device: &amp;DEVICE_SENSOR_001</li><li>Devices own their respective assets</li><li>Message pool serves as communication broker</li><li>Device-to-device encrypted messaging</li></ol><p><strong>Benefits:</strong></p><ul><li><strong>Device Authentication</strong>: Asset ownership proves device identity</li><li><strong>Decentralized Architecture</strong>: No central messaging server</li><li><strong>Encrypted Communication</strong>: ECIES protects sensor data</li><li><strong>Scalable</strong>: Message pool handles high-frequency updates</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ggax0XQQjYddkFo3ODXxsg.jpeg" /></figure><h3>Performance Considerations</h3><h3>Memory Management</h3><p>The message pool implements several strategies to prevent resource exhaustion:</p><p><strong>Size Limits:</strong></p><pre>// Per-message limits<br>MAX_MESSAGE_SIZE = 10KB              // Single message max<br>MAX_RECIPIENTS = 50                  // Recipients per message<br>MAX_TOTAL_SIZE = MAX_MESSAGE_SIZE × MAX_RECIPIENTS  // 500KB max</pre><pre>// Pool-wide limits<br>MAX_POOL_SIZE = 1GB                  // Total pool size</pre><p><strong>Cleanup Strategies:</strong></p><ol><li><strong>Automatic Expiry</strong>: Background thread removes expired messages every 5 minutes</li><li><strong>Size-Based Eviction</strong>: Reject new messages when pool is full</li><li><strong>Time-Based Eviction</strong>: Remove messages older than expiry time</li><li><strong>Manual Cleanup</strong>: RPC command to force cleanup</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M9vRW5irDpgqK4urWaKXvQ.jpeg" /></figure><h3>Network Performance</h3><p><strong>Bandwidth Optimization:</strong></p><ul><li><strong>Single Encryption</strong>: Hybrid encryption reduces bandwidth by ~95% for multi-recipient messages</li><li><strong>Compressed Public Keys</strong>: 33 bytes instead of 65 bytes (secp256k1 compression)</li><li><strong>Binary Protocol</strong>: Efficient serialization, not verbose JSON</li></ul><p><strong>Latency Characteristics:</strong></p><pre>|        Operation         | Typical Latency | <br>|--------------------------|-----------------|<br>| `Message submission`     | &lt; 100ms         |<br>| `Token verification`     | &lt; 50ms (cached) |<br>| `Signature verification` | &lt; 10ms          |<br>| `Encryption` | false     | &lt; 200ms         |<br>| `Decryption` | false     | &lt; 50ms          |</pre><h3>Scalability Analysis</h3><p><strong>Message Throughput:</strong></p><p>Assuming:</p><ul><li>Average message size: 2KB (encrypted)</li><li>Average recipients: 10</li><li>Pool size limit: 100MB</li></ul><pre>Max messages in pool = 100MB / 2KB = 51,200 messages<br>Daily capacity (7-day expiry) = 51,200 / 7 = 7,314 messages/day<br>Messages per second = 7,314 / 86,400 ≈ 0.08 msg/s</pre><p>For high-traffic applications:</p><ul><li>Increase pool size: -depinpoolsize=1000 (10x capacity)</li><li>Reduce expiry: -depinmsgexpire=24 (7x capacity)</li><li>Run multiple servers with different tokens</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_Sz3O4IAv70apFJxBy67w.jpeg" /></figure><h3>Security Analysis</h3><h3>Threat Model</h3><p><strong>Assumptions:</strong></p><ol><li><strong>Blockchain Security</strong>: Underlying blockchain is secure (51% attack resistant)</li><li><strong>Cryptographic Primitives</strong>: ECDSA, ECDH, AES-256, SHA-256 are secure</li><li><strong>Private Key Security</strong>: Users protect their private keys</li><li><strong>Network Security</strong>: TLS/SSL optional for transport layer protection</li></ol><p><strong>Attack Vectors and Mitigations:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*4mHQgxitcgJcVSyRoGdVsg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXzw92f8YW_uYXmgXRIsjA.jpeg" /></figure><h3>Privacy Properties</h3><p><strong>What is Protected:</strong></p><ul><li>✅ <strong>Message Content</strong>: ECIES encryption, only recipients can decrypt</li><li>✅ <strong>Recipient List</strong>: Encrypted keys indexed by hash, not addresses</li><li>✅ <strong>Message Integrity</strong>: HMAC prevents tampering</li><li>✅ <strong>Sender Authentication</strong>: Signature proves sender identity</li></ul><p><strong>What is NOT Protected:</strong></p><ul><li>❌ <strong>Sender Address</strong>: Visible in message structure (public metadata)</li><li>❌ <strong>Timestamp</strong>: Message sending time is public</li><li>❌ <strong>Message Count</strong>: Number of messages per token is observable</li><li>❌ <strong>Token Association</strong>: Which token is used for communication</li></ul><p><strong>Metadata Leakage:</strong></p><p>While message content is encrypted, metadata is observable:</p><ul><li>Sender addresses</li><li>Message timestamps</li><li>Approximate message sizes</li><li>Token being used</li></ul><p>For applications requiring metadata privacy, consider:</p><ul><li>Using unique tokens per conversation</li><li>Running private relay servers</li><li>Implementing mix networks or onion routing</li></ul><h3>Implementation Requirements</h3><h3>Node Requirements</h3><p>To run a DePIN messaging server, nodes must:</p><p><strong>Mandatory:</strong></p><ol><li><strong>Asset Index</strong>: -assetindex flag enabled</li><li><strong>Public Key Index</strong>: -pubkeyindex flag enabled (for encryption)</li><li><strong>Blockchain Sync</strong>: Fully synchronized blockchain</li></ol><p><strong>Optional:</strong></p><ol><li><strong>Pool Persistence</strong>: -depinpoolpersist to save messages on shutdown</li><li><strong>Custom Port</strong>: -depinmsgport=XXXX for non-default port</li></ol><p><strong>Reindexing:</strong></p><p>If enabling on existing node:</p><pre># First-time setup<br>neurai-cli stop<br>neuraid -assetindex -pubkeyindex -reindex -depinmsgtoken=&quot;&amp;MYTOKEN&quot;</pre><pre># After reindex completes, normal startup:<br>neuraid -assetindex -pubkeyindex -depinmsgtoken=&quot;&amp;MYTOKEN&quot;</pre><p><strong>Resource Requirements:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*eQUb5Joz038nC7WEpi7s4A.png" /></figure><h3>Client Requirements</h3><p><strong>Wallet Integration:</strong></p><p>Clients need:</p><ol><li>Neurai wallet with asset support</li><li>Token ownership (must own configured token)</li><li>Public key published on blockchain (automatic with first transaction)</li><li>Network connectivity to DePIN server</li></ol><p><strong>Web Client Requirements:</strong></p><p>For browser-based clients:</p><ul><li>WebSocket or HTTP API support</li><li>JavaScript ECIES implementation</li><li>Web3 wallet integration (MetaMask, WalletConnect, etc.)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_3TEIOIeoy-0JMotDo-SLA.jpeg" /></figure><h3>Comparison with Alternatives</h3><h3>vs. On-Chain Messaging</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*KSi6PRQxkCkQmKI_LndWlg.png" /></figure><p><strong>Use On-Chain When:</strong></p><ul><li>Permanent record required</li><li>Legal/compliance needs</li><li>Timestamp proof needed</li><li>Small data only</li></ul><p><strong>Use DePIN When:</strong></p><ul><li>Real-time communication</li><li>Large messages</li><li>Private conversations</li><li>Ephemeral data</li></ul><h3>vs. Centralized Messaging (Telegram, Discord)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*K-LFE2qcrp1n9iEyQ-TRxg.png" /></figure><p><strong>Advantages of DePIN:</strong></p><ul><li>No account creation/management</li><li>Provable access rights</li><li>Censorship resistance</li><li>True decentralization</li></ul><p><strong>Advantages of Centralized:</strong></p><ul><li>Better UX (simpler onboarding)</li><li>Rich media support</li><li>Advanced features (voice, video)</li><li>Mature ecosystem</li></ul><h3>Future Enhancements</h3><h3>Planned Features</h3><ol><li><strong>Message Receipts</strong>: Cryptographic acknowledgment of message delivery</li><li><strong>Group Encryption</strong>: Optimized encryption for large groups (broadcast encryption)</li><li><strong>Message Forwarding</strong>: Relay messages through intermediate nodes</li><li><strong>Offline Message Queue</strong>: Store messages for offline users</li><li><strong>Rich Media</strong>: Support for images, files, and attachments</li><li><strong>Message Reactions</strong>: Like/react to messages</li><li><strong>Message Editing</strong>: Edit sent messages with signature chain</li><li><strong>Message Threading</strong>: Reply chains and conversations</li></ol><h3>Research Directions</h3><p><strong>Metadata Privacy:</strong></p><ul><li><strong>Mix Networks</strong>: Onion routing for sender anonymity</li><li><strong>Stealth Addresses</strong>: Hide recipient addresses</li><li><strong>Dummy Traffic</strong>: Constant-rate cover traffic</li></ul><p><strong>Scalability:</strong></p><ul><li><strong>Sharding</strong>: Partition message pool by token or time</li><li><strong>DHT Integration</strong>: Distributed hash table for message storage</li><li><strong>Bloom Filters</strong>: Efficient message existence checks</li></ul><p><strong>Interoperability:</strong></p><ul><li><strong>Matrix Bridge</strong>: Integration with Matrix protocol</li><li><strong>XMPP Gateway</strong>: Bridge to Jabber/XMPP networks</li><li><strong>Email Gateway</strong>: Send/receive via email</li></ul><h3>Conclusion</h3><p>DePIN Messaging represents a novel approach to decentralized communication, combining:</p><p>✅ <strong>Blockchain-Based Access Control</strong>: Cryptographic asset ownership gates participation<br>✅ <strong>End-to-End Encryption</strong>: ECIES hybrid encryption protects message content<br>✅ <strong>Ephemeral Architecture</strong>: Off-chain message pool prevents blockchain bloat<br>✅ <strong>Decentralized Infrastructure</strong>: No central authority or single point of failure<br>✅ <strong>Flexible Integration</strong>: Token-gated access enables creative applications</p><p><strong>Key Takeaways:</strong></p><ol><li><strong>Token-Gated Model</strong>: Revolutionary access control via asset ownership</li><li><strong>Hybrid Encryption</strong>: Efficient multi-recipient encryption via ECIES</li><li><strong>Ephemeral Storage</strong>: Messages auto-expire, reducing storage requirements</li><li><strong>Provable Ownership</strong>: Blockchain provides cryptographic proof of access rights</li><li><strong>Developer-Friendly</strong>: Simple JSON-RPC API for integration</li></ol><p><strong>Getting Started:</strong></p><pre># Configure DePIN messaging on your node<br>neuraid -assetindex -pubkeyindex -depinmsgtoken=&quot;&amp;MYTOKEN&quot; -depinmsgport=19002</pre><pre># Query message pool info<br>curl -X POST <a href="http://localhost:19002/">http://localhost:19002</a> -d &#39;{&quot;method&quot;:&quot;depingetmsginfo&quot;,&quot;params&quot;:[]}&#39;</pre><pre># Build applications using the DePIN API</pre><p><strong>Resources:</strong></p><ul><li><strong>Website</strong>: <a href="https://neurai.org/">neurai.org</a></li><li><strong>X:</strong> <a href="https://twitter.com/neuraiproject">https://twitter.com/neuraiproject</a></li><li><strong>GitHub Repository</strong>: <a href="https://github.com/NeuraiProject/DePIN-Messaging">github.com/NeuraiProject/DePIN-Messaging</a></li><li><strong>Neurai-Test-Version</strong>: <a href="https://github.com/NeuraiProject/Neurai/releases/tag/1.0.6b1_DePIN">https://github.com/NeuraiProject/Neurai/releases/tag/1.0.6b1_DePIN</a></li><li><strong>Telegram</strong>: <a href="https://t.me/neuraiproject">https://t.me/neuraiproject</a></li><li><strong>Discord</strong>: <a href="https://discord.gg/neurai-project-1062678996208336896">https://discord.gg/neurai-project-1062678996208336896</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84c26eb620ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/neuraiproject/neurai-depin-messaging-84c26eb620ce">Neurai: DePIN Messaging</a> was originally published in <a href="https://medium.com/neuraiproject">neuraiproject</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>