I have been playing around with state channels and am starting to see the power of signing information/transactions, but haven't got a completely clear idea of what I can do with them. I think I can do the following, and would really appreciate, clarification, extra thoughts, and where I am just plain ol' wrong!
- Signing a payment but not sending it to the blockchain, but instead sending it to someone else to then send to the blockchain.
The signed transaction acts like a cheque(GB)/check(US). I sign a payment, but instead of sending the data to the blockchain, can I send that to the person I owe money to, and they send it to the blockchain, and therefore they pay the transaction fee, a bit like how a state channel sends the signed message to the other party, without going via the blockchain at all.
- Signing a payment, but in doing so cancelling an old one.
Imagine I do the above, but then before the recipient of the signed transaction commits it to the blockchain, I owe them more money. So I sign a new transaction that is the total of the original + the new money I owe. Is there an implementation I can use to mean that the old transaction wouldn't work if they submit the new one (or vice versa?) - I'm vaguely thinking nonces/sequence numbers or something. I can't quite visualise it, but I know that with state channels for say a game of chess if I submit a move to the blockchain, I can't submit previous ones based on sequence number. What about future ones....? Any quirky approaches here?
- Paying the transaction fees on behalf of a signed transaction
If I sign a transaction but send it to someone else, rather than to the blockchain so they can submit it, who pays the transaction fee? The person who paid sent the transaction, or the person who signed the transaction?
- Signing a transaction to deploy a contract
Imagine I have a contract that hasn't been deployed to the blockchain. Someone else wants to submit it so that they are the contract owner. Can they sign a transaction that means that I can deploy that contract on their behalf? If so, whats the mechanism here? The benefit being they pay for the contract to be deployed, rather than me. Or is the only way, if I don't have their private key, for me to deploy it and transfer ownership to them?
- If I have money in my wallet, and I want to buy something on a smart contract on behalf of someone else, who has no money in their wallet, can they sign a transaction and send it to me, so that I can send it to the contract and pay the costs myself, but they will be registered on the blockchain as the payer. I realise this may not show up in the transaction as them being the person who paid, but from the perspective of the smart contract, lets say there is a
payablefunction, I pay that function, but the function records within the contract their address (perhaps their address is in the data field of the transaction) - is there a standard approach to this?