Payment channel enables stream of payments between 2 parties.
sender exchanges signatures offchain and receiver only needs to submitt a single transaction to finalize the payments.
- deploy the contract and get the hash of your message with function below :
msgHash(_amount)
open browser console and then :
- assign MsgHash with the value of msgHash(_amount)
MsgHash =
- enable metamask:
ethereum.enable()
- get connected account of your metamask :
ethereum.request({ method: 'eth_requestAccounts' }).then(function (accounts) {
CurrentAccount = accounts[0];
console.log('current account: ' + CurrentAccount);
});
- send a request to sign the message with metamask :
ethereum.request({method : "personal_sign" , params : [CurrentAccount, MsgHash]})