Does opening a channel mean that a 2-to-2 multisig address (3xxxx) is created? And then both parties put money into the address? What if someone pays money to the address on main chain while the channel is open?
Does closing a channel mean that a transaction is made which splits the money based on agreement:
multisig: signature1,2(preTran) redeemscript
outputscript: pay to A pay to B
1 Answer
Does opening a channel mean that a 2-to-2 multisig address (3xxxx) is created?
Yes. But it's not always a 3...
address. Such addresses must be segwit, and there are two types: nested (3...
address) and native (bech32 addresses, bc1..
).
And then both parties put money into the address?
For now, only one party puts money into the address. But ideally both will be able to in the future. This is only done for simplicity right now.
What if someone pays money to the address on main chain while the channel is open?
It doesn't matter because Bitcoin does not use a balances or accounts system. Spending Bitcoin means that you are spending from a previous transaction output. So the commitment and closing transactions in a channel will refer to a specific transaction output. That output is completely unaffected by additional payments to an address. Likewise such payments will not effect the channel state.
Does closing a channel mean that a transaction is made which splits the money based on agreement
Yes. The money is split according to the most recent channel state, i.e. the balance of each party.