There are different blockchains built to serve different kind of users and use-cases. Bitcoin is for peer to peer transfer of currency while Ethereum is a smart contracts platform. Flow is for NFTs while ZCash is for private transactions. What if applications and users on these blockchains need to interact or integrate with each other?
Imagine a use-case where a smart contract on Ethereum, on successful execution, needs to transfer some bitcoin from one account to another on the Bitcoin blockchain.
This is where blockchain bridges come into the picture. Bridge allow message passing between two blockchains. Using a bridge, a user on one blockchain could move their assets or token to an account on a different blockchain. The way it works is by locking or burning assets on the source chain and then minting them on the destination chain. The communication to mint the assets on the destination chain is done via messages sent over bridges.
Simply put, bridges deploy smart contracts on both source and destination chains and have message relayer software in between the two chains. The user takes action on the source chain smart contract which emits an event. Based on the event the message relayer relays a message to the destination chain. The smart contract on the destination chain then executes the logic on the destination chain based on the message received.
Bridges have different kinds of security models. Trusted and trustless. In trusted bridges, some third parties operate relayer nodes and bridging smart contracts on either side. The users and DApps have to rely on the honesty of these third parties. In trustless bridges, the state of either side (chains) is verified using smart contracts and the dependency on third parties is minimal.