Git Product home page Git Product logo

bitcoind-php's People

Contributors

analogic avatar deweller avatar dexx7 avatar greatwitenorth avatar joshuaestes avatar neilgarb avatar ocramius avatar sanasol avatar scr34m avatar skrajewski avatar willgriffin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitcoind-php's Issues

Weird issues around static curl resource

Example output with debugging code shows multiple CurlDrivers can cause problems - destructing one destroys the $ch, but leaves an Unknown resource there.

destruct CurlDriver #1: 0000000041738a1d000000001283de3d
/home/bitcoin/git/bitcoind-php/src/Http/Driver/CurlDriver.php:37:
resource(91) of type (curl)
 - closed curl
destruct CurlDriver #2: 0000000041738a16000000001283de3d
/home/bitcoin/git/bitcoind-php/src/Http/Driver/CurlDriver.php:37:
resource(91) of type (Unknown)

This had a pretty sinister effect on my tests - https://travis-ci.org/Bit-Wasp/bitcoin-php/builds/290376696 - HHVM notices there is a null object pointer and breaks, PHP just segfaults or runs out of memory. Some more debugging will tell me if travis's environment is interacting with something here, (or if curl can be patched to notice improper usage) but interesting that I don't seem to get the issues locally..

Submitting a test case that I see passes on 2.x branch, but fails on the latest tagged release.

Could you tag a release please? :)

Feature request: Return response in object, array or json

Currently the responses are returned as PHP objects. Example: $object->info I think it would be useful to have an option in the client to return responses as array.

I prefer responses to be returned as array. Example: $object['info']

Returning as json would be useful as well, since this is what bitcoind returns.

getContents() empty

For some reason after update to 2.x-dev version getContents() always empty.

Empty here:

$command = new \Nbobtc\Command\Command($command, $options);
$response = $client->sendCommand($command);
$contents = $response->getBody()->getContents();

Work fine with __toString():

$command = new \Nbobtc\Command\Command($command, $options);
$response = $client->sendCommand($command);
$contents = $response->getBody()->__toString();

Not sure how it broken, maybe you have some ideas?
As i see nothing changed, but old code doesn't work 😣

safe lines of code

Is there a way to safe some lines of code?
As example:

$command = new \Nbobtc\Command\Command;
$client = new \Nbobtc\Http\Client('http://***:***@localhost:18332');

$command = new $command('validateaddress', $request->input('address'));
$response = $client->sendCommand($command);
$contents = json_decode($response->getBody()->getContents());

if($contents->result->isvalid) {
    $command = new $command('getnewaddress', 'foo');
    $response = $client->sendCommand($command);
    $contents = json_decode($response->getBody()->getContents());
    print_r($response);
}

so is there a shorter way to get the result?

Body is empty due to missing seek command

The php://temp stream is not read from the beginning without issuing a seek command.

There are some unexpected consequences of this behavior.

For example, calling $response->getBody()->getContents() twice will return null the second time.

Add require_once description pls

It could be a good idea for such noobies as as me to add require_once installation instructions. Its real pain in the ass to figure out how to start working with lib.

I've downloaded it through git clone. Then I've created php file and added two main (as I think) files

require_once Nt_Path::get()->scripts . '/btc/lib/Http/Client.php';

require_once Nt_Path::get()->scripts . '/btc/lib/Command/Command.php';


but it doesnt work, I assume it should be added somehow else... but how?

Im trying to use the library in pretty old zend framework, is there an easy require way of installing it?

catch exception

How to catch an exception which for example may occur when bitcoind is offline?
Wasn't able to solve this by using:

private function getAddress(){

//...prepare connection
try{
    $response = $client->sendCommand($command);
    return json_decode($response->getBody()->getContents());
}
catch(Exception $e){
    return json_encode([
        'errors' => 'server offline',
        ]);
}

Start using releases or tags

Given that new RPC commands were added over time which are not available in all Bitcoin Core versions, some form of categorization would be helpful.

CurlDriver::__destruct is giving me problems

I ran into problems with the curl driver.
I iterate through some addresses and fire the 'getreceivedbyaddress' command. The first address gave me the correct output but as soon as I get to the second address I get:

[ErrorException]
curl_close(): supplied resource is not a valid cURL handle resource

[ErrorException]
curl_setopt_array(): supplied resource is not a valid cURL handle resource

I commented the following line from the destructor and then everything works like a charm.
public function __destruct()
{
if (null !== self::$ch) {
// curl_close(self::$ch);
}
}
obvious I can also set self::$ch to null...

I do not understand why this is. curl_close always throws this exception after the first command. No matter when I call it. any clue?

incompatible with psr/http-message current version

Just installed with composer (as a vendor in a cakephp 3 project), received this error at the first try:
Fatal error: Declaration of Nbobtc\Http\Message\Message::withBody() must be compatible with Psr\Http\Message\MessageInterface::withBody(Psr\Http\Message\StreamInterface $body) in ****\vendor\nbobtc\bitcoind-php\src\Http\Message\Message.php on line 18

the psr http-message module was updated recently, maybe it was a major update. There is no streamableinterface any more as I see, but could not resolve the error by trying to make it compatible (renaming and stuff), just more errors occured..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.