> For the complete documentation index, see [llms.txt](https://docs.blocto.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blocto.app/~/changes/lJG0Ie43hDo96Dq7BMVa/blocto-app/web3-provider/switch-chain.md).

# Switch Chain

Switch the blockchain network to another one

### Introduction

It supports Ethereum/BSC/Polygon/Avalanche injected at `window.ethereum`. Blocto follows [eip-3326](https://github.com/rekmarks/EIPs/blob/3326-create/EIPS/eip-3326.md) and will not reload the webpage after switching the network.

### Usage

```javascript
// Switch to BSC
const params = [{ chainId: '0x38' }]
await window.ethereum.request({
  method: 'wallet_switchEthereumChain',
  params: params
})
```

Switching network will emit a `chainChanged` event.

```javascript
window.ethereum.on('chainChanged', (chainId) => {
  console.log(chainId) // 0x38 if it's BSC
})
```
