Closed random9brat closed 2 years ago
From the README:
From bip32 README: (ecpair is similar)
Here's the answer:
const ecc = require('tiny-secp256k1');
const { ECPairFactory } = require('ecpair');
const ECPair = ECPairFactory(ecc);
Hmmm...im still not doing something good, hope we can still communicate even if its closed:
const bitcoin = require('bitcoinjs-lib');
const ecc = require('tiny-secp256k1');
const { ECPairFactory } = require('ecpair');
const ECPair = ECPairFactory(ecc);
const keyPair = bitcoin.ECPair.fromWIF('KxCb6hLLBUwxJdThXnSb37gJPKmN5BiibRiA7MXQouAWtRyRTQmo');
var addr = keyPair.getAddress();
console.log(addr);
with this code im getting 13LzzJWrgRUM8Xtx9SnJa2Yn5aGruMQfEG not bc1.....
also when i try to run this im getting TypeError: Cannot read property 'p2wpkh' of undefined
const bitcoin = require('bitcoinjs-lib');
const ecc = require('tiny-secp256k1');
const { ECPairFactory } = require('ecpair');
const ECPair = ECPairFactory(ecc);
const keyPair = bitcoin.ECPair.fromWIF('KxCb6hLLBUwxJdThXnSb37gJPKmN5BiibRiA7MXQouAWtRyRTQmo');
const { address } = bitcoin.payments.p2wpkh({ pubkey: keyPair.publicKey });
console.log(address);
I have a feeling that we are close :))) thanks for helping me tho, i really appreciate it
Holly molly what a ride this was...after 15+ hours i finally did it... i was using bitcoinjs-lib@3.3.2 not @6.0.1...
i changed it and we are good to go :D.... posting this here so if anyone ever have the same problem...
thanks again for the help junderw, you are the man.
Still searching for the answer... right now im stuck with this code and I could really need some help... playing around and trying to learn more about btc dev.
Im really new into this world of JS so be gentle, i guess i stuck with some imports etc but I really dont know what to do. I can feel that solution is one or two lines away but i really dont know what to do...
Am i wrong or it bc1 segwit can be generated just with private key??