BitcoinPHP / BitcoinECDSA.php

PHP library to generate BTC addresses and signatures from private keys.
222 stars 106 forks source link

[Warning] gmp_add(): Unable to convert variable to GMP #37

Open elliot-sawyer opened 5 years ago

elliot-sawyer commented 5 years ago

Thanks for this module, you've done amazing work with it!

We're receiving the above warning when a user attempts to validate a CashAddr formatted address with this module, I'd guess due to the presence of non-base58 characters. Could the module detect this and throw a catchable Exception before gmp throws a warning? Happy to raise a pull request if you're happy with that!

Beakerboy commented 5 years ago

The library does not support cashaddr formatted addresses. I've used submtd/cashaddr-converter together with bitcoin-php/bitcoin-ecdsa like this:

use BitcoinPHP\BitcoinECDSA\BitcoinECDSA;
use Submtd\CashaddrConverter\CashaddrConverter;
$converter = new CashaddrConverter();
$legacy_address = $converter->convertFromCashaddr($address);
$bitcoinECDSA = new BitcoinECDSA();
return $bitcoinECDSA->checkSignatureForMessage($legacy_address, $signature, $message);