Welcome to the discussion about this section. Here you can ask questions or post feedback about this specific lecture.
Reading Assignment
-
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. -
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) -
What is the hexadecimal OP Code for OP_CHECKMULTISIG?
Answer: 174
-
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
-
Correct, but in hex it is 0xae
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
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 ?
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
Thank you very much. I appreciate the feedback
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.
When I want to “npm i bcoin” on my Windows 10 mashine I get the following error(s):
> [email protected] install E:\OneDrive\no-excuses\nick\Entwicklungsumgebung\blockchain\test4\node_modules\leveldown
> prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=11.15.0 runtime=node arch=x64 platform=win32)
E:\OneDrive\no-excuses\nick\Entwicklungsumgebung\blockchain\test4\node_modules\leveldown>if not defined npm_config_node_gyp (node "C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Traceback (most recent call last):
File "C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
sys.exit(gyp.script_main())
File "C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\node-gyp\gyp\pylib/gyp/__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\node-gyp\gyp\pylib/gyp/__init__.py", line 538, in main
return gyp_main(args)
File "C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\node-gyp\gyp\pylib/gyp/__init__.py", line 514, in gyp_main
options.duplicate_basename_check)
File "C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\node-gyp\gyp\pylib/gyp/__init__.py", line 98, in Load
generator.CalculateVariables(default_variables, params)
File "C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\node-gyp\gyp\pylib/gyp/generator/msvs.py", line 1916, in CalculateVariables
generator_flags.get('msvs_version', 'auto'))
File "C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\node-gyp\gyp\pylib/gyp/MSVSVersion.py", line 434, in SelectVisualStudioVersion
versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)
KeyError: '2019'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\Nick\AppData\Roaming\nvm\v11.15.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:193:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:255:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Nick\\AppData\\Roaming\\nvm\\v11.15.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\OneDrive\no-excuses\nick\Entwicklungsumgebung\blockchain\test4\node_modules\leveldown
gyp ERR! node -v v11.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Nick\AppData\Roaming\npm-cache\_logs\2019-10-06T16_35_44_348Z-debug.log
I also tried…
- the newest versions of node and npm.
- deleteing node_modules and run npm install again
- reinstalled python 2.7
- installed visual studio 2019 with the C++ extension for C++ compiler
- using power shell as admin all the time
- reinstalling node-gyp a few times
- …
I am now using node 11 because one of the errors says
npm ERR! [email protected] install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
In the docs of leveldown they say:
If you get compilation errors on Node.js 12, please ensure you have leveldown >= 5. This can be checked by running npm ls leveldown.
The newest versions of leveldown and node did not work for me…
So I installed nvm-windows to manage the version of node and leveldown to try a combination that works. But it did not for me…
I am looking forward to your answers and thanks.