Cross-chain transactions (CCTXs) can be classified into two main types: incoming and outgoing.
Incoming transactions (connected chain → ZetaChain) are initiated on a connected chain and result in a transaction on ZetaChain. An incoming transaction consists of two transactions:
- Inbound: a transaction is initiated and observed on the connected chain.
- Outbound: the corresponding transaction is broadcasted and executed on ZetaChain.
Outgoing transactions (ZetaChain → connected chain) are initiated on ZetaChain and result in a transaction on a connected chain. An outgoing transaction consists of two transactions:
- Inbound: A transaction is initiated and observed on ZetaChain.
- Outbound: The corresponding transaction is broadcasted and executed on the connected chain.
Tracking a CCTX involves querying ZetaChain's Cosmos SDK HTTP API with an inbound transaction hash to get a CCTX hash. If a CCTX results in another CCTX (for example, an incoming results in an outgoing), the first CCTX hash can be used as a inbound hash to get the second CCTX hash.
Incoming & Outgoing
Consider an example of making call from Ethereum Sepolia to a universal app contract on ZetaChain, which triggers an outgoing call from ZetaChain to Polygon Amoy.
In this example a user calls EVM Gateway's depositAndCall
to call a universal
swap contract on ZetaChain, which swaps incoming
tokens for target ZRC-20 tokens and calls ZetaChain's Gateway withdraw
function, which triggers a token transfer on Polygon Amoy.
This example involves two CCTXs:
- Ethereum Sepolia → ZetaChain Testnet
- ZetaChain Testnet → Polygon Amoy
An inbound transaction on Ethereum Sepolia:
Use the inbound transaction hash to get the CCTX 1 hash:
Use the CCTX 1 hash (0x542b...11da
) as an inbound hash to get CCTX 2 hash:
Outbound hash on Polygon Amoy:
Incoming
Consider an example of making call from Ethereum Sepolia to a universal app contract on ZetaChain.
In this example a user calls EVM Gateway's depositAndCall
to call a universal
swap contract on ZetaChain, which swaps incoming
tokens for target ZRC-20 tokens, which are transferred to the recipient on
ZetaChain.
This example results in a single CCTX: Ethereum Sepolia → ZetaChain Testnet.
An inbound transaction on Ethereum Sepolia:
CCTX:
If you try querying the API with the CCTX hash as an inbound hash, the API responds with HTTP 404 response, because this CCTX does not trigger another CCTX.
Incoming & Abort
Consider an example of making call from Ethereum Sepolia to a universal app contract on ZetaChain, which aborts.
In this example a user calls EVM Gateway's depositAndCall
to call a universal
swap contract on ZetaChain, which swaps incoming
tokens for target ZRC-20 tokens, but the amount of supplied tokens is not enough
to cover the withdraw gas fee to Polygon Amoy, so the transaction reverts. The
amount of tokens is also not sufficient to cover a revert transaction to
Ethereum Sepolia, so the transaction abort.
An inbound transaction on Ethereum Sepolia:
CCTX:
Incoming & Revert
An example of making call from Base Sepolia to a universal app contract on ZetaChain, which reverts.
In this example a user calls EVM Gateway's depositAndCall
to call a universal
swap contract on ZetaChain, which swaps incoming
tokens for target ZRC-20 tokens, but the amount of supplied tokens is not enough
to cover the withdraw gas fee to Polygon Amoy, so the transaction reverts.
An inbound transaction on Base Sepolia:
Revert transaction back on Base Sepolia:
Multiple Outgoing
A single transaction can trigger more than one CCTXs.
In this example a single function call on ZetaChain makes multiple Gateway
call
s to different chains.