I’m not aware if the multisig code has been published anywhere since its fairly simple.
I’ve uploaded my solution you can check out:
https://gist.github.com/Alko89/73c18c47c1bff6cbfd33568401e8ccd4
I’m not aware if the multisig code has been published anywhere since its fairly simple.
I’ve uploaded my solution you can check out:
https://gist.github.com/Alko89/73c18c47c1bff6cbfd33568401e8ccd4
Thank you, Alko89!
I got my code to finally work.
Thanks a lot. I wasn’t able to install production build tools for windows neither install bcoin following the course instructions. But your recommendations worked for the most part. However, your step 5 didin’t work since the protocol 9418 is no longer supported.
https://github.blog/2021-09-01-improving-git-protocol-security-github/
It happens that I fell into the 0.3% of the affected people.
https://github.blog/2021-09-01-improving-git-protocol-security-github/
It seems that Github has made a lot of changes due to security issues. Thus, I recommend in the step 5 to use this instead: https://github.com/bcoin-org/bcoin in order to get the git clone.
I found out that a git clone is also possible to do directly from Visual Studio and in fact is easier. You must open the app as an administrator. And in the first page there’s an option “Clone Git Repository”. You must pass the URL, but make sure it starts with https://. Otherwise won’t work.
I spend a whole day trying everything and researching. I finally installed all tools, but I never made it work. Moralis should update the installation lecture all over again.
Please, update this part of the course. It’s indeed so interesting. It is in fact the cherry on top of the cake. However I am very disapointed. I spend a day and a half dealing with all kind of errors while installing bcoin. I followed thru all recommendations in this forum and outside on the internet. Finally I made to install bcoin but I never made the code to work. Not npm link, neither npm rebuild worked at all.
So, I decided to follow this part of the course by just watching the videos. Fortunately my prior Javascript knowledge helped me a lot.
Thanks anyway. I enjoyed this course a lot!
hello people if some one can help me with this error would be awesome please i dont know what is missing but i haved tried everything maybe is a small error but at this point i think my brain is going to explote.
thank you very much and sorry
Your transaction.js is in node_modules folder. Move it to root of your project.
yes sirrrrr thank you very much sorry for that little mistake some times coding get my brain out of my head jajajajajaj
Hello,
I opened Powershell as an administrator and I’m trying to install “npm install --global windows-build-tools”, but i get:
npm : The term ‘npm’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the s
pelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ CategoryInfo : ObjectNotFound: (npm:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Can somebody help?
Did you install node.js?
I’m also getting this message.
Can I ask you how you’ve solved it?
No I didn’t, but I did now.
And I’m getting:
PS C:\WINDOWS\system32> npm install --global windows-build-tools
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
[##################] - reify:ajv: timing reifyNode:node_modules/windows-build-tools Completed in 15674ms.
And it stays like this.
Are you using the LTS version of node? If not try using that one. You can also install microsoft build tools manually from their website:
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022
Where can I see whether I’m using the LTS version of node?
Use node --version
and check online what version you use.
yes I’m using the LTS version:
[
Node v16.17.0 (LTS)
Hello,
Thanks Filip, that was a good exercise. It is all starting to make sense.
Install of bcoin went ok and running both exercises worked on my setup (Ubuntu 22.04).
Exercise logs: https://github.com/CodingInLondon/moralisacademy-btcprogramming/tree/main/bcoin-library
Script outputs:
I get the following output when running address.js:
Public keys:
[
<Buffer 02 cb d4 6f b2 95 97 34 0a 47 1e 2d 66 1a 27 53 0c 7c d5 45 a0 9a 75 05 e0 29 df 97 ca 36 39 6e 64>,
<Buffer 02 5b ba 45 ed b9 8a ac 7d 79 c3 4a e6 76 fe 16 d4 5b 13 99 3c 58 07 c5 e9 21 b7 6b 4a a7 74 26 f4>
]
Multisig script: OP_2 0x21 0x025bba45edb98aac7d79c34ae676fe16d45b13993c5807c5e921b76b4aa77426f4 0x21 0x02cbd46fb29597340a471e2d661a27530c7cd545a09a7505e029df97ca36396e64 OP_2 OP_CHECKMULTISIG
Multisig address: 2N13LtwV9AqPrGDs3JD5kANPRtESu3sUMdf
and transaction.js:
parallels@ubuntu-linux-22-04-desktop:/media/psf/Ivan/Bitcoin Programming/github-repo/moralisacademy-btcprogramming/bcoin-library/project$ node transaction.js
Multisig creation
Receiver address:
1fAggXKk6xkkob2TkCpNAVVYMMyM6f5CC
Public keys:
[
<Buffer 02 cb d4 6f b2 95 97 34 0a 47 1e 2d 66 1a 27 53 0c 7c d5 45 a0 9a 75 05 e0 29 df 97 ca 36 39 6e 64>,
<Buffer 02 5b ba 45 ed b9 8a ac 7d 79 c3 4a e6 76 fe 16 d4 5b 13 99 3c 58 07 c5 e9 21 b7 6b 4a a7 74 26 f4>
]
Redeem script: OP_2 0x21 0x025bba45edb98aac7d79c34ae676fe16d45b13993c5807c5e921b76b4aa77426f4 0x21 0x02cbd46fb29597340a471e2d661a27530c7cd545a09a7505e029df97ca36396e64 OP_2 OP_CHECKMULTISIG
Multisig address: 2N13LtwV9AqPrGDs3JD5kANPRtESu3sUMdf
Redeem script hash:
<Buffer 55 81 c7 f7 d5 c6 a3 e1 11 f8 1c d3 0f 32 2d 22 6d 46 dd ff>
output script: OP_HASH160 0x14 0x5581c7f7d5c6a3e111f81cd30f322d226d46ddff OP_EQUAL
Fund the multisig address with this transaction:
{
hash: 'a9257c7a7eab08413c3514925db92c4d5c6fbb3f0a1f23581beb713815080b55',
witnessHash: 'a9257c7a7eab08413c3514925db92c4d5c6fbb3f0a1f23581beb713815080b55',
size: 83,
virtualSize: 83,
value: '0.0005',
fee: '0.0',
rate: '0.0',
minFee: '0.00000083',
height: -1,
block: null,
time: 0,
date: null,
index: -1,
version: 1,
inputs: [
{
type: 'coinbase',
subtype: null,
address: null,
script: <Script: >,
witness: <Witness: >,
redeem: null,
sequence: 4294967295,
prevout: <Outpoint: 0000000000000000000000000000000000000000000000000000000000000000/4294967295>,
coin: null
}
],
outputs: [
{
type: 'scripthash',
value: '0.0005',
script: <Script: OP_HASH160 0x14 0x5581c7f7d5c6a3e111f81cd30f322d226d46ddff OP_EQUAL>,
address: <Address: type=scripthash version=-1 str=39V8qCZ7ZNtW4SEVd5TsYRQAftEjFcC1so>
}
],
locktime: 0
}
Spend from the multisigaddress with this transaction:
{
hash: '3e16d5ec5f1e63e4e1091dc8f5817a03ba00c688eb7c576f10f2a5068b74deb1',
witnessHash: '3e16d5ec5f1e63e4e1091dc8f5817a03ba00c688eb7c576f10f2a5068b74deb1',
size: 335,
virtualSize: 335,
value: '0.0004626',
fee: '0.0000374',
rate: '0.00011164',
minFee: '0.00000335',
height: -1,
block: null,
time: 0,
date: null,
index: -1,
version: 1,
inputs: [
{
type: 'scripthash',
subtype: 'multisig',
address: <Address: type=scripthash version=-1 str=39V8qCZ7ZNtW4SEVd5TsYRQAftEjFcC1so>,
script: <Script: OP_0 0x48 0x3045022100a4129742b402751fc5c0932f3adb7acf1063fafd731fe3c832fc37ff04f206680220727060a52c81692481b4ec6a36e8a741fd8fcb63becf6b7634693a872160c92501 0x47 0x3044022060e701e5c7b5c02c65f77c51ae029955796e3a76a2eaea47461bec219b0c9cad02203e407ce03c1bd8a33a3a640d0ae920e49537ba460197798c10d315dd4d94658b01 0x47 0x5221025bba45edb98aac7d79c34ae676fe16d45b13993c5807c5e921b76b4aa77426f42102cbd46fb29597340a471e2d661a27530c7cd545a09a7505e029df97ca36396e6452ae>,
witness: <Witness: >,
redeem: <Script: OP_2 0x21 0x025bba45edb98aac7d79c34ae676fe16d45b13993c5807c5e921b76b4aa77426f4 0x21 0x02cbd46fb29597340a471e2d661a27530c7cd545a09a7505e029df97ca36396e64 OP_2 OP_CHECKMULTISIG>,
sequence: 4294967295,
prevout: <Outpoint: a9257c7a7eab08413c3514925db92c4d5c6fbb3f0a1f23581beb713815080b55/0>,
coin: [Object]
}
],
outputs: [
{
type: 'pubkeyhash',
value: '0.0001',
script: <Script: OP_DUP OP_HASH160 0x14 0x0737e3f67bacf46790f42aee7e6cdee0821114bd OP_EQUALVERIFY OP_CHECKSIG>,
address: <Address: type=pubkeyhash version=-1 str=1fAggXKk6xkkob2TkCpNAVVYMMyM6f5CC>
},
{
type: 'scripthash',
value: '0.0003626',
script: <Script: OP_HASH160 0x14 0x5581c7f7d5c6a3e111f81cd30f322d226d46ddff OP_EQUAL>,
address: <Address: type=scripthash version=-1 str=39V8qCZ7ZNtW4SEVd5TsYRQAftEjFcC1so>
}
],
locktime: 0
}
true
Same problem.
PS C:\Windows\System32> npm install --global windows-build-tools
npm WARN config global --global
, --local
are deprecated. Use --location=global
instead.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Node.js now includes build tools for Windows. You probably no longer need this tool. See https://github.com/felixrieseberg/windows-build-tools for details.
[##################] \ reify:ajv: timing reifyNode:node_modules/windows-build-tools Completed in 896ms