Bitcoin RPC estimatesmartfee argument keys necessary?

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}

Jeffrey L. Roberts

Posted 2019-09-19T14:32:15.943

Reputation: 163

Answers

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.

Pieter Wuille

Posted 2019-09-19T14:32:15.943

Reputation: 54 032

yes, but, do i need to specify the keys when making the request, or do i just pass the values?Jeffrey L. Roberts 2019-09-20T00:25:04.800

Both are allowed.Pieter Wuille 2019-09-20T00:30:15.640