Build
reference
Types of Transactions

✅ Native gas token to TSS with empty input data

To deposit native gas tokens from a connected chain to ZetaChain make a token transfer to the TSS address on the connected chain.

When depositing from an EVM chain you don't have to specify the recipient in the input data. If the input data is empty, the sender address will be used as the recipient address.

When depositing from Bitcoin you must specify the recipient address in the memo.

npx hardhat deposit --amount 0.01 --network sepolia_testnet

https://sepolia.etherscan.io/tx/0x88d180a6424bdaf245ebddcbe4af4e67fd05b0037426fcebe6f9ae011b46fa5a (opens in a new tab)

✅ Native gas token to TSS with recipient in input data

When depositing from an EVM chain you can optionally specify a recipient address in the input data (first 20 bytes).

npx hardhat deposit --amount 0.01 --network sepolia_testnet --recipient 0x4955a3F38ff86ae92A914445099caa8eA2B9bA32

https://sepolia.etherscan.io/tx/0xaee07e4ab765e4a53d555cf62713100b95f2d0f87b40911acb7dca4342aea7b1 (opens in a new tab)

✅ USDC to ERC-20 custody contract with no input data

Supported ERC-20 can be deposited to ZetaChain by calling the deposit method of the ERC-20 custody contract on a connected chain.

npx hardhat deposit --amount 1 --network sepolia_testnet --erc20 0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238

https://sepolia.etherscan.io/tx/0x281437be30bbde834cb05676fc59ad0084b8828a2b4f9503e8cf46d12f3ce4a2 (opens in a new tab)

❌ USDC to ERC-20 custody contract with a message

Depositing ERC-20 to an EOA with a message will result in a transaction revert.

npx hardhat deposit --amount 1 --network sepolia_testnet --erc20 0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238 --message '[["string"], ["hello"]]' --recipient 0x4955a3F38ff86ae92A914445099caa8eA2B9bA32 --ignore-checks

https://sepolia.etherscan.io/tx/0x8cefbf39999a18a56e54923276d6b85afcc6b366c21752e2e792ec7aeed375e5 (opens in a new tab)

✅ Native gas token to TSS with recipient and valid message

To deposit native gas tokens from a connected chain and call an omnichain contract on ZetaChain make a token transfer to the TSS address on the connected chain and specify omnichain contract address as the first 20 bytes of the input data and provide a valid message.

This is an example deposit and call of the example omnichain swap contract.

npx hardhat deposit --amount 3 --network sepolia_testnet --recipient 0x20C4770A73DF5e2ab4B38c08d1055c2173034257 --message '[["address", "bytes"], ["0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891", "0x4955a3F38ff86ae92A914445099caa8eA2B9bA32"]]'

https://sepolia.etherscan.io/tx/0xf291232b1fa6b6e9dd9dbfc4c09b22f32ed9ca61e6f778e985ded1af1d43ee3d (opens in a new tab)

✅ Native gas token to TSS with multiple outputs

A single deposit and call transaction can result in multiple outbound transactions triggering outputs on multiple connected chains.

This is an example deposit and call of the example omnichain multioutput contract.

npx hardhat deposit --amount 4 --network sepolia_testnet --recipient 0xa573Df1F0729FE6F1BD69b0a5dbFE393e6e09f47 --message '[["address", "bytes", "bytes"], ["0x4955a3F38ff86ae92A914445099caa8eA2B9bA32", "0x746231713873687a663761666333726877386e367736656333327338683665326d727730373764306767", "0x000000000000000000000000d97b1de3619ed2c6beb3860147e30ca8a7dc989100000000000000000000000065a45c57636f9bcced4fe193a602008578bca90b"]]'

https://sepolia.etherscan.io/tx/0xce9386cff141cfe64d38589bdd6d2de843aa07559beea1cc3f3d002b47338711 (opens in a new tab)

❌ USDC with recipient and valid message

npx hardhat deposit --amount 1 --network sepolia_testnet --recipient 0x20C4770A73DF5e2ab4B38c08d1055c2173034257 --message '[["address", "bytes"], ["0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891", "0x4955a3F38ff86ae92A914445099caa8eA2B9bA32"]]' --erc20 0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238

https://sepolia.etherscan.io/tx/0xf680fa673a4077cec2e2d752260295375113a8c0525c74c5225fb2d2d73cb6d9 (opens in a new tab)

❌ Native gas token to TSS with recipient and invalid message

If an omnichain contract expects a specific message, an invalid message will trigger a contract revert, resulting in a reverted deposit.

npx hardhat deposit --amount 0.01 --network sepolia_testnet --recipient 0x20C4770A73DF5e2ab4B38c08d1055c2173034257

https://sepolia.etherscan.io/tx/0xecf2916c940a4fdf85f250ea822532bba92879cf615197ce3cdd2d9a1137a095 (opens in a new tab)

✅ Withdrawing native gas token ZRC-20 from ZetaChain

To withdraw native gas tokens ZRC-20 from ZetaChain to a connected chain, call the withdraw method of the ZRC-20 token contract on ZetaChain.

The withdraw amount must be higher than the withdraw fee. Each ZRC-20 token has its own withdraw fee.

npx hardhat withdraw --amount 0.1 --zrc20 0x05BA149A7bd6dC1F937fA9046A9e05C05f3b18b0 --network zeta_testnet

https://athens.explorer.zetachain.com/evm/tx/0x0013b02a9420109fe0bcedf4733c973d6113cd6e93b120406fadd52188814b21 (opens in a new tab)

✅ Withdrawing ERC-20 (USDC) ZRC-20 from ZetaChain

To withdraw ERC-20 ZRC-20 from ZetaChain to a connected chain, call the withdraw method of the ZRC-20 token contract on ZetaChain.

Withdraw fee for ERC-20 ZRC-20 is denominated in the connected chain's native gas token. For example, for ZRC-20 USDC from Ethereum the withdraw fee is denominated in ETH. The caller of with withdraw method must have enough native gas ZRC-20 (approved) to pay the withdraw fee.

npx hardhat withdraw --amount 1 --zrc20 0xcC683A782f4B30c138787CB5576a86AF66fdc31d --network zeta_testnet

https://athens.explorer.zetachain.com/evm/tx/0x540738849a6414809aeb0a9c959e3401b460aeae87c86bc9fd55bd6c1009b014 (opens in a new tab)

✅ ZETA Between Connected Chains

npx hardhat send-zeta --amount 3 --network mumbai_testnet --destination bsc_testnet

https://mumbai.polygonscan.com/tx/0x217300fc78a04eaf9c6217749b3e20aa99548771de48638b5016efae853c9368 (opens in a new tab)

❌ ZETA Between Connected Chains (insufficient amount)

npx hardhat send-zeta --amount 0.1 --network mumbai_testnet --destination bsc_testnet --ignore-checks

https://mumbai.polygonscan.com/tx/0x9132a994cbf536486c1354a6333e6d8f59156971888eebe8f74f882d48d16770 (opens in a new tab)

✅ ZETA to ZetaChain

npx hardhat send-zeta --amount 3 --network mumbai_testnet --destination zeta_testnet

https://mumbai.polygonscan.com/tx/0x40038e68d3f997952c302c95bcf10f841f8d3e960db3e71249ae0fe2b81a2e6f (opens in a new tab)

✅ ZETA from ZetaChain

npx hardhat send-zeta --amount 3 --network zeta_testnet --destination mumbai_testnet

https://athens.explorer.zetachain.com/cc/tx/0xa28ff75a237afcdc3a5ee7a8c79a4e813e899ab6d9b0c22d20e5cdf10e028a6a (opens in a new tab)

✅ Cross-chain messaging

https://goerli.etherscan.io/tx/0x681173b17e4ddc557d496114601845edf4666087027e77f33df7bffe4954619f (opens in a new tab)