<p>The problem is not with bitcoin core, it's definitely of the block explorer.</p>

<p>Transaction size is 104 + 32 + 34 + 10 = 180 byte, they are saying transaction size 140 byte. I don't understand how did they calculate it.</p>

<p><a href="https://testnet.blockchain.info/tx/789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3" rel="nofollow noreferrer">Blockchain.info</a> saying transactions size is 250</p>

<p>You should not trust them for that matters, try </p>

<pre><code>bitcoin-cli gettransaction 789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3
</code></pre>

<p>and see transaction size.</p>

CC BY-SA 4.0
2018-06-03T10:03:53.463Z
You are right. But still i coundnt reach the exact calculation. I have shared output of gettransaction call.
Kerem atam
CC BY-SA 4.0
2018-06-03T11:49:33.037Z
You can't reach exact calculation because transaction header size isn't always 10 byte and input size as well, take a look at this answer [here](https://bitcoin.stackexchange.com/questions/43154/how-is-transaction-fee-calculated)
Tailer
CC BY-SA 4.0
2018-06-03T14:38:06.870Z
Got it! How about bitcoin-cli command output. I cant see 180 but 250 as blockchain.info
Kerem atam
CC BY-SA 4.0
2018-06-03T15:42:25.160Z
where do you see 250 byte?
Tailer
CC BY-SA 4.0
2018-06-03T15:59:26.427Z
hex parameter in gettransaction returns 250 byte value
Kerem atam
CC BY-SA 4.0
2018-06-03T17:08:53.030Z
The size that matters is the virtual size (or 1/4th of the weight), which takes the SegWit discount into account), not the byte size.
Pieter Wuille
CC BY-SA 4.0
2018-06-03T20:06:52.243Z
Thanks for explanations. @PieterWuille can you suggest comprehensive documentation where i can calculate my transaction in detail for different address types. Seriously; i am sick of wandering around Github repos and Stackexchange topics.
Kerem atam
CC BY-SA 4.0
2018-06-03T21:45:24.850Z
Weight is defined in BIP141 as 3*bytes_when_serialized_without_witnesses + bytes_when_serialized_with_witnesses.
Pieter Wuille
CC BY-SA 4.0
2018-06-03T00:59:11.613Z
2018-06-03T00:59:11.613Z
Tailer
<p>I set transaction fee with :</p>

<pre><code>$ bitcoin-cli settxfee 0.00003000
</code></pre>

<p>Here is what i observe from block explorer for my transaction :
<a href="https://testnet.blockexplorer.com/tx/789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3" rel="nofollow noreferrer">https://testnet.blockexplorer.com/tx/789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3</a></p>

<pre><code>Fee Rate    0.000036 BTC per kB
</code></pre>

<p>I've tested with different transaction fees for several times; difference always 20% more.</p>

<p>I am on testnet3; using bitcoind version 0.16.0</p>

<p>Edit :</p>

<p>As Adam's answer; now i am more skeptical about byte calculation of blockchain monitoring sites (or whatever they are called).</p>

<p>I've inspected my transaction with <code>getransaction</code> call.
But i still dont see fee per kB is matching with calculation. According to <code>hex</code> parameter; it should be 250 bytes. So total fee should be <code>0.00000750</code>. Shouldn't i take <code>hex</code>  parameter as size of transaction?</p>

<p>If adam's calculation correct; (seem like it is) then 180 * 0.00003000 / 1024 = 0.00000527. Closest answer so far with %4.5 difference.</p>

<p>Is my calculation correct?</p>

<pre><code>bitcoin-cli gettransaction 789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3
{
  "amount": -0.00005000,
  "fee": -0.00000504,
  "confirmations": 190,
  "blockhash": "0000000000000287661d724d67bed9c1a8861179413e056ee0d16a8b132ad380",
  "blockindex": 12,
  "blocktime": 1527979564,
  "txid": "789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3",
  "walletconflicts": [
  ],
  "time": 1527979516,
  "timereceived": 1527979516,
  "bip125-replaceable": "no",
  "details": [
    {
      "account": "",
      "address": "momFk8PtAZoN4j7Y6jnbucEfc6teUKECEB",
      "category": "send",
      "amount": -0.00005000,
      "vout": 0,
      "fee": -0.00000504,
      "abandoned": false
    }
  ],
  "hex": "020000000001014bb52fb3493598763b53d5ba3cb41f2486cd1ec1b61bae2727d2b9fc74a7454800000000171600148febee6ac4a40d4474c2665c77bbf02350d1bb63feffffff0288130000000000001976a9145a756559278c3795092c07f49c6cf47d360bb1be88acc7c70f000000000017a914849901fe3e003ebf5be1afaf737305158d8865a58702483045022100e23a7e22a21da25f3363bbccbe0bfc94f8044e48236f20b595a456f6bc6d708b02206fc6acdc3636904458cd81770a346a75cc7d5e8ad3868168e387c9cff521b9680121038dc51cc27a4ae2f7ae52503ae4a23862cde107001b59a65639522925527a3e4788291400"
}
</code></pre>

CC BY-SA 4.0
2018-06-03T01:20:12.017Z
It's likely a difference between fee calculation using segwit and non-segwit sizes.
Raghav Sood
<bitcoind><transaction-fees>
20% difference between settxfee and actual transaction
Kerem atam
# 20% difference between settxfee and actual transaction

(Asked by: username_0 on 2018-06-02)

I set transaction fee with :
$ bitcoin-cli settxfee 0.00003000

Here is what i observe from block explorer for my transaction :
https://testnet.blockexplorer.com/tx/789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3
Fee Rate    0.000036 BTC per kB

I've tested with different transaction fees for several times; difference always 20% more.
I am on testnet3; using bitcoind version 0.16.0
Edit :
As Adam's answer; now i am more skeptical about byte calculation of blockchain monitoring sites (or whatever they are called).
I've inspected my transaction with getransaction call.
But i still dont see fee per kB is matching with calculation. According to hex parameter; it should be 250 bytes. So total fee should be 0.00000750. Shouldn't i take hex  parameter as size of transaction?
If adam's calculation correct; (seem like it is) then 180 * 0.00003000 / 1024 = 0.00000527. Closest answer so far with %4.5 difference.
Is my calculation correct?
bitcoin-cli gettransaction 789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3
{
  "amount": -0.00005000,
  "fee": -0.00000504,
  "confirmations": 190,
  "blockhash": "0000000000000287661d724d67bed9c1a8861179413e056ee0d16a8b132ad380",
  "blockindex": 12,
  "blocktime": 1527979564,
  "txid": "789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3",
  "walletconflicts": [
  ],
  "time": 1527979516,
  "timereceived": 1527979516,
  "bip125-replaceable": "no",
  "details": [
    {
      "account": "",
      "address": "momFk8PtAZoN4j7Y6jnbucEfc6teUKECEB",
      "category": "send",
      "amount": -0.00005000,
      "vout": 0,
      "fee": -0.00000504,
      "abandoned": false
    }
  ],
  "hex": "020000000001014bb52fb3493598763b53d5ba3cb41f2486cd1ec1b61bae2727d2b9fc74a7454800000000171600148febee6ac4a40d4474c2665c77bbf02350d1bb63feffffff0288130000000000001976a9145a756559278c3795092c07f49c6cf47d360bb1be88acc7c70f000000000017a914849901fe3e003ebf5be1afaf737305158d8865a58702483045022100e23a7e22a21da25f3363bbccbe0bfc94f8044e48236f20b595a456f6bc6d708b02206fc6acdc3636904458cd81770a346a75cc7d5e8ad3868168e387c9cff521b9680121038dc51cc27a4ae2f7ae52503ae4a23862cde107001b59a65639522925527a3e4788291400"
}

**Tags:** bitcoind, transaction-fees

> **Comments:**
> **username_1**: It's likely a difference between fee calculation using segwit and non-segwit sizes.  

---

## 1 answers

### Answer by username_2 on 2018-06-03. Score: 1 | Accepted answer

The problem is not with bitcoin core, it's definitely of the block explorer.
Transaction size is 104 + 32 + 34 + 10 = 180 byte, they are saying transaction size 140 byte. I don't understand how did they calculate it.
Blockchain.info saying transactions size is 250
You should not trust them for that matters, try 
bitcoin-cli gettransaction 789d578d22ee07e11ceca9e94aacbf51d36a41223f792035cac26e91830f39c3

and see transaction size.

> **Comments:**
> **username_0**: You are right. But still i coundnt reach the exact calculation. I have shared output of gettransaction call.  
> **username_2**: You can't reach exact calculation because transaction header size isn't always 10 byte and input size as well, take a look at this answer [here](https://bitcoin.stackexchange.com/questions/43154/how-is-transaction-fee-calculated)  
> **username_0**: Got it! How about bitcoin-cli command output. I cant see 180 but 250 as blockchain.info  
> **username_2**: where do you see 250 byte?  
> **username_0**: hex parameter in gettransaction returns 250 byte value  
> **username_3**: The size that matters is the virtual size (or 1/4th of the weight), which takes the SegWit discount into account), not the byte size.  
> **username_0**: Thanks for explanations. @PieterWuille can you suggest comprehensive documentation where i can calculate my transaction in detail for different address types. Seriously; i am sick of wandering around Github repos and Stackexchange topics.  
> **username_3**: Weight is defined in BIP141 as 3*bytes_when_serialized_without_witnesses + bytes_when_serialized_with_witnesses.  

---

