2

I'm using Bitcoin API EasyBitcoin-PHP

And also i have my custom transaction fee, that i'd like to pay per each Kb. The problem is that when i used bitcoind v.0.10.2 that was fine and i saw my custom fee (0.0002) in each transaction. But when i've updated to v. 0.13.0 - it just won't work as it should. Here is the simple code, that i'm testing now

$bitcoin = new Bitcoin($user, $password, $host, $port);

$result = $bitcoin->settxfee(0.0002); //returns true
$newTxId = $bitcoin->sendtoaddress('144YsrgtDmRSPC8wUBXLxByCcQAEbV1EUB', 0.001); //returns c3a2fceed1c25624aee8e957c644813bf38808260aad607e623c68e182371ac9

And as you can see in this transaction the fee is 0.000045 BTC, not 0.0002 BTC.

I know, that there was a bug in prev version of bitcoind according to fee rounding, but in new version this bug should be fixed.

Maybe there is another trouble here?

1 Answer 1

2

The value you specify for custom fee is in fee per kilobyte. Until recently, the "size" for fee computations was always rounded up to 1 kilobyte anyway, leading some people to believe that the amount they're setting is the absolute amount instead.

Your transaction is 225 bytes, and pays 0.000045 BTC fee. That is exactly 0.0002 BTC per 1000 bytes, so it is working as intended.

6
  • yeah, i know. Here is even github issue for that. github.com/bitcoin/bitcoin/issues/7633 and as i can see, they decided to revert feature and now to behaviour should be the same as in old versions. Am i right? Commented Oct 17, 2016 at 11:52
  • They're only reverted in 0.11, because the change was made without announcement there. What I describe in my answer is the intended behaviour, and the one that is implemented in 0.12 and 0.13. Commented Oct 17, 2016 at 11:55
  • oh, i see. So in new versions now it is working lie this... Hm.. not good. 'cos i need to estimate my future transaction size now to show my users what fee would i take away from their payout... and right now i don't know how to estimate it... Commented Oct 17, 2016 at 11:57
  • Use create/fundrawtransaction to build your transaction, check the fee, show it, and if agreed to, use signrawtransaction/sendrawtransaction to broadcast it. Commented Oct 17, 2016 at 11:59
  • great complication of simple (before) payout process as for users and for developers :( but thanks for the help! Commented Oct 17, 2016 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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