cedricfung (OP)
Jr. Member
Offline
Activity: 41
Merit: 17
|
 |
March 02, 2023, 05:16:26 AM Last edit: March 02, 2023, 01:34:55 PM by cedricfung |
|
I'm working on a wallet solution to use 2/3 multisig with timelock. A and B can spend the UTXO together before the timelock, but C can only spend the UTXO with A or B after the timelock expires. So I wrote the script as below, is it correctly implemented as the requirement? OP_IF 2 OP_ELSE 4194311 OP_CHECKSEQUENCEVERIFY OP_DROP key_C OP_CHECKSIGVERIFY 1 OP_ENDIF key_A key_B 2 OP_CHECKMULTISIG
Thank you
|
|
|
|
|
|
Bitcoin mining is now a specialized and very risky industry, just like gold mining. Amateur miners are unlikely to make much money, and may even lose money. Bitcoin is much more than just mining, though!
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
|
pooya87
Legendary
Offline
Activity: 3094
Merit: 8944
|
 |
March 02, 2023, 11:49:04 AM |
|
Looks correct to me but you can always test things like this on the TestNet to be more sure, specially when it comes to setting the time value in the timelock. Also what you called "OP_PUSHNUM_2" and "OP_PUSHNUM_1" should be OP_2 and OP_1 respectively with 0x52 and 0x51 as their byte representations.
|
. ..WHIRLWIND.. | █████████████████████████ ████████▄▄▀▀▀▀▀▄▄████████ █████▄██▀▀▄▄▀▀▀▄▄▄███████ ██████▀███▀▄▀██▄▄▄▀▀▄████ █████▀█████████▄▄█▀▄▀████ █████████████████████████ █████████████████████████ █████████████████████████ █████▄█████████▀▀█▄▀▄████ ██████▄███▄▀▄██▀▀▀▄▄▀████ █████▀██▄▄▀▀▄▄▄▀▀▀███████ ████████▀▀▄▄▄▄▄▀▀████████ █████████████████████████ | . .. No Fee ......Ultimate Privacy | | | | | | | . ...MIX NOW... |
|
|
|
|
cedricfung (OP)
Jr. Member
Offline
Activity: 41
Merit: 17
|
 |
March 02, 2023, 01:26:02 PM |
|
For the nSequence value in the miniscript example, it's using relative block number instead of time, that's why it's such a small number.
|
|
|
|
Jason Brendon
Member

Offline
Activity: 116
Merit: 64
|
 |
March 13, 2023, 06:39:32 AM |
|
very impressive. But can people tell all the spend conditions from the blockchain?
|
|
|
|
ETFbitcoin
Legendary
Offline
Activity: 2520
Merit: 6232
DO NOT store your coin on third-party service!
|
 |
March 13, 2023, 12:37:19 PM |
|
very impressive. But can people tell all the spend conditions from the blockchain?
For P2WSH and P2SH, everyone will know spend condition/redeem script after the coin has been spent. If you don't want that, consider P2TR instead.
|
|
|
|
Jason Brendon
Member

Offline
Activity: 116
Merit: 64
|
 |
March 14, 2023, 06:44:38 AM |
|
very impressive. But can people tell all the spend conditions from the blockchain?
For P2WSH and P2SH, everyone will know spend condition/redeem script after the coin has been spent. If you don't want that, consider P2TR instead. taproot? what wallet can send coins from taproot addresses to others?
|
|
|
|
NotATether
Legendary
Offline
Activity: 1246
Merit: 5334
Defend Bitcoin and its PoW: bitcoincleanup.com
|
 |
March 14, 2023, 07:20:30 AM |
|
In the timelock branch: key_C OP_CHECKSIGVERIFY 1 OP_ENDIF key_A key_B 2 OP_CHECKMULTISIG
You would have to put C's signature in the last cosigner of the output in order for the script to work properly, correct? Other than that, this script looks well-formed to me. taproot? what wallet can send coins from taproot addresses to others?
Sparrow Wallet can do that. I think maybe Bitcoin Core can do that now too, because Ordinals claim to use that feature. And it's always possible to construct Taproot transactions with spend paths by hand if you are sufficiently masochist 
|
|
|
|
cedricfung (OP)
Jr. Member
Offline
Activity: 41
Merit: 17
|
 |
March 14, 2023, 09:25:35 AM |
|
In the timelock branch: key_C OP_CHECKSIGVERIFY 1 OP_ENDIF key_A key_B 2 OP_CHECKMULTISIG
You would have to put C's signature in the last cosigner of the output in order for the script to work properly, correct? Yes, when timelock expired, to spend the output with key_C, the script is like <empty> sig_A sig_C <empty> WITNESS
Is this correct?
|
|
|
|
ETFbitcoin
Legendary
Offline
Activity: 2520
Merit: 6232
DO NOT store your coin on third-party service!
|
 |
March 14, 2023, 10:30:40 AM |
|
o me. taproot? what wallet can send coins from taproot addresses to others?
Sparrow Wallet can do that. I think maybe Bitcoin Core can do that now too, because Ordinals claim to use that feature. And it's always possible to construct Taproot transactions with spend paths by hand if you are sufficiently masochist  I just checked my Bitcoin Core (v24.0.1) and it has Taproot support which can be generated on tab "Receive" and choose "Bech32m (Taproot)" on drop-down list. But for custom scripting, i expect you'll need to use CLI and create script manually. And for information purpose, Wasabi wallet also support Taproot although IIRC it lacks some feature for power user.
|
|
|
|
cedricfung (OP)
Jr. Member
Offline
Activity: 41
Merit: 17
|
 |
March 14, 2023, 12:16:11 PM |
|
I just checked my Bitcoin Core (v24.0.1) and it has Taproot support which can be generated on tab "Receive" and choose "Bech32m (Taproot)" on drop-down list. But for custom scripting, i expect you'll need to use CLI and create script manually. And for information purpose, Wasabi wallet also support Taproot although IIRC it lacks some feature for power user.
I think no wallets support real custom scripting yet, at least Bitcoin Core is only able to watch those custom script address, can't spend from them.
|
|
|
|
ETFbitcoin
Legendary
Offline
Activity: 2520
Merit: 6232
DO NOT store your coin on third-party service!
|
 |
March 14, 2023, 01:08:39 PM |
|
I just checked my Bitcoin Core (v24.0.1) and it has Taproot support which can be generated on tab "Receive" and choose "Bech32m (Taproot)" on drop-down list. But for custom scripting, i expect you'll need to use CLI and create script manually. And for information purpose, Wasabi wallet also support Taproot although IIRC it lacks some feature for power user.
I think no wallets support real custom scripting yet, at least Bitcoin Core is only able to watch those custom script address, can't spend from them. But since Bitcoin Core support Output Descriptors[1], spending should be possible[2] if you know how to convert the script into descriptors. Although it's still not real custom scripting since AFAIK descriptors due to limited support of opcodes. [1] https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md[2] https://bitcoin.stackexchange.com/a/99541
|
|
|
|
cedricfung (OP)
Jr. Member
Offline
Activity: 41
Merit: 17
|
 |
March 14, 2023, 02:08:25 PM |
|
I just checked my Bitcoin Core (v24.0.1) and it has Taproot support which can be generated on tab "Receive" and choose "Bech32m (Taproot)" on drop-down list. But for custom scripting, i expect you'll need to use CLI and create script manually. And for information purpose, Wasabi wallet also support Taproot although IIRC it lacks some feature for power user.
I think no wallets support real custom scripting yet, at least Bitcoin Core is only able to watch those custom script address, can't spend from them. But since Bitcoin Core support Output Descriptors[1], spending should be possible[2] if you know how to convert the script into descriptors. Although it's still not real custom scripting since AFAIK descriptors due to limited support of opcodes. [1] https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md[2] https://bitcoin.stackexchange.com/a/99541Bitcoin Core supports custom script with output descriptors, that's the miniscript from blockstream, it has full capability to support all popular opcodes. But still, most of output descriptors support in Bitcoin Core are limited to watch only, the core devs have some ongoing issues to solve this. https://github.com/bitcoin/bitcoin/pull/24149 This PR makes miniscript completely solvable in Bitcoin Core, merged last month, and it's just the miniscript support in the code level, not full bitcoin-cli support yet, maybe in a few months.
|
|
|
|
cedricfung (OP)
Jr. Member
Offline
Activity: 41
Merit: 17
|
 |
Today at 12:04:15 PM |
|
Now it looks like full descriptors support arrived with Bitcoin Core 25.0 https://github.com/bitcoin/bitcoin/releases/tag/v25.0So now I'm going to use this descriptor script to achieve the same goal. wsh(thresh(2,pk(A),s:pk(B),sj:and_v(v:pk(C),n:older(1728))))
|
|
|
|
cedricfung (OP)
Jr. Member
Offline
Activity: 41
Merit: 17
|
 |
Today at 12:06:40 PM |
|
This produces the asm A OP_CHECKSIG OP_SWAP B OP_CHECKSIG OP_ADD OP_SWAP OP_SIZE OP_0NOTEQUAL OP_IF C OP_CHECKSIGVERIFY 1728 OP_CHECKSEQUENCEVERIFY OP_0NOTEQUAL OP_ENDIF OP_ADD 2 OP_EQUAL
|
|
|
|
|