0

I am attempting to use a PHP RPC Wrapper to connect to bitcoind for RPC API calls, estimatesmartfee, more specifically.

My question is, do I need to specify the argument keys, or just the values?

For example, the below is with just the values

public function getSmartFeeEstimate($blocks)
{
    $command = new \Nbobtc\Command\Command('estimatesmartfee', [$blocks, 'CONSERVATIVE']);
    $response = $this->client->sendCommand($command);
    $contents = $response->getBody()->getContents();

    return $contents;
}

or do I need to specify the keys as well, for example...

public function getSmartFeeEstimate($blocks)
{
    $command = new \Nbobtc\Command\Command('estimatesmartfee', ['conf_target' => $blocks, 'estimate_mode' => 'CONSERVATIVE']);
    $response = $this->client->sendCommand($command);
    $contents = $response->getBody()->getContents();

    return $contents;
}

Normally I would just try each one and see what the functions return, however, I am in regtest mode, and its returning the same thing for both, which leads me to believe that it's ignoring the arguments and just telling me its not working...

{"result":{"errors":["Insufficient data or no feerate found"],"blocks":2},"error":null,"id":null}
0

It's not working because it does not have sufficient data to give you a reasonable estimation.

You will need a steady rate of transactions on the network for a sustained period of time. On regtest, that means you'll need to simulate those transactions as there is no network to provide them.

It's easier to see estimatesmartfee in action on testnet or mainnet.

|improve this answer|||||
  • yes, but, do i need to specify the keys when making the request, or do i just pass the values? – Jeffrey L. Roberts Sep 20 '19 at 0:25
  • Both are allowed. – Pieter Wuille Sep 20 '19 at 0:30

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.