Closed Overtorment closed 5 years ago
It has always been unspendable.
Since the beginning of segwit any segwit key must use compressed pubkeys.
Since v3 only had a very manual process (like you showed) there was no way to check, since encode only received a hash.
In v4 and higher, your code would be:
let keyPair = bitcoin.ECPair.fromWIF(secret);
let pubKey = keyPair.publicKey;
let address = bitcoin.payments.p2sh({
redeem: bitcoin.payments.p2wpkh({
pubkey: pubKey,
network: keyPair.network,
}),
network: keyPair.network,
}).address;
If the pubkey is uncompressed it will throw an error.
Unfortunately, there is no way to recover coins sent to an uncompressed pubkey using segwit.
I happened to have old WIF for the uncompressed public key.
Then I made a p2sh segwit address out of it, using bitcoinjs v3:
And sent some bitcoins there. Now apparently it is unspendable..? Or is there a way to recover those funds? Error Im getting is
BIP143 rejects uncompressed public keys in P2WPKH or P2WSH
Thanks!