Bitcoin Forum
May 03, 2024, 05:53:00 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Tutorial] How to use OP_CHECKSIG + Taproot to spend 1-of-n puzzles  (Read 94 times)
cmpeq (OP)
Copper Member
Jr. Member
*
Offline Offline

Activity: 33
Merit: 152


View Profile WWW
February 11, 2024, 05:51:24 PM
 #1

I noticed that recently there have been some questions about properly constructing signatures for OP_CHECKSIG in P2TR, so decided to make a video for the curious.

This technique can be useful for creating puzzle/other challenges (pay to ZKP =D) that cannot be frontran by folks monitoring the mempool (one unique challenge per public key/tapscript path).




Scripts from the video

Setup
Code:
docker pull qedprotocol/bitide:latest
docker run -p 1337:1337 -it --rm qedprotocol/bitide:latest


user_1_lock.basm
Code:
/*
note that the dummy signature "?2742ce32de496f3d51ddd8b57cee513e982ef66adb51324343a9ec2516281093"
can be used to test OP_CHECKSIG in the editor, but must be removed in the tapscript runner witness input before unlocking the UTXO
*/

<"?2742ce32de496f3d51ddd8b57cee513e982ef66adb51324343a9ec2516281093">
<"some other secret value">

END_EXAMPLE_WITNESS

OP_HASH160
<0xda70d9c91368cc32d8bdaf0dd82f53c07272fd17>
OP_EQUALVERIFY

<0x2742ce32de496f3d51ddd8b57cee513e982ef66adb51324343a9ec2516281093> // public key 1
OP_CHECKSIG


user_2_lock.basm
Code:
// to make a dummy signature for any public key just push a string to the stack containing a question mark followed by the hex encoded public key (x only/last 32 bytes)
<"?bee908511ef6d1c5d99ca33ea0db1fbbf313a5c3c08471702595eae888ff012b">
<"super secret value">
END_EXAMPLE_WITNESS
OP_HASH160

<0x32cac4959b6bc4aad4bc65fc7b4eab19506359b2>
OP_EQUALVERIFY

<0xbee908511ef6d1c5d99ca33ea0db1fbbf313a5c3c08471702595eae888ff012b> // public key 2
OP_CHECKSIG


Would love any feedback on other tutorials anyone may want to see or how things could be made easier to bring in newer bitcoin devs (maybe a button to generate/download a standalone js project that automates the tx with bitcoinjs?).

founder of QED
find me on twitter @cmpeq
1714758780
Hero Member
*
Offline Offline

Posts: 1714758780

View Profile Personal Message (Offline)

Ignore
1714758780
Reply with quote  #2

1714758780
Report to moderator
1714758780
Hero Member
*
Offline Offline

Posts: 1714758780

View Profile Personal Message (Offline)

Ignore
1714758780
Reply with quote  #2

1714758780
Report to moderator
1714758780
Hero Member
*
Offline Offline

Posts: 1714758780

View Profile Personal Message (Offline)

Ignore
1714758780
Reply with quote  #2

1714758780
Report to moderator
Transactions must be included in a block to be properly completed. When you send a transaction, it is broadcast to miners. Miners can then optionally include it in their next blocks. Miners will be more inclined to include your transaction if it has a higher transaction fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
BookerE1
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
February 19, 2024, 09:22:43 AM
 #2

I noticed that recently there have been some questions about properly constructing signatures for OP_CHECKSIG in P2TR, so decided to make a video for the curious.

This technique can be useful for creating puzzle/other challenges (pay to ZKP =D) that cannot be frontran by folks monitoring the mempool (one unique challenge per public key/tapscript path).

https://publications.qedprotocol.com/bitide/op_checksig_tutorial.png


Scripts from the video

Setup
Code:
docker pull qedprotocol/bitide:latest
docker run -p 1337:1337 -it --rm qedprotocol/bitide:latest


user_1_lock.basm
Code:
/*
note that the dummy signature "?2742ce32de496f3d51ddd8b57cee513e982ef66adb51324343a9ec2516281093"
can be used to test OP_CHECKSIG in the editor, but must be removed in the tapscript runner witness input before unlocking the UTXO
*/

<"?2742ce32de496f3d51ddd8b57cee513e982ef66adb51324343a9ec2516281093">
<"some other secret value">

END_EXAMPLE_WITNESS

OP_HASH160
<0xda70d9c91368cc32d8bdaf0dd82f53c07272fd17>
OP_EQUALVERIFY

<0x2742ce32de496f3d51ddd8b57cee513e982ef66adb51324343a9ec2516281093> // public key 1
OP_CHECKSIG


user_2_lock.basm
Code:
// to make a dummy signature for any public key just push a string to the stack containing a question mark followed by the hex encoded public key (x only/last 32 bytes)
<"?bee908511ef6d1c5d99ca33ea0db1fbbf313a5c3c08471702595eae888ff012b">
<"super secret value">
END_EXAMPLE_WITNESS
OP_HASH160

<0x32cac4959b6bc4aad4bc65fc7b4eab19506359b2>
OP_EQUALVERIFY

<0xbee908511ef6d1c5d99ca33ea0db1fbbf313a5c3c08471702595eae888ff012b> // public key 2
OP_CHECKSIG


Would love any feedback on other tutorials anyone may want to see or how things could be made easier to bring in newer bitcoin devs (maybe a button to generate/download a standalone js project that automates the tx with bitcoinjs?).

Hello,

I see that you are interested in bitcoin development and have shared some scripts for creating signatures for OP_CHECKSIG in P2TR. That’s very impressive and informative.
I found some relevant resources that might be useful for you or other bitcoin enthusiasts:

* Bitcoin Forum https://bitcointalk.org/index.php - Index This is a forum where you can discuss various aspects of bitcoin, such as development, technical support, mining, trading, speculation, and more. You can also find subforums for different languages and regions.
* Alt chains and atomic transfers - Bitcoin Forum This is a thread where a user named TierNolan explains how to conduct an atomic exchange between two different cryptocurrencies using a script that verifies the tokens in a merkle tree and scans the alt-chain headers https://bitcointalk.org/index.php?topic=193281.0.
* Bitcoin Technical Support This is a board where you can ask for help with any technical issues or problems related to bitcoin, such as installation, synchronization, transactions, encryption, backup, recovery, etc https://bitcointalk.org/index.php?board=4.0.
* Bitcoin puzzle transaction ~32 BTC prize to who solves it This is a challenge where a user named 1FLAMEN6 has hidden a private key in a complex puzzle transaction that contains ~32 BTC. The puzzle involves finding the correct inputs and outputs, decoding the encrypted messages, and cracking the password https://bitcointalk.org/index.php?topic=1306983.4080/DogNeedsBest/index.php?topic=1306983.4080


I hope these links are useful for you. If you have any other questions or feedback, please let me know. I’m always happy to learn and improve.

Best regard,
BookerE1
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!