Difference between revisions of "On-chain transactions"

From lightningwiki.net
Jump to navigation Jump to search
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Transactions broadcast and processed by the [[Bitcoin]] blockchain.
This page lists and explains the transactions broadcast and processed by the [[Layer]]-1 [[ blockchain ]]. Currently Lightning implementations exist for the [[ Bitcoin ]] and [[ Litecoin ]] Layer-1 chains. But in the future Lightning implements might exist for many crypto currencies or blockchains. [[ On-chain ]] transactions refer to transactions permanently written to the Layer-1 blockchain (e.g. Bitcoin blockchain).


They are (much) slower than Lightning transactions, since you have to wait for block confirmation.
On-chain transactions are (much) slower than Lightning payments (payment transactions), since you have to wait for [[Bitcoin]] block confirmation. Payments on the Lightning Network are off-chain, i.e. they are not written to the Layer-1 blockchain.
 
To distinguish, operations on the [[Layer-1]] blockchain are often referred to as [[ transaction ]] and operations on the [[Layer-2]] Lightning Network as [[payments]].
 
Note, there are also concepts like [[ Cross-chain ]] transactions and [[ Side-chain ]] transactions which are not discussed on this page.
 
= [[Funding Transaction]] =
The Funding Transaction creates the channel. During this stage, funds are sent into a multisig address controlled by both Alice and Bob, the counterparties to the channel. This address can be funded as a single-payer channel or by both Alice and Bob. The [[Funding Transaction]] creates and signs a total of 3 transactions but only broadcasts one.
 
 
The one transaction that is broadcast funds the channel, and spends to a multisig output. It is signed by whomever chooses to fund the channel, Alice and/or Bob. When this [[Funding Transaction]] receives sufficient confirmation, the channel is considered open. The number of confirmations needed to be considered "sufficient" is configurable in the [[Lightning Network]].
 
The remaining two transactions that are created but not published are [[Commitment Transaction|Commitment Transactions]]. These are signed by both payment channel peers, e.g. Alice and Bob, and each peer stores its own [[Commitment Transaction|Commitment Transactions]] for later use in a possible future [[Closing Transaction|Closing Transaction]].
 
= [[Commitment Transaction]] =
A transaction that spends the funding transaction. Each peer holds the other peer's signature for this transaction, so that each always has a commitment transaction that it can spend. After a new commitment transaction is negotiated, the old one is revoked.
 
= [[Closing Transaction]] =
The Closing Transaction closes the channel. When broadcast, the [[multisig]] address spends the funds back to Alice and Bob according to their '''agreed-upon''' channel amount.
 
A [[Closing Transaction]] is always the result of a [[Closing channels|Mutual close]].
 
= [[Punishing Transaction]] =
In the case where either party attempts to defraud the other, a third transaction, which punishes the attacker, will end up being broadcasted on-chain. This is a unilateral transaction issued by the party that detects the possible [[fraud]].
 
Alice can attempt to defraud Bob by publishing an old, outdated [[Commitment Transaction]] that has a balance that favors Alice. By design this transaction will not be executed immediately but will be on hold. Bob now has time to see this published transaction and detect that it is fraudulent. Bob can now react to it by publishing a [[Punishing Transaction]]. This [[Punishing Transaction]] takes all the funds from Alice and gives them to Bob. This way, the attempted theft is punished by loss of funds and the funds are sent to the other party.
 
This fraud detection can be done by Bob's wallet or by a [[Watchtower]] used by Bob.

Latest revision as of 14:30, 15 February 2019

This page lists and explains the transactions broadcast and processed by the Layer-1 blockchain . Currently Lightning implementations exist for the Bitcoin and Litecoin Layer-1 chains. But in the future Lightning implements might exist for many crypto currencies or blockchains. On-chain transactions refer to transactions permanently written to the Layer-1 blockchain (e.g. Bitcoin blockchain).

On-chain transactions are (much) slower than Lightning payments (payment transactions), since you have to wait for Bitcoin block confirmation. Payments on the Lightning Network are off-chain, i.e. they are not written to the Layer-1 blockchain.

To distinguish, operations on the Layer-1 blockchain are often referred to as transaction and operations on the Layer-2 Lightning Network as payments.

Note, there are also concepts like Cross-chain transactions and Side-chain transactions which are not discussed on this page.

Funding Transaction

The Funding Transaction creates the channel. During this stage, funds are sent into a multisig address controlled by both Alice and Bob, the counterparties to the channel. This address can be funded as a single-payer channel or by both Alice and Bob. The Funding Transaction creates and signs a total of 3 transactions but only broadcasts one.


The one transaction that is broadcast funds the channel, and spends to a multisig output. It is signed by whomever chooses to fund the channel, Alice and/or Bob. When this Funding Transaction receives sufficient confirmation, the channel is considered open. The number of confirmations needed to be considered "sufficient" is configurable in the Lightning Network.

The remaining two transactions that are created but not published are Commitment Transactions. These are signed by both payment channel peers, e.g. Alice and Bob, and each peer stores its own Commitment Transactions for later use in a possible future Closing Transaction.

Commitment Transaction

A transaction that spends the funding transaction. Each peer holds the other peer's signature for this transaction, so that each always has a commitment transaction that it can spend. After a new commitment transaction is negotiated, the old one is revoked.

Closing Transaction

The Closing Transaction closes the channel. When broadcast, the multisig address spends the funds back to Alice and Bob according to their agreed-upon channel amount.

A Closing Transaction is always the result of a Mutual close.

Punishing Transaction

In the case where either party attempts to defraud the other, a third transaction, which punishes the attacker, will end up being broadcasted on-chain. This is a unilateral transaction issued by the party that detects the possible fraud.

Alice can attempt to defraud Bob by publishing an old, outdated Commitment Transaction that has a balance that favors Alice. By design this transaction will not be executed immediately but will be on hold. Bob now has time to see this published transaction and detect that it is fraudulent. Bob can now react to it by publishing a Punishing Transaction. This Punishing Transaction takes all the funds from Alice and gives them to Bob. This way, the attempted theft is punished by loss of funds and the funds are sent to the other party.

This fraud detection can be done by Bob's wallet or by a Watchtower used by Bob.