Benjamin Weintraub [ARCHIVE] on Nostr: π Original date posted:2023-04-27 π Original message: Hi all, I have a question ...
π
Original date posted:2023-04-27
π Original message:
Hi all,
I have a question about commitments. If a peer force closes a channel by sending a commitment to the blockchain, what kind of witness script is needed to redeem the `to_local` funds? (assuming the `to_self_delay` has elapsed.) It seems that the transaction described here is for cooperative closures: https://github.com/lightning/bolts/blob/c74a3bbcf890799d343c62cb05fcbcdc952a1cf3/03-transactions.md#closing-transaction. But for force closures, I would think that the txin would need to be the `to_local` txout of the commitment.
Concretely, I have commited the following transaction on a local simnet bitcoin blockchain and mined 500 blocks on top of it. I want to spend vout[2], how can I generate such a transaction?
{
"hash": "47d15337bb3c29c7c2881dd7cd912604b401ed221c66ea6f781b456d4983d451",
"size": 444,
"vsize": 279,
"weight": 1113,
"version": 2,
"locktime": 551351761,
"vin": [
{
"txid": "0248025b9447df8267d02d14c34ab9b269f52cd827132c70159a55cbf27ab3c1",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"txinwitness": [
"",
"3045022100d3f52ca04d6a71587c29592931e542b16a47f3e9e577f1869b416547d00c62dd0220485da35ad31ff71b4263b1a25f0ba9f35990e1c8d5ac848365bbd588c3ce83d701",
"3044022057fc3878e17a865c12d57b7885ed48f0d6122bd9e00511c8eac150180d1508d502205fd1d0674a41b3c0118d0b6c19b1c77d35fc95bb89f929da6478f22e94dbf5ce01",
"5221038acdafe305edd06e91706ee687a091be306f0f29bcbda52dadde084bbaa36c902103d8fd53b9b43638c2255e1abd6f134a0232d2fba65527252c4eb81f926ddf50ad52ae"
],
"sequence": 2161061453
}
],
"vout": [
{
"value": 0.0000033,
"n": 0,
"scriptPubKey": {
"asm": "0 45ec86244376d47000ca6592783ba26f6b2ae619a24c8f5fad249b8c716955d6",
"hex": "002045ec86244376d47000ca6592783ba26f6b2ae619a24c8f5fad249b8c716955d6",
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"sb1qghkgvfzrwm28qqx2vkf8swazda4j4ese5fxg7hadyjdccutf2htqysq3qz"
]
}
},
{
"value": 0.0000033,
"n": 1,
"scriptPubKey": {
"asm": "0 502a17644b334482d0a3f589d9861af6e2105a9b7afd3f5c258efc98bb6aeeed",
"hex": "0020502a17644b334482d0a3f589d9861af6e2105a9b7afd3f5c258efc98bb6aeeed",
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"sb1q2q4pweztxdzg959r7kyanps67m3pqk5m0t7n7hp93m7f3wm2amksa0fysc"
]
}
},
{
"value": 0.0002,
"n": 2,
"scriptPubKey": {
"asm": "0 045553fc789494f16eff4cfa221d0294e140fb79772efeb7d8397d0ac1c4cf85",
"hex": "0020045553fc789494f16eff4cfa221d0294e140fb79772efeb7d8397d0ac1c4cf85",
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"sb1qq3248lrcjj20zmhlfnazy8gzjns5p7mewuh0ad7c897s4swye7zsyrm5pc"
]
}
},
{
"value": 0.009761,
"n": 3,
"scriptPubKey": {
"asm": "0 2d51ca420d0b6ab56c97ca2631d7304c9ad9025252ea71f3af8f97361679042e",
"hex": "00202d51ca420d0b6ab56c97ca2631d7304c9ad9025252ea71f3af8f97361679042e",
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"sb1q94gu5ssdpd4t2myhegnrr4esfjddjqjj2t48rua037tnv9neqshqm4z7yr"
]
}
}
],
"blockhash": "0fa78bc7e9f6e0a60be71bb5fb2eaaf42a97895bb057f09d7cbb2c49120fa61d",
"confirmations": 500,
"time": 1682451410,
"blocktime": 1682451410
}
Thanks in advance,
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20230427/d0c110bb/attachment-0001.html>
π Original message:
Hi all,
I have a question about commitments. If a peer force closes a channel by sending a commitment to the blockchain, what kind of witness script is needed to redeem the `to_local` funds? (assuming the `to_self_delay` has elapsed.) It seems that the transaction described here is for cooperative closures: https://github.com/lightning/bolts/blob/c74a3bbcf890799d343c62cb05fcbcdc952a1cf3/03-transactions.md#closing-transaction. But for force closures, I would think that the txin would need to be the `to_local` txout of the commitment.
Concretely, I have commited the following transaction on a local simnet bitcoin blockchain and mined 500 blocks on top of it. I want to spend vout[2], how can I generate such a transaction?
{
"hash": "47d15337bb3c29c7c2881dd7cd912604b401ed221c66ea6f781b456d4983d451",
"size": 444,
"vsize": 279,
"weight": 1113,
"version": 2,
"locktime": 551351761,
"vin": [
{
"txid": "0248025b9447df8267d02d14c34ab9b269f52cd827132c70159a55cbf27ab3c1",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"txinwitness": [
"",
"3045022100d3f52ca04d6a71587c29592931e542b16a47f3e9e577f1869b416547d00c62dd0220485da35ad31ff71b4263b1a25f0ba9f35990e1c8d5ac848365bbd588c3ce83d701",
"3044022057fc3878e17a865c12d57b7885ed48f0d6122bd9e00511c8eac150180d1508d502205fd1d0674a41b3c0118d0b6c19b1c77d35fc95bb89f929da6478f22e94dbf5ce01",
"5221038acdafe305edd06e91706ee687a091be306f0f29bcbda52dadde084bbaa36c902103d8fd53b9b43638c2255e1abd6f134a0232d2fba65527252c4eb81f926ddf50ad52ae"
],
"sequence": 2161061453
}
],
"vout": [
{
"value": 0.0000033,
"n": 0,
"scriptPubKey": {
"asm": "0 45ec86244376d47000ca6592783ba26f6b2ae619a24c8f5fad249b8c716955d6",
"hex": "002045ec86244376d47000ca6592783ba26f6b2ae619a24c8f5fad249b8c716955d6",
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"sb1qghkgvfzrwm28qqx2vkf8swazda4j4ese5fxg7hadyjdccutf2htqysq3qz"
]
}
},
{
"value": 0.0000033,
"n": 1,
"scriptPubKey": {
"asm": "0 502a17644b334482d0a3f589d9861af6e2105a9b7afd3f5c258efc98bb6aeeed",
"hex": "0020502a17644b334482d0a3f589d9861af6e2105a9b7afd3f5c258efc98bb6aeeed",
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"sb1q2q4pweztxdzg959r7kyanps67m3pqk5m0t7n7hp93m7f3wm2amksa0fysc"
]
}
},
{
"value": 0.0002,
"n": 2,
"scriptPubKey": {
"asm": "0 045553fc789494f16eff4cfa221d0294e140fb79772efeb7d8397d0ac1c4cf85",
"hex": "0020045553fc789494f16eff4cfa221d0294e140fb79772efeb7d8397d0ac1c4cf85",
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"sb1qq3248lrcjj20zmhlfnazy8gzjns5p7mewuh0ad7c897s4swye7zsyrm5pc"
]
}
},
{
"value": 0.009761,
"n": 3,
"scriptPubKey": {
"asm": "0 2d51ca420d0b6ab56c97ca2631d7304c9ad9025252ea71f3af8f97361679042e",
"hex": "00202d51ca420d0b6ab56c97ca2631d7304c9ad9025252ea71f3af8f97361679042e",
"reqSigs": 1,
"type": "witness_v0_scripthash",
"addresses": [
"sb1q94gu5ssdpd4t2myhegnrr4esfjddjqjj2t48rua037tnv9neqshqm4z7yr"
]
}
}
],
"blockhash": "0fa78bc7e9f6e0a60be71bb5fb2eaaf42a97895bb057f09d7cbb2c49120fa61d",
"confirmations": 500,
"time": 1682451410,
"blocktime": 1682451410
}
Thanks in advance,
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20230427/d0c110bb/attachment-0001.html>