send-crypto
send-crypto copied to clipboard
How to get segwit address from this library?
-
I'm submitting a ... [ ] bug report [ tick] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project
-
Summary
I was using this code for sending btc transactions and it was working really good. I like the simplicity. However, when I imported my private key (mainnet BTC) and tried to see the wallet address, it was showing a legacy address. While, the wallet that I created was segwit. So, I am a bit confused here. Can some help me get the segwit address?
- Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
Steps to reproduce:
-
First, I imported the private key and converted to buffer using ECPair
const keyPair = ECPair.fromWIF(private_key); const account = new CryptoAccount(keyPair.privateKey);
-
Then I checked the account using the folllowing:
var addr = await account.address("BTC"); console.log("Wallet address:", addr);
-
The address was shown as following
"1QAFzHidiMNVED9AfP*****************" Starting with "1"
Whereas, it should output something like this,
"bc1qlc9jt4kx5x***************" Starting with bc1
Can somebody please help out here?
@devturi any update ?