Closed SuperHenkie closed 1 year ago
You will have to update bitcoinjs-lib to 6.x: https://github.com/bitcoinjs/bitcoinjs-lib/pull/1745
There is still active development going on, so not all features are supported yet, see https://github.com/bitcoinjs/bitcoinjs-lib/issues/1522
You will have to update bitcoinjs-lib to 6.x: #1745
There is still active development going on, so not all features are supported yet, see #1522
I see, thanks. Instead of the latest release according to github (4.0.3) I have now taken just the latest from npm, which is currently 6.0.0.
However, I'm now having a problem in my test scripts, it doesn't seem to know ECPair
anymore.
I have this index.js:
var bitcoin_js = require('bitcoinjs-lib')
bitcoin_js.Buffer = require('safe-buffer').Buffer
module.exports = bitcoin_js
I build a standalone bitcoinjs.js like this:
nvm use 14
npm install bitcoinjs-lib
browserify -r . --standalone bitcoin_js > bitcoinjs.js
Then I have a test.html in which I include bitcoinjs.js and do this:
const keyPair = bitcoin_js.ECPair.makeRandom();
I'm now getting this error:
Uncaught TypeError: bitcoin_js.ECPair is undefined
Instead if I do npm install bitcoinjs-lib@4.0.3
above, and leave everything else the same, this works fine.
I think I noticed a commit somewhere in which ECPair requirement was removed or something, but can't find it anymore. Is there a way I can still export ECPair along with bitcoinjs so I can use the various keypair functions?
ecpair
was created for legacy applications.bip32
moving forward. Individual key management is a legacy concept, and should only be used with legacy wallet types to maintain backwards compatibility for old wallet restoration. Anyone trying to use taproot with a single-privatekey WIF key (starting with "K" and "L" or "5") is just asking for trouble. This can be supported by moving from single-key to HD key via bip32 (most wallets use bip39 mnemonic phrases in conjunction with bip32), and telling users of old single-keys "if you want to use taproot, move all your funds to a new HD wallet"Also, github shows the latest is v6.0.0
https://github.com/bitcoinjs/bitcoinjs-lib/tags
Here's the CHANGELOG
I have updated the taproot example. It has become a bit more complicated.
Also, tiny-secp256k1 should add a negate method for private keys, since it looks like we will make great use of it in taproot.
Taproot support is added now in v6.1.0-rc.0
Given a private key (in Hex of WIF format) is there a way to get BitcoinJS to generate the corresponding Taproot (P2TR) address for that?
I sortof extracted this from the Taproot Key Spend example:
However this results in an error:
What am I doing wrong here?
P.S. I'm using bitcoinjs-lib 4.0.3.