If you first create the channel, the very first thing Hitesh and Irene do is signal the preliminary commitments, which assigns the preliminary stability to themselves. That is what is named the refund, as a result of if one of many events resolve to not proceed, the cash returns to the homeowners. This transaction is a standard dedication transaction however is created as a result of if not, the funds might be locked ceaselessly on a multisig if one of many events of the channel disappears!
First two examples
The primary two examples are dedication transactions created. Every consumer creates one dedication transaction with two outputs. In these, each Hitesh and Irene have two outputs:
- The primary output is a fee to the opposite particular person of the preliminary
stability (5 BTC). - The second output is a fee to the identical particular person making the
dedication however with alocktime
of1000 blocks
. (Thelocktime goes
there, not within the refund!)
This dedication will not be broadcasted, every one of many events has his personal model. Every one of many events at any second can signal it and broadcast it. In that case the opposite particular person would obtain the 5 BTC immediately and the particular person chargeable for the printed must wait1000 blocks
.
Word that this dedication transactions are incomplete because the penalty mechanism is lacking in case some occasion tries to cheat. Within the e book they present this uncompleted model to present an concept of the way it appears to be like
Third instance
This final instance exhibits tips on how to create an actual dedication transaction with the penalty mechanism included.
It provides a situation which permits a consumer to retrieve the funds of the second output if it has the revocation non-public key. The revocation key’s a key which each events can calculate the general public key, however they will solely get half of the non-public key. So that they solely have half of the non-public key. If at any second, one of many two customers has the 2 halfs of the non-public key, it might declare the funds within the second output.
If the channel state is up to date and a brand new dedication transaction is created, they trade their half of the revocation non-public key. This offers them the safety that if the opposite particular person cheats and broadcast an outdated dedication transaction, the sufferer will have the ability to declare the opposite particular person the funds as a punishment.
Think about Hitesh tries to cheat; since Irene can declare his 5 BTC immediately (output 1), and Hitesh has to attend 1000 blocks
to get the 5 BTC, Irene can declare Hitesh cash as she has the complete revocation non-public key (that is the brand new situation we added within the third instance).
Word that if Irene does not declare the funds earlier than 1000 blocks
Hitesh will have the ability to proceed and declare himself the cash.
Abstract
In order a abstract, dedication transactions appear like the third instance because the penalty mechanism is required. Refund transaction is simply the primary dedication transaction that simply returns the funds to the customers. The penalty mechanism can also be wanted there as a result of if you happen to do not add it you may cheat and steal cash by broadcasting the refund transaction sooner or later when the channel state has superior.