I came across the Micropayments channel example in the solidity docs (here: https://solidity.readthedocs.io/en/v0.6.6/solidity-by-example.html#micropayment-channel). There are two cases presented with two contracts: SimplePaymentsChannel and ReceiverPays. I am trying to reconcile how one is different from the other, given that they both seem to accomplish the same thing. The steps outlined for each contract are below, verbatim:
ReceiverPays
Alice deploys the ReceiverPays contract, attaching enough Ether to cover the payments that will be made.
Alice authorises a payment by signing a message with their private key.
Alice sends the cryptographically signed message to Bob. The message does not need to be kept secret (explained later), and the mechanism for sending it does not matter.
- Bob claims their payment by presenting the signed message to the smart contract, it verifies the authenticity of the message and then releases the funds.
Micropayments Channel
Alice funds a smart contract with Ether. This “opens” the payment channel.
Alice signs messages that specify how much of that Ether is owed to the recipient. This step is repeated for each payment.
Bob “closes” the payment channel, withdrawing their portion of the Ether and sending the remainder back to the sender.
Other than some minor differences like contract expiration and usage of nonce, what is the need to have two contracts that achieve essentially the same thing? Thank you.