> For the complete documentation index, see [llms.txt](https://docs.zam.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zam.io/ecosystem/web-dapps/bridge-eth-bsc.md).

# Bridge ETH-BSC

![ETH BSC Swap Contracts are responsible for registering swap pairs and swapping assets between ETH and BSC.](/files/sfiia4Z9EXpKHJXjko02)

{% embed url="<https://zam.io/bridge>" %}

$ZAM is Zam.io’s native utility token that is intended to act as a universal cross-chain bridge between CeFi and DeFi. The token has cross-chain support on two of the world’s most popular blockchains: Ethereum (ETH) and Binance Smart Chain (BSC). With time, $ZAM token will have cross-chain support on more blockchains.

### **How does Zam.io’s cross-chain bridge work?**

Smart contracts have a pivotal role in the operation of the cross-chain bridge. Similar to a decentralized stablecoin, the cross-chain bridge transactions are controlled by smart contracts (ETH BSC Swap Contracts) that are in charge of recording the swap pairs and exchanging ETH assets with BSC assets and vice versa.

<figure><img src="/files/3Fu2X2qur8drXizFPrKv" alt=""><figcaption></figcaption></figure>

### Register swap pair

1. Users register swap pair for erc20 token on ETH via ETHSwapAgent(`createSwapPair`) if token is not registered.
2. Swap service will monitor the `SwapPairRegister` event and create swap pair on BSC:
   1. create an BEP20 token on BSC
   2. record the relation between erc20 token and bep20 token.

### Swap from ETH to BSC

Once swap pair is registered, users can swap tokens from ETH to BSC.

1. Users call `swapBSC2ETH` via ETHSwapAgent and specify erc20 token address, amount and swap fee.
2. Swap service will monitor the `SwapStarted` event and call `fillETH2BSCSwap` via BSCSwapAgent to mint corresponding bep20 tokens to the same address that initiate the swap.

### Swap from BSC to ETH

Once swap pair is registered, users can swap tokens from BSC to ETH.

1. Users call `swapBSC2ETH` via BSCSwapAgent and specify bep20 token address, amount and swap fee. Bep20 tokens will be burned.
2. Swap service will monitor the `SwapStarted` event and call `fillBSC2ETHSwap` via BSCSwapAgent to transfer corresponding erc20 tokens to the same address that initiate the swap.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.zam.io/ecosystem/web-dapps/bridge-eth-bsc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
