A peer-to-peer exchange, also known as an atomic swap, is a kind of transaction that enables two users to trade…