Bitcoin Forum
April 25, 2024, 06:24:56 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Transaction size WTF???  (Read 235 times)
MakFrogz (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 1


View Profile
May 21, 2019, 10:48:38 AM
 #1

Hi guys!

Look, we can calculate transaction size approximately by using formula in*148 + out*34 +10 +/- in.

Okey, i took one transaction from explorer with 4 inputs, 2 outputs and size was 1,392 bytes.


Calculate size manual:

4*148 + 2*34 + 10 +/- 4 = 670 +/-4

Can someone explain to me whyyy?
1714026296
Hero Member
*
Offline Offline

Posts: 1714026296

View Profile Personal Message (Offline)

Ignore
1714026296
Reply with quote  #2

1714026296
Report to moderator
1714026296
Hero Member
*
Offline Offline

Posts: 1714026296

View Profile Personal Message (Offline)

Ignore
1714026296
Reply with quote  #2

1714026296
Report to moderator
1714026296
Hero Member
*
Offline Offline

Posts: 1714026296

View Profile Personal Message (Offline)

Ignore
1714026296
Reply with quote  #2

1714026296
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714026296
Hero Member
*
Offline Offline

Posts: 1714026296

View Profile Personal Message (Offline)

Ignore
1714026296
Reply with quote  #2

1714026296
Report to moderator
1714026296
Hero Member
*
Offline Offline

Posts: 1714026296

View Profile Personal Message (Offline)

Ignore
1714026296
Reply with quote  #2

1714026296
Report to moderator
NeuroticFish
Legendary
*
Offline Offline

Activity: 3654
Merit: 6365


Looking for campaign manager? Contact icopress!


View Profile
May 21, 2019, 11:11:01 AM
 #2

You should start with providing the transaction Id, maybe somebody can help on real data.
Afaik the simple rule is OK for legacy transaction; SegWit, especially from 3* addresses, are bigger.

Some other/older clues can be in this thread (which I didn't actually read) https://bitcointalk.org/index.php?topic=1291540.0

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
May 21, 2019, 11:29:41 AM
Merited by ABCbits (1), Coding Enthusiast (1)
 #3

The numbers you have quoted are only accurate for P2PKH outputs and P2PKH inputs. All other outputs and inputs have different values. For the majority of these, such as standard P2SH or bech32 SegWit, the size will be smaller, but there are some P2SH addresses (notably multisig) with much larger sizes, up to several hundred bytes per input.

Link to the transaction you are analyzing and perhaps we can help further.
MakFrogz (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 1


View Profile
May 21, 2019, 11:51:55 AM
 #4

Transaction id: 346a4733f64874102f6cc18c552d9e6862947a59ea02815b2fb434e450714bdd
NeuroticFish
Legendary
*
Offline Offline

Activity: 3654
Merit: 6365


Looking for campaign manager? Contact icopress!


View Profile
May 21, 2019, 12:29:36 PM
 #5

Transaction id: 346a4733f64874102f6cc18c552d9e6862947a59ea02815b2fb434e450714bdd

I think that's testnet "legacy compatible segwit".
Also for SegWit the number of bytes doesn't matter that much, the calculation goes by vBytes.

I don't know a simple formula, however, this is what I've found for you:
https://bitcoin.stackexchange.com/questions/87275/how-to-calculate-segwit-transaction-fee-in-bytes
https://gist.github.com/junderw/b43af3253ea5865ed52cb51c200ac19c
https://www.reddit.com/r/Bitcoin/comments/7m8ald/how_do_i_calculate_my_fees_for_a_transaction_sent/  (read the comments)

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
bitmover
Legendary
*
Offline Offline

Activity: 2282
Merit: 5883


bitcoindata.science


View Profile WWW
May 21, 2019, 12:42:45 PM
 #6

Transaction id: 346a4733f64874102f6cc18c552d9e6862947a59ea02815b2fb434e450714bdd

I think that's testnet "legacy compatible segwit".

That's really testnet. Why don't you try on the mainnet,?

https://live.blockcypher.com/btc-testnet/tx/346a4733f64874102f6cc18c552d9e6862947a59ea02815b2fb434e450714bdd/

I think 1300 bytes is a lot to. Something may be different because of testnet?. I simulated here https://www.buybitcoinworldwide.com/fee-calculator/ and the total was 600 for legacy and 450 for segwit.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
MakFrogz (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 1


View Profile
May 21, 2019, 02:17:16 PM
 #7

One more example
Size: 1,360 bytes, 4 inputs and one output.

Code:
{
  "status" : "success",
  "data" : {
    "network" : "BTCTEST",
    "txid" : "09da6cd256e7281623bfc7697195c5dbe7b802ad7b3d9d1316046228be5910da",
    "blockhash" : "00000000000002199acefe80fb48a8291b41ea77f60a7ce9f993e4562ca44116",
    "block_no" : 1517813,
    "confirmations" : 1,
    "time" : 1558447791,
    "version" : 1,
    "locktime" : 0,
    "sent_value" : "0.00800000",
    "fee" : "0.00185554",
    "inputs" : [
      {
        "input_no" : 0,
        "address" : "2MvUtaocsd8oAxxghimgG2Zwqwz8iN53uUv",
        "value" : "0.00200000",
        "received_from" : {
          "txid" : "f3a7b4da9739bc80427ff0e33ad2054a1206b5e4413abe48bd478543c01f164a",
          "output_no" : 8
        },
        "script_asm" : "0020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6c",
        "script_hex" : "220020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6c",
        "witness" : [
          "",
          "30450221009788300c030726aa5fd6119f0de387a53b571dfe50421d1601295360722ebec5022028b8b9a61a521e4fbf38051a1ceb13ed48d062e7c337f87cdcb61a44c3ac68b901",
          "30450221009aa556ea53b6d934adb2f0b962c6e3bb31064a7236fcc03af1e16c26c96e72230220114717521b6fafb6dc1f271b2551ed3bc61a1f3768e33d8d16891607fdd12bff01",
          "52210231f0ba0b4a867e1e3d995ec508b03db52cce50ea1bfc31fb10101633b410b50d210328f8d004c408e43110468760ac44a3a6a7f6737da7e05a0e62893ae4ea7ce5d32103cc7cff5ffb6e147ee97e5e5a383ceefc26f6de6e6d2de52d5384070de7c0e15c53ae"
        ]
      },
      {
        "input_no" : 1,
        "address" : "2MvUtaocsd8oAxxghimgG2Zwqwz8iN53uUv",
        "value" : "0.00200000",
        "received_from" : {
          "txid" : "f3a7b4da9739bc80427ff0e33ad2054a1206b5e4413abe48bd478543c01f164a",
          "output_no" : 19
        },
        "script_asm" : "0020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6c",
        "script_hex" : "220020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6c",
        "witness" : [
          "",
          "304402202b730b52539c2da05ac9c440cfffa8a6c4546643b69fa6e969f05c4eae81134a0220554f8e0bd690e693771a2345f5d39380a184f303470a7ae097bfa965a4b6cdd901",
          "304402207d8ca23361b513b8f3e32005a1b81c70c49b49a166887ac86301e3098c0d3e0d02203ac116ef4455dfb7700a8498fd0e345b0084bd36be7734e062db7631388f690101",
          "52210231f0ba0b4a867e1e3d995ec508b03db52cce50ea1bfc31fb10101633b410b50d210328f8d004c408e43110468760ac44a3a6a7f6737da7e05a0e62893ae4ea7ce5d32103cc7cff5ffb6e147ee97e5e5a383ceefc26f6de6e6d2de52d5384070de7c0e15c53ae"
        ]
      },
      {
        "input_no" : 2,
        "address" : "2MvUtaocsd8oAxxghimgG2Zwqwz8iN53uUv",
        "value" : "0.00200000",
        "received_from" : {
          "txid" : "f3a7b4da9739bc80427ff0e33ad2054a1206b5e4413abe48bd478543c01f164a",
          "output_no" : 42
        },
        "script_asm" : "0020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6c",
        "script_hex" : "220020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6c",
        "witness" : [
          "",
          "304402207b9f36e5fab0713f968de835bbfb44eb157402e79561b9ecd86409ab1c914d8b02206efa6f5b0fcff27cf8a71c40bb448d33b61022c47d5b374b5f5723b197d456e401",
          "3044022057d48b41e19ea228136585d2e0e0f12011759549c97388b0e3392bd073f65c340220582aa800624b4000f64fdf3f9ba8b9c43f41388e68604fb6154f3ccc85d88c9801",
          "52210231f0ba0b4a867e1e3d995ec508b03db52cce50ea1bfc31fb10101633b410b50d210328f8d004c408e43110468760ac44a3a6a7f6737da7e05a0e62893ae4ea7ce5d32103cc7cff5ffb6e147ee97e5e5a383ceefc26f6de6e6d2de52d5384070de7c0e15c53ae"
        ]
      },
      {
        "input_no" : 3,
        "address" : "2MvUtaocsd8oAxxghimgG2Zwqwz8iN53uUv",
        "value" : "0.00200000",
        "received_from" : {
          "txid" : "f3a7b4da9739bc80427ff0e33ad2054a1206b5e4413abe48bd478543c01f164a",
          "output_no" : 70
        },
        "script_asm" : "0020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6c",
        "script_hex" : "220020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6c",
        "witness" : [
          "",
          "30450221009356066a417e04036b3116297758914169ad1f451dc6765a9a05851e540e05e002207947f5a3d61fdba58b3b7ee456e2fa089ee12ac2517565a8f206377728eb23bc01",
          "3045022100da5fee3f655c7747341c997526a35fd1fd1e9a6b8cfacc942eedbc294e4e90580220756534f9f2c991cf1c4dc544989e1854015045cd204af1e0e9090d9919d730ea01",
          "52210231f0ba0b4a867e1e3d995ec508b03db52cce50ea1bfc31fb10101633b410b50d210328f8d004c408e43110468760ac44a3a6a7f6737da7e05a0e62893ae4ea7ce5d32103cc7cff5ffb6e147ee97e5e5a383ceefc26f6de6e6d2de52d5384070de7c0e15c53ae"
        ]
      }
    ],
    "outputs" : [
      {
        "output_no" : 0,
        "address" : "2MuNttpkNFcbUcfQw5mwxqsoh4ehnWWHkdz",
        "value" : "0.00614446",
        "type" : "scripthash",
        "req_sigs" : 1,
        "spent" : {
          "txid" : "52b3e898712ca5dfa65044d4cdd74eeab17e86355731dcdc5f4046cd95c7cac3",
          "input_no" : 0
        },
        "script_asm" : "OP_HASH160 1763a3e95e08bacc415ec85442b1efca5a1294a4 OP_EQUAL",
        "script_hex" : "a9141763a3e95e08bacc415ec85442b1efca5a1294a487"
      }
    ],
    "tx_hex" : "010000000001044a161fc0438547bd48be3a41e4b506124a05d23ae3f07f4280bc3997dab4a7f30800000023220020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6cffffffff4a161fc0438547bd48be3a41e4b506124a05d23ae3f07f4280bc3997dab4a7f31300000023220020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6cffffffff4a161fc0438547bd48be3a41e4b506124a05d23ae3f07f4280bc3997dab4a7f32a00000023220020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6cffffffff4a161fc0438547bd48be3a41e4b506124a05d23ae3f07f4280bc3997dab4a7f34600000023220020cb113b7b27e04afad667e0d5e4b329f41b22bda3a7e6d8678a7452f4c8b5bb6cffffffff012e6009000000000017a9141763a3e95e08bacc415ec85442b1efca5a1294a48704004830450221009788300c030726aa5fd6119f0de387a53b571dfe50421d1601295360722ebec5022028b8b9a61a521e4fbf38051a1ceb13ed48d062e7c337f87cdcb61a44c3ac68b9014830450221009aa556ea53b6d934adb2f0b962c6e3bb31064a7236fcc03af1e16c26c96e72230220114717521b6fafb6dc1f271b2551ed3bc61a1f3768e33d8d16891607fdd12bff016952210231f0ba0b4a867e1e3d995ec508b03db52cce50ea1bfc31fb10101633b410b50d210328f8d004c408e43110468760ac44a3a6a7f6737da7e05a0e62893ae4ea7ce5d32103cc7cff5ffb6e147ee97e5e5a383ceefc26f6de6e6d2de52d5384070de7c0e15c53ae040047304402202b730b52539c2da05ac9c440cfffa8a6c4546643b69fa6e969f05c4eae81134a0220554f8e0bd690e693771a2345f5d39380a184f303470a7ae097bfa965a4b6cdd90147304402207d8ca23361b513b8f3e32005a1b81c70c49b49a166887ac86301e3098c0d3e0d02203ac116ef4455dfb7700a8498fd0e345b0084bd36be7734e062db7631388f6901016952210231f0ba0b4a867e1e3d995ec508b03db52cce50ea1bfc31fb10101633b410b50d210328f8d004c408e43110468760ac44a3a6a7f6737da7e05a0e62893ae4ea7ce5d32103cc7cff5ffb6e147ee97e5e5a383ceefc26f6de6e6d2de52d5384070de7c0e15c53ae040047304402207b9f36e5fab0713f968de835bbfb44eb157402e79561b9ecd86409ab1c914d8b02206efa6f5b0fcff27cf8a71c40bb448d33b61022c47d5b374b5f5723b197d456e401473044022057d48b41e19ea228136585d2e0e0f12011759549c97388b0e3392bd073f65c340220582aa800624b4000f64fdf3f9ba8b9c43f41388e68604fb6154f3ccc85d88c98016952210231f0ba0b4a867e1e3d995ec508b03db52cce50ea1bfc31fb10101633b410b50d210328f8d004c408e43110468760ac44a3a6a7f6737da7e05a0e62893ae4ea7ce5d32103cc7cff5ffb6e147ee97e5e5a383ceefc26f6de6e6d2de52d5384070de7c0e15c53ae04004830450221009356066a417e04036b3116297758914169ad1f451dc6765a9a05851e540e05e002207947f5a3d61fdba58b3b7ee456e2fa089ee12ac2517565a8f206377728eb23bc01483045022100da5fee3f655c7747341c997526a35fd1fd1e9a6b8cfacc942eedbc294e4e90580220756534f9f2c991cf1c4dc544989e1854015045cd204af1e0e9090d9919d730ea016952210231f0ba0b4a867e1e3d995ec508b03db52cce50ea1bfc31fb10101633b410b50d210328f8d004c408e43110468760ac44a3a6a7f6737da7e05a0e62893ae4ea7ce5d32103cc7cff5ffb6e147ee97e5e5a383ceefc26f6de6e6d2de52d5384070de7c0e15c53ae00000000"
  },
  "code" : 200,
  "message" : ""
}
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<insert witty quote here>


View Profile
May 21, 2019, 10:01:06 PM
 #8

Again, this is using SegWit inputs... and your "calculation" is only valid for P2PKH inputs/outputs.

So while the raw "hex" size might be 1360 bytes... it would appear that it's calculated "virtual size" is only "346 bytes":
Code: (https://api.blockcypher.com/v1/btc/test3/txs/09da6cd256e7281623bfc7697195c5dbe7b802ad7b3d9d1316046228be5910da?limit=50&includeHex=true)
{
  "block_hash": "00000000000002199acefe80fb48a8291b41ea77f60a7ce9f993e4562ca44116",
...
  "size": 346,
...
}

"vsize" = Transaction weight / 4
"weight" = 3 times the stripped_size in bytes (excluding the witness) plus the total_size in bytes (including the witness)

I suggest you go and read these:
https://bitcoin.stackexchange.com/questions/87275/how-to-calculate-segwit-transaction-fee-in-bytes
https://bitcoincore.org/en/segwit_wallet_dev/#transaction-fee-estimation

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!