bitpay / php-bitpay-client

PHP implementation for the BitPay cryptographically secure RESTful API
MIT License
166 stars 147 forks source link

Not creating Private key & public key #241

Closed soravgarg123 closed 7 years ago

soravgarg123 commented 7 years ago

Here i am running generatekey file but not generating private key and public key, please check it.

http://localhost/php-bitpay-client/examples/tutorial/001_generateKeys.php

estebandelaf commented 7 years ago

@soravgarg123 what is your error? I just have this error when I tried to create private key:

PHP Notice: Uninitialized string offset: 0 in [...]/Vendor/bitpay/php-client/src/Bitpay/Math/RichArbitraryPrecisionIntegerMath.php on line 230

And the page go into a infinite time of loading when I tried to create public key.

Then, I have installed 'php-bcmath' and it's ok now, the two keys are generated.

DaveTacker commented 7 years ago

Hey, thanks @estebandelaf, this fixed my problem as well. For others curious, I was getting the NOTICE when trying to generate the public and private keys:

PHP Notice: Uninitialized string offset: 0 in /etc/Bitpay/vendor/bitpay/php-client/src/Bitpay/Math/RichArbitraryPrecisionIntegerMath.php on line 230

To follow @estebandelaf 's advice for Ubuntu 17.04:

sudo apt-get install php-bcmath
sudo /etc/init.d/apache2 restart

I then reloaded the 001_generateKeys.php file, and all is well in the world again.

estebandelaf commented 7 years ago

@kneeki finally, bcmath doesn't solve my problem. Yes, it works for creating public key. But, later, can't make the connection with Bitpay. I can't remember the exact error, but the problem was bcmath when I tried to create the invoice. I used gmp and removed bcmath.

Is another issue with the problem with bcmath: https://github.com/bitpay/php-bitpay-client/issues/237#issuecomment-326899419