0

X and Y locked up 1 ETH each on-chain.

Balance: X (1 ETH) & Y (1 ETH).

X signed off-chain Tx sending 0.1 ETH to Y.

Balance: X (0.9) & Y (1.1).

X signed off-chain Tx sending 0.2 ETH to Y.

Balance: X (0.7) & Y (1.3).

Y signed off-chain Tx sending 0.5 ETH to X.

Balance: X (1.2) & Y (0.8).

Now, if we send all 3 of above off-chain tx on blockchain, it will consume similar gas as if we had send them at the time of signing the tx. How does it reduce the cost?

And if X and Y are signing a new balance status of both the party everytime then what prevents them from uploading the previously off-chain transaction (which doesn't reflect the actual balance) to blockchain?

What if I signed an off-chain with nonce 102 and then make an seperate on-chain transaction with nonce 102? The off-chain signed tx will become obsolete because same nonce tx are consider invalid.

Please clarify.

1

Now, if we send all 3 of above off-chain tx on blockchain, it will consume similar gas as if we had send them at the time of signing the tx. How does it reduce the cost?

You only send the last off-chain transaction.

And if X and Y are signing a new balance status of both the party everytime then what prevents them from uploading the previously off-chain transaction (which doesn't reflect the actual balance) to blockchain?

both parties have to submit their version of the last transaction, the one with the most recent nonce will be taken as valid (in some cases the cheater will be punished). Also once one of the parties submit the transaction to close the channel the other user has a fixed amount of time to submit his/her version of the last transaction (hours, days, etc)

What if I signed an off-chain with nonce 102 and then make an seperate on-chain transaction with nonce 102? The off-chain signed tx will become obsolete because same nonce tx are consider invalid.

One of these transactions will fail in the sceneario you describe. However there is no reason or requirement to make the nonce on the off-chain, equal or consistent with the nonce of the users accounts in main network.

Here is the "Awesome State Channels" list for more info.

Hope this helps

  • "most recent nonce will be taken as valid" - what if all the off chain tx are signed with similar nonce. – Sowmay Jain May 20 '18 at 4:38
  • "no requirement to make the nonce on the off-chain" - miners mine tx based on the nonce value. The off chain tx must contains the nonce else it will not be considered valid. Isn't it? – Sowmay Jain May 20 '18 at 4:39
  • I updated the answer with some reading material and videos. In ethereum this is done with smart contracts, at least the implementations that I know, so these off-chain transactions are not broadcasted as they are. You basically will submit the transactions to a smart contract and the smart contract will send the final balances to the users. I actually implemented a bidirectional off-chain payment/data channel that doesn't use nonces. So these are not are requirement to do this work – Jaime May 20 '18 at 9:42
  • Very thanks for the materials. The nonce which is used to validate the most recent offchain tx is different from nonce of onchain tx, right? How you check the most recent tx in your bidirectional offchain project? – Sowmay Jain May 21 '18 at 8:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.