Bitcoin Forum
November 11, 2024, 05:02:38 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How big is transaction is? (Per KB)  (Read 2165 times)
ANON.PURGED (OP)
Sr. Member
****
Offline Offline

Activity: 504
Merit: 250


View Profile WWW
May 18, 2015, 09:37:01 AM
 #1

How to calculate the size of transaction ?

For example
Code:
1 BTC = 3125512KB ?

So i can set transaction fees
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
May 18, 2015, 09:46:18 AM
 #2

Assuming all the inputs you are spending are from regular "pay to address" transactions, each input will contribute 180 (plus or minus 1) bytes to the transaction. Each output adds 34 bytes to the transaction. And there's a fixed extra 10 bytes which are always present.

The "plus or minus 1" comes from the fact that each input needs a signature to be claimed. The signature contains two 32 byte values, but if either of the values has a first byte of 0x80 or more, it has a 0x00 byte prepended to it. So I'm assuming one of the two is high and the other is low. That way I'm off by at most one byte per input.

So if your transaction has in inputs and out outputs, the transaction size, in bytes will be:

in*180 + out*34 + 10 plus or minus 'in'

Recommended fee is 0.0001BTC/1000 bytes. All popular wallets calculate fees automatically.

Read

http://bitcoin.stackexchange.com/questions/1195/how-to-calculate-transaction-size-before-sending
http://bitcoin.stackexchange.com/questions/7537/calculator-for-estimated-tx-fees

ANON.PURGED (OP)
Sr. Member
****
Offline Offline

Activity: 504
Merit: 250


View Profile WWW
May 18, 2015, 09:51:34 AM
 #3

Assuming all the inputs you are spending are from regular "pay to address" transactions, each input will contribute 180 (plus or minus 1) bytes to the transaction. Each output adds 34 bytes to the transaction. And there's a fixed extra 10 bytes which are always present.

The "plus or minus 1" comes from the fact that each input needs a signature to be claimed. The signature contains two 32 byte values, but if either of the values has a first byte of 0x80 or more, it has a 0x00 byte prepended to it. So I'm assuming one of the two is high and the other is low. That way I'm off by at most one byte per input.

So if your transaction has in inputs and out outputs, the transaction size, in bytes will be:

in*180 + out*34 + 10 plus or minus 'in'

Recommended fee is 0.0001BTC/1000 bytes. All popular wallets calculate fees automatically.

Read

http://bitcoin.stackexchange.com/questions/1195/how-to-calculate-transaction-size-before-sending
http://bitcoin.stackexchange.com/questions/7537/calculator-for-estimated-tx-fees

Im sorry? Im noob? cant understand

How to calculate transaction size (kb)
koelen3
Legendary
*
Offline Offline

Activity: 1022
Merit: 1007


Sooner or later, a man who wears two faces forgets


View Profile
May 18, 2015, 09:56:22 AM
 #4

How to calculate the size of transaction ?

For example
Code:
1 BTC = 3125512KB ?

So i can set transaction fees

Are you asking that 1 BTC = 3125512 KB OR Saying that what if the TX is this Big in KB so what will be the fees?
The Size depends on number of inputs and outputs for the transaction .
Theoretically , 1 BTC if lies in a wallet for a day can be sent without fee but i don't recommend you to do it! Always pay your Miner's fee .
Anything below 0.01 should always have fees paid to go through .
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4832



View Profile
May 18, 2015, 10:25:15 AM
Last edit: May 18, 2015, 10:56:53 AM by DannyHamilton
 #5

Im sorry? Im noob? cant understand

How to calculate transaction size (kb)

Count the number of inputs in the transaction.  Multiply that number by 181.
Count the number of outputs in the transaction. Multiply that number by 34.
Compute the sum of those two numbers and add 10.
Divide the result by 1000.

That is the approximate size of the transaction in kB.

EDIT:

Example 1:
  • You start with an empty wallet
  • You receive a single transaction for 1 BTC.
  • Your wallet now has 1 unspent output that it can use as an input into a transaction.
  • You attempt to send this 1 BTC to a bitcoin address.
  • 1 input = 181 bytes
  • 1 output = 34 bytes
  • 10 additional bytes of transaction information
  • Total transaction size is approximately (181 + 34 + 10) / 1000 = 0.225 kB

Example 2:
  • You start with an empty wallet
  • You receive six transactions for 0.18 BTC each (a total of 1.08 BTC).
  • Your wallet now has 6 unspent outputs that it can use as inputs into a transaction.
  • You attempt to send 1 BTC to a bitcoin address (and to send the remaining 0.08 BTC back to your wallet as change).
  • 6 inputs = 181 * 6 = 1086 bytes
  • 2 outputs = 34 * 2 = 68 bytes
  • 10 additional bytes of transaction information
  • Total transaction size is approximately (1086 + 68 + 10) / 1000 = 1.164 kB
ANON.PURGED (OP)
Sr. Member
****
Offline Offline

Activity: 504
Merit: 250


View Profile WWW
May 18, 2015, 10:32:09 AM
 #6

Im sorry? Im noob? cant understand

How to calculate transaction size (kb)

Count the number of inputs in the transaction.
That is the approximate size of the transaction in kB.

Counting the number of inputs / output needs a trasaction to be sent right?

Nope, That is not what is mean, I mean knowing the total size of kb before sending transaction
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4832



View Profile
May 18, 2015, 10:39:21 AM
Last edit: May 18, 2015, 10:56:27 AM by DannyHamilton
 #7

Im sorry? Im noob? cant understand

How to calculate transaction size (kb)

Count the number of inputs in the transaction.
That is the approximate size of the transaction in kB.

Counting the number of inputs / output needs a trasaction to be sent right?

Nope, That is not what is mean, I mean knowing the total size of kb before sending transaction

Transactions have a size.  Bitcoins do not have a size.

Without building a transaction, you cannot know the size.  You don't need to send the transaction, but you do need to build it.

See my post above, I've edited it to add additional information.

Both examples attempt to send 1 BTC to someone.  In one example the transaction size is 0.225 kB, in the other example the transaction is 1.164 kB
Muhammed Zakir
Hero Member
*****
Offline Offline

Activity: 560
Merit: 509


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
May 18, 2015, 10:55:32 AM
 #8

Im sorry? Im noob? cant understand

How to calculate transaction size (kb)

Count the number of inputs in the transaction.
That is the approximate size of the transaction in kB.

Counting the number of inputs / output needs a trasaction to be sent right?

Nope, That is not what is mean, I mean knowing the total size of kb before sending transaction

Wallets don't show size before sending transaction as they choose fees automatically. You can rither create transaction by yourself(which I don't think you will) or calculate an estimate fee by following DannyHamilton's guide.

Count the number of inputs in the transaction.  Multiply that number by 181.
Count the number of outputs in the transaction. Multiply that number by 34.
Compute the sum of those two numbers and add 10.
Divide the result by 1000.

That is the approximate size of the transaction in kB.
 -snip-

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!