10 min read
|
Published
|
Updated

Blockchain Interoperability: What APIs Can and Cannot Do

Blockchains cannot read each other. How bridges and protocols move assets across chains, and what a blockchain API does and does not solve for developers.

Chapters
C
Chaingateway Team
Blockchain Experts

Reviewed by Maurice Sobiera

Blockchain interoperability is the ability of separate blockchains to exchange assets or data. Most chains cannot read each other’s state, so moving value between them takes a bridge or a cross-chain protocol. A blockchain API does not provide that. It gives your software one interface to several chains, so each chain can be integrated in the same way.

Why can’t blockchains talk to each other?

Each chain validates only its own data. A smart contract on Ethereum cannot check whether a transaction happened on Tron, because the two networks use different consensus rules, address formats and data structures. An asset that leaves its chain therefore has to be represented on the destination chain by something that chain can verify. That is the trust problem of interoperability.

How do assets move between chains?

Through bridges and cross-chain messaging protocols. The Ethereum documentation on bridges distinguishes two trust models:

ModelHow it worksTrade-off
Trusted bridgeAn external set of verifiers (a multi-signature group, an MPC system or an oracle network) confirms events on the source chainFast and flexible, but you rely on the verifiers’ security
Trustless bridgeThe bridge relies on the validators of the connected chainsStronger security assumptions, less ability to pass complex data

The same page warns about the risks: smart contract flaws, wrapped assets that carry systemic risk, and counterparty risk. It states that bridges account for the top three biggest hacks in DeFi. A different design is the Inter-Blockchain Communication protocol (IBC), in which chains verify each other’s state through light clients. It is used between Cosmos chains, and it needs both chains to support it.

None of these is a feature of a REST API. If you need to move USDT from Ethereum to Tron, you use a bridge or an exchange, and you trust that service.

What does a blockchain API do for interoperability?

It removes the integration differences between chains on the application side. Each chain has its own node software, address format and encoding. The Chaingateway API uses the same request style, the same authentication and the same response envelope (status, ok, message, data) on the supported chains. A deposit monitor for USDT on two chains needs the same code with two parameters changed. The first request watches an address on Ethereum:

Terminal window
curl -X POST https://app.chaingateway.io/api/v2/ethereum/webhooks \
-H "Authorization: Bearer $CHAINGATEWAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "0x922815dFbEa128eAeaAAa185508fe078bECeFBBE",
"contractaddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"type": "ERC20",
"url": "https://example.com/hooks/deposit",
"reference": "user-77-eth"
}'

The second watches a Tron address for the TRC20 version of the same token. Only the chain in the path, the address formats, the contract address and the type change:

Terminal window
curl -X POST https://app.chaingateway.io/api/v2/tron/webhooks \
-H "Authorization: Bearer $CHAINGATEWAY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"to": "TWrTTVizHkF3LxTiWE9vCnhWC7CBpNXe22",
"contractaddress": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"type": "TRC20",
"url": "https://example.com/hooks/deposit",
"reference": "user-77-tron"
}'

Both notifications arrive at the same URL with the same fields: transaction ID, type, contract address, sender, recipient, block number. Your code branches on the type, not on the chain’s node protocol. Webhooks exist for Ethereum, BNB Smart Chain, Polygon, Arbitrum, Tron and Bitcoin. There are none for Solana. Webhooks are not retried automatically, which holds on every chain.

Which differences remain between the supported chains?

The API follows the structure of each chain where the chains differ. This table lists what the OpenAPI file shows per chain:

Chain familyAddresses and walletsFee-related endpointsWebhooks
Ethereum, BNB Smart Chain, Polygon, ArbitrumPOST .../addresses, .../addresses/importGET .../gaspriceYes
TronPOST .../addresses, .../addresses/importFreeze, unfreeze, delegate, undelegate, chain parametersYes
BitcoinPOST .../walletsnone listedYes
SolanaPOST .../addressesnone listedNo

The Tron fee endpoints deal with energy and bandwidth, which Tron uses instead of a gas price. The reasons are in the chains, not in the API, and no wrapper can remove them.

What does a blockchain API not solve?

It does not move assets between chains, and it does not make one chain verify another. It also hides only the access differences, not the economic ones. Tron charges resources (energy and bandwidth) where Ethereum charges gas. Confirmation times differ by chain, a USDT balance on Ethereum is a different asset from a USDT balance on Tron, and a bridged token is a third one. Your application still has to record which chain each balance lives on.

Older versions of this article suggested that blockchain APIs would unlock mass adoption by passing data between chains. That claim could not be supported, and cross-chain data transfer is the job of the bridging protocols above.

What should you ask before you use a bridge?

The risk list on the Ethereum bridge page gives the questions. For smart contract risk, ask whether the bridge has been audited and how it handled past incidents. For systemic risk, ask whether it issues wrapped assets and what backs them. For counterparty risk, ask who runs the verifiers and what happens if they stop. Check limits and fees, and send a small amount first.

An exchange is the other route. You deposit on one chain and withdraw on another, so the exchange carries the cross-chain risk, and you carry the exchange risk. Neither route is part of the API. Record every transfer, including the transaction IDs on both chains, so that a stuck transfer can be traced.

How should you design for several chains?

Store the chain with every address, transaction and balance. Treat the same token on two chains as two assets. Pick the chain for each customer flow deliberately, and show it in the interface so users do not send tokens to the wrong network. Test each chain on its testnet first: add X-Network: testnet to a request. Finally, decide how you handle failed webhook notifications, because the API lists them but does not resend them by itself.

How we write these articles

Ready to build this yourself? Get your API key — 7-day trial, no card required — or see the Blockchain API for the full endpoint reference.

C
Chaingateway Team
Blockchain Experts

The Chaingateway team is dedicated to simplifying blockchain integration for developers worldwide.