Advanced Bitcoin Scripting - Discussion

Welcome to the discussion about this section. Here you can ask questions or post feedback about this specific lecture.

Reading Assignment

  1. What is the practical difference between OP_OP_CHECKSIG and OP_OP_CHECKSIGVERIFY?
    Answer:
    OP_CHECKSIG returns either 1 or 0 for True/False; thus, OP_OP_CHECKSIG would be OP of the return value from the first operation which is OP_1 or OP_0 (still returns True or False)
    OP_CHECKSIGVERIFY performs first the operations which is OP_CHECKSIG; returns stated above, thereafter performs OP_VERIFY on the return. This would return fail (mark the transaction invalid and remove it from the top of the stack) if the input value is false.
    So OP_OPCHECKSIGVERIFY would be the OP of the return from OP_CHECKSIGVERIFY.

  2. What are the “Push” and “Pop” functions called in Script? (They are not called OP_PUSH and OP_POP)
    Answer
    No idea (help me out)

  3. What is the hexadecimal OP Code for OP_CHECKMULTISIG?
    Answer: 174

  1. Hint. Look through the script wiki page and go down to the script section with op-codes. There you will find them: https://en.bitcoin.it/wiki/Script

  2. Correct, but in hex it is 0xae

Need help! Not printing the multisigScript on console as your powershell

image

try changing your console.log line to

console.log(multiSigScript.toString('utf8'));

Thanks filip, it worked , why you don’t have to do this conversion in your script?

Now getting below error
Tried below
1.uninstalling /installing nodjs and npm.
2.tried running power-shell as admin and repeating 1 but not working
image

Is that all of your code in the image? Just making sure I have all the info.

@filip I think “part 5” of the videos is a bit confusing. In part 4 we created a file “transaction” and in part 5 you also have a file “transaction” that contains other things than that file in part4. You didn’t discuss the content of that file in part 5 or did I miss something ?

yes that is what you have in the Part3 @3.39 before you run the program
image

Thank you, yes seems like there is one video that is missing in between. Let me check and get back to you.

Thanks. Could you try to isolate on which row that error throws? Either by looking at the stacktrace or just commenting out lines from the bottom up until it no longer throws.

Fixed it. Added the missing video. That new video became the real part 5. So the part numbers have changed.

Not sure if this is the place to leave feedback but I just want to say a big thank you, and I really enjoyed the course and I’m looking forward to the next one! I know it’s a lot of work but to make it a little bit more interactive, it would be nice to have some quizzes or coding exercises, a bit like in the smart contract programming course :slightly_smiling_face:

1 Like

Thank you very much. I appreciate the feedback :slight_smile:

1 Like

flip,

How are UTXOs collected to create a transaction? If I want to send .5 BTC and have a number of small UTXOs that sum to a value greater than .5 and another UTXO with a value of .6 BTC, will the smaller UTXOs be combined first to reduce the overall number of them or select the single .6 BTC UTXOto create the output?

That’s a good but difficult question. The short answer is that it can be done in many different ways and it’s up to the wallet that you use to choose to decide this. For example, I just did a video on my YT channel on how the Wasabi wallet structures UTXOs to maximize privacy.

The long answer is that you have to make tradeoffs when you choose how to pick UTXOs. Here is a good blog posts about all of this: https://medium.com/@lopp/the-challenges-of-optimizing-unspent-output-selection-a3e5d05d13ef

Thanks Filip. Interesting article. Had thought about a couple of items and the remainder were interesting. Looking forward to class update.