Blockchain Interoperability

Comprehensive guide for blockchain interoperability covering essential concepts, practical examples, and production best practices.

Blockchain interoperability enables systems on different blockchains to communicate, exchange data, and transfer value seamlessly. It matters when a user must bridge tokens across chains, when a decentralized application (dApp) needs to read state from Ethereum while writing to Solana, or when a cross-chain oracle must synchronize data between multiple chains with varying consensus and finality properties.

Cross-Chain Asset Transfer

Transferring assets across blockchains requires a mechanism to lock assets on one chain and mint equivalents on another. This is not a single transaction but a multi-step process involving state synchronization, confirmation, and finality.

To move 100 ETH from Ethereum to Polygon, a user initiates a deposit via a smart contract on Ethereum. The contract locks ETH in a vault and emits a DepositEvent with amount, recipient, and chainId. On Polygon, a watcher service polls the Ethereum blockchain for new DepositEvent logs every 12 seconds using eth_getLogs with a fromBlock and toBlock filter.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getLogs",
  "params": [
    {
      "address": "0x83842955e3130a811d8f21505d1809f88c70e55e",
      "topics": [
        "0x08353d14312463753d29b82119516091154b7a2e96187d6b2978c4681d34568f"
      ],
      "fromBlock": "0x1234567",
      "toBlock": "0x1234568"
    }
  ]
}

The response includes one or more log entries. The service processes each, validates the recipient address, and checks that the amount matches the expected value. It then submits a transaction on Polygon to mint the equivalent tokens.

The minting transaction is a call to a Mint function on a Polygon contract, with recipient and amount as inputs. The caller must ensure that the Polygon transaction is confirmed, typically using eth_getTransactionReceipt and verifying status === 1.

When a bridge fails, the most common error is a double-confirmation gap. A deposit event appears on Ethereum, is processed on Polygon, but the Polygon transaction is not confirmed within the expected window. The service logs:

ERROR: Bridge failed to confirm deposit: txHash=0xabc123def456, chainId=137, finalityThreshold=40
  - Receipt not found after 300 seconds
  - Finality missing: expected 40 confirmations, got 24

This leads to a stale bridge state where funds are minted but not yet spendable. To resolve, a manual reconciliation script runs:


curl -X POST https://api.bridge.example/reconcile \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": 137,
    "fromBlock": 1234567,
    "toBlock": 1234568,
    "force": true
  }'

The force: true flag causes the service to reprocess all events in the range, even if previously processed, ensuring no data loss during network outages.

Cross-Chain State Synchronization

When dApps need to read state from multiple chains, they must synchronize data across chains. This is typically done via a light client or state root verification.

A service reading data from both Ethereum and Arbitrum must verify that a given state root on Arbitrum is correct and finalized. It does so by fetching the latest stateRoot and timestamp from Arbitrum's L1Block contract on Ethereum. Then, it downloads the corresponding block header from Arbitrum’s Header contract.

The service uses eth_call to query the L1Block contract:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_call",
  "params": [
    {
      "to": "0x9045d3c610b11d9f9c08b1b631572e776297b05b",
      "data": "0x7d342c7c00000000000000000000000000000000000000000000000000000000"
    },
    "latest"
  ]
}

This returns a bytes32 value for the stateRoot. The service then fetches the full block header from Arbitrum’s Header contract using eth_getBlockByHash.

The header includes the stateRoot, parentHash, timestamp, and number. The service verifies the header by checking that the stateRoot is consistent with the L1Block data. It computes a Merkle proof of the state root against the header and validates it using a precomputed Merkle tree.

Failure occurs when the state root is not finalized. The service checks that the block is confirmed on Arbitrum (i.e., at least n confirmations) and finalized on Ethereum (i.e., at least m confirmations on the L1).

A typical error is:

WARNING: State root not finalized: blockNumber=123456, chainId=42161
  - Finalized on Ethereum: block 123456, but L1 block 123456 has stateRoot=0x... 
  - Expected stateRoot: 0xabc123def456, actual: 0x123abc456def, mismatch

The mismatch indicates a lagging state update. The service re-fetches the state root and compares it with the latest L1Block event. If the root has changed but the L1Block hasn’t been updated, the service logs a state root divergence.

Cross-Chain Messaging

For dApps to coordinate actions across chains, they rely on cross-chain messaging. A message is a payload of arbitrary data, often structured as bytes32 or json, sent from one chain to another.

Messages are typically sent via a message inbox. The sender contract on chain A calls sendMessage with a recipient, payload, and fee. The message is stored in a queue, and a listener on chain B polls for new messages.

The sendMessage function expects:

function sendMessage(
    address recipient,
    bytes calldata payload,
    uint256 fee
) external payable returns (uint256 messageId)

The listener on chain B uses eth_getLogs to fetch all MessageSent events. Each event includes messageId, sender, recipient, payload, and fee.

The listener processes messages in batches. It first fetches all new events, then calls eth_call to verify each message’s recipient address and fee value.

A common failure is message duplication. A message is sent, processed, but the listener reprocesses it during a network outage. To detect this, the service maintains a processedMessages table in a PostgreSQL database:

CREATE TABLE processed_messages (
  chain_id BIGINT NOT NULL,
  message_id BIGINT NOT NULL,
  processed_at TIMESTAMPTZ NOT NULL,
  PRIMARY KEY (chain_id, message_id)
);

Before processing a message, the service checks if it exists in the table:

SELECT 1 FROM processed_messages 
WHERE chain_id = 42161 AND message_id = 1234567;

If it does, the message is skipped. If not, it is processed, and the entry is inserted.

When a message fails to be processed, the service logs:

ERROR: Failed to process message: chainId=42161, messageId=1234567
  - Error: Contract call reverted with data 0x08c379a000000000000000000000000000000000000000000000000000000000
  - Reverted with: "Failed to handle message"

The 0x08c379a0 prefix indicates a Solidity abi.decode error. The service decodes the error using abi.decode and logs the full error message.

To recover from message failures, the service runs a message retry queue. Failed messages are inserted into a message_retry table with max_attempts and current_attempt.

CREATE TABLE message_retry (
  message_id BIGINT NOT NULL,
  chain_id BIGINT NOT NULL,
  failed_at TIMESTAMPTZ NOT NULL,
  error_data BYTEA NOT NULL,
  attempts INT NOT NULL DEFAULT 0,
  PRIMARY KEY (message_id, chain_id)
);

A cron job runs every 5 minutes:

# Retry failed messages
curl -X POST https://api.message.retry.example/execute \
  -H "Content-Type: application/json" \
  -d '{"maxAttempts": 5, "interval": "5m"}'

The job fetches all messages with attempts < maxAttempts, tries to process them again, and updates the attempts field.

Cross-Chain Execution

For full composability, dApps must execute logic across chains. This involves transaction batching and transaction sequencing.

A dApp might execute a transaction on Ethereum, then wait for it to be finalized, and then submit a second transaction on Solana. The sequence is orchestrated using a cross-chain executor.

The executor uses a TransactionSequence object with steps, each step defining a chain, contract, function, and inputs.

{
  "sequenceId": "seq-12345",
  "steps": [
    {
      "chainId": 1,
      "contract": "0xabc123def456",
      "function": "deposit",
      "inputs": [
        "0x1234567890abcdef",
        "1000000000000000000",
        "0x0000000000000000000000000000000000000000"
      ],
      "gasLimit": 200000
    },
    {
      "chainId": 10,
      "contract": "0xdef456abc123",
      "function": "transfer",
      "inputs": [
        "0x1234567890abcdef",
        "500000000000000000"
      ],
      "gasLimit": 150000
    }
  ],
  "finalityDelay": 60
}

The executor submits the first transaction on Ethereum and waits for its status === 1 in the receipt. Then, it polls the Ethereum node using eth_getTransactionReceipt with wait: true.

Once confirmed, it submits the second transaction on Solana using a solana-sendTransaction command:

solana sendTransaction --fee-payer ./keypair.json --url https://api.mainnet-beta.solana.com \
  --transaction ./tx.bin

The --transaction flag accepts a binary file generated by solana-cli or anchor.

The executor tracks the sequence’s progress in a transaction_sequences table:

CREATE TABLE transaction_sequences (
  sequence_id VARCHAR(64) PRIMARY KEY,
  status VARCHAR(32) NOT NULL, -- "pending", "executing", "completed", "failed"
  current_step INT NOT NULL,
  last_updated TIMESTAMPTZ NOT NULL,
  error TEXT
);

When a step fails, the executor updates the sequence and logs:

ERROR: Sequence failed at step 2: sequenceId=seq-12345
  - Step: chainId=10, contract=0xdef456abc123, function=transfer
  - Error: Solana transaction failed: signature=2a3b4c5d6e7f8a9b
  - RPC error: {"code": -32603, "message": "Transaction simulation failed", "data": {...}

The data field contains the full simulation result, including errors, logs, and accountChanges.

The executor also supports rollback on failure. If a step fails, it triggers a rollback event on the previous chain.

For example, if the Solana transaction fails, the executor calls rollback on the Ethereum contract with the sequenceId and error details.

{
  "jsonrpc": "2.0",
  "method": "eth_call",
  "params": [
    {
      "to": "0xabc123def456",
      "data": "0x1234567800000000000000000000000000000000000000000000000000000000"
    },
    "latest"
  ]
}

The data field encodes sequenceId and error using abi.encode.

Cross-Chain Identity and Authentication

A user must be able to authenticate across chains using a single identity. This is achieved via cross-chain identity resolution.

When a user signs a message on Ethereum using eth_signTypedData, the signature is used to authenticate them on Solana. The process involves:

  1. Generate a signingKey on Ethereum.
  2. Sign a message with eth_signTypedData.
  3. Export the signingKey to Solana using solana add-signer.

The signature is a bytes32 value. The service on Solana verifies it by calling solana verifySignature with the publicKey, message, and signature.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "solana_verifySignature",
  "params": [
    "0x1234567890abcdef1234567890abcdef12345678",
    "0xabcdef1234567890abcdef1234567890abcdef12345678",
    "0x1234567890abcdef1234567890abcdef123456781234567890abcdef12345678"
  ]
}

The service returns true if the signature is valid and the public key matches.

A common failure is signature mismatch due to message encoding. The message is signed in Ethereum using eth_signTypedData, but the Solana service expects solana_signMessage. The two formats differ in padding, encoding, and ABI.

The service logs:

ERROR: Signature verification failed: publicKey=0x1234..., messageHash=0xabcdef...
  - Expected: 0x1234567890abcdef1234567890abcdef12345678
  - Actual: 0x1234567890abcdef1234567890abcdef1234567812345678
  - Mismatch: 12 bytes of padding added

To resolve, the service re-encodes the message using abi.encode and compares the hash.

The system also supports identity federation: a user’s Ethereum address becomes their primary identity, and they can register secondary identities on other chains.

The service maintains a user_identities table:

CREATE TABLE user_identities (
  user_address BYTEA NOT NULL,
  chain_id BIGINT NOT NULL,
  identity_address BYTEA NOT NULL,
  registered_at TIMESTAMPTZ NOT NULL,
  PRIMARY KEY (user_address, chain_id)
);

When a user signs in on Solana, the service checks if they have a registered identity on Ethereum. If not, it triggers a cross-chain identity registration.

The registration process includes:

  1. Submitting a RegisterIdentity transaction on Ethereum.
  2. Waiting for confirmation.
  3. Broadcasting the identity_address to all other chains.

This ensures that a user’s identity is consistent across all chains.

This page was rewritten on 18 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.