Two-way pegs facilitate the transfer of digital assets or tokens between sidechains and the main blockchain. Assets or coins from the mainnet are sent to the sidechain via a locking mechanism. This prevents the assets from being spent before the transaction has been finalized.