Search code examples
blockchainethereumsoliditybinance-smart-chainbinance-chain

Is there a way to check if the transactions are happening on binance smart chain network or ethereum smart chain?


I'm new to block chain development and developing a DApp on binance smart chain. I changed the network from default ethereum web provider to binance test network provider. DApp is working fine but I want the affirmation that my transaction are happening on binance test network. Is there a way to check if the transaction is happening on binance smart chain network or ethereum network? Thanks a ton


Solution

  • Web3 connection has a method that allows you to ask chainId of the currently connected blockchain.

    See Chainlist for full details.