It seems that PrivateKey.fromWif doesn't support WIF with compressed format.
When I use a WIF private key with compressed format, some warning shows up:
WARN: Expecting 32 bytes, instead got 33, stack trace: Error
And I can get a result from the function. However, the result is not correct.
So I read the souce code. PrivateKey.fromWif will generate a BigInteger from buffer generated from WIF format. So if I provide a compressed WIF which has an extra compressed flag byte, it will use the 33 bytes data to generate the private key. But it is not my original private key.
It seems that PrivateKey.fromWif doesn't support WIF with compressed format.
When I use a WIF private key with compressed format, some warning shows up:
WARN: Expecting 32 bytes, instead got 33, stack trace: ErrorAnd I can get a result from the function. However, the result is not correct.
So I read the souce code. PrivateKey.fromWif will generate a BigInteger from buffer generated from WIF format. So if I provide a compressed WIF which has an extra compressed flag byte, it will use the 33 bytes data to generate the private key. But it is not my original private key.