ECDH helps generate a shared secret between the sender and recipient, which is used to create a unique public key for each transaction, allowing for secure and private payments.