1

I am attempting to set up the PHP bitwasp library from the github repository:

https://github.com/Bit-Wasp/bitcoin-php

The installing instructions suggest I simply execute:

$ composer require bitwasp/bitcoin

I do have composer installed but I am getting the following error message:

Problem 1 - Installation request for bitwasp/bitcoin dev-master -> satisfiable by bitwasp/bitcoin[dev-master]. - Can only install one of: bitwasp/bitcoin[v0.0.29.1, dev-master]. - Installation request for bitwasp/bitcoin v0.0.29.1 -> satisfiable by bitwasp/bitcoin[v0.0.29.1].

I do not practice PHP full time so I lack the experience of installing packages in that language and using composer. I would be grateful if someone could point me in the right direction.

EDIT The suggestion has been made that the package is already installed. However, the following code sample which I got from another thread:

<?php
// failing to install bitwasp
use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Address;
use BitWasp\Bitcoin\Key\PrivateKeyFactory;

$network = Bitcoin::getNetwork();

$privateKey = PrivateKeyFactory::create(true);
$publicKey = $privateKey->getPublicKey();
$address = $publicKey->getAddress();

?>

is giving me PHP Fatal error: Class 'BitWasp\Bitcoin\Bitcoin' not found.

  • 1
    Did you include the vendor/autoload.php file? It's missing from your snippet, so as suggested below, it might already be on your system. – karimkorun Aug 25 '16 at 20:25
  • 2
    You have made me very happy !!! First of all I had to type composer install instead of composer require bitswap/bitcoin and this triggered a proper installation, and in particular this created a vendor directory with an autoload.php file in it. Then I created a symbolic link from my working directory to this vendor directory. Then I added the line require 'vendor/autoload.php'; in my snippet as you suggested. And voila the thing ran :) Thank you very much !!. If you want to explain the answer for the record (better than I can do, I am no PHP specialist) I will gladly upvote it. . – Sven Williamson Aug 25 '16 at 21:49
  • Oh, please be careful :P someone published bitswap/bitcoin on composer and I'm not sure if they're typo-squatting! If you can, @Sven could you update your comment if this wasn't what you meant? – karimkorun Jan 14 '18 at 22:27
  • 1
    require 'vendor/autoload.php'; For those having similar issues. – Sydwell Nov 1 '18 at 10:10
1

You have it installed already. That's why it's saying you have the requirements met and don't need to download it again.

  • Thank you very much ! I am guessing something else is wrong too. I have updated my question to explain. – Sven Williamson Aug 24 '16 at 21:16
  • I think I know why. Did you use "bitcoin" instead of "bitcoin-php"? – Whyte the Weeabear Aug 24 '16 at 21:18
  • I typed composer require bitwasp/bitcoin to install and the code is exactly as I have stated it. Using the indicated repository. I am on Debian 8. – Sven Williamson Aug 24 '16 at 21:22
  • Oh, im not familiar with Debian. What php version are you using? – Whyte the Weeabear Aug 24 '16 at 21:23
  • PHP 5.6.24. Zend Engine v2.6.0 with Zend OPcache v7.0.6-dev. This is pure PHP, run as a script (no browser involed), if this matters. – Sven Williamson Aug 24 '16 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.