Author

Topic: Is there a way to reduce tx sizes? (Read 353 times)

legendary
Activity: 3472
Merit: 4801
June 19, 2017, 09:59:14 AM
#9
The fee you pay when you send bitcoins is all about how you receive the bitcoins.

. . . The size (in bytes) of a transaction depends on the number of inputs and the number of outputs.

The transaction will typically have 10 bytes required for the framework of the transaction.

If you are only sending to a single address with your transaction then the transaction will only have 1 or 2 outputs.  Each output is 34 bytes.

Your wallet will choose from the transactions that were paid to you in the past to supply value to the transaction.  Each of the previous payments you received that it chooses adds another input to the transaction.  Each input will probably be 148 bytes.



So, for example, if you previously received 8 payments to your wallet:
  • 0.1 BTC
  • 0.5 BTC
  • 0.04 BTC
  • 0.25 BTC
  • 0.0001 BTC
  • 0.34 BTC
  • 0.0032 BTC
  • 0.9 BTC
  • 0.00005 BTC

And you want to send 1.75 BTC to someone.  Your wallet might choose the following 4 inputs (I've color coded them in red above so you can see them):
  • 0.9 BTC
  • 0.5 BTC
  • 0.34 BTC
  • 0.04 BTC

That provides a total of:
0.9 + 0.5 + 0.34 + 0.04 = 1.78 BTC of value to the transaction.

Now your wallet creates 1 output of 1.75 BTC to send the bitcoins where you wanted them to go.

This leaves:
1.78 BTC - 1.75 BTC = 0.03 BTC of value remaining in the transaction.

The total size of the transaction so far is:
(4 inputs X 148 bytes each) + (1 output X 34 bytes each) + 10 bytes = 636 bytes.

If the transaction doesn't do anything with that extra 0.03 BTC, then it becomes a transaction fee.
That would be an excessive fee:
0.03 BTC / 636 bytes = 0.00004717 BTC (or 4717 satoshis) per byte.

Lets imagine for a moment that 180 satoshis (0.00000180 BTC) per byte is a reasonable fee...

So the transaction needs ANOTHER output so it can send the excess "change" BTC back into the wallet (sort of like getting $15 in change when you pay with a $20 bill for something that costs $5).

This extra output will add another 34 bytes to the transaction.  The transaction is now 670 bytes.

So, since we are imagining that we want to pay 180 satoshis per byte, and the final transaction size is 670 bytes (4 inputs and 2 outputs) we need a fee of:
180 satoshis per byte X 670 bytes = 120600 satoshis (or 0.001206 BTC).



Now lets imagine that you are using a faucet to collect BTC (that's a HORRIBLE idea). Let's say the faucet pays you 0.00001 BTC every 60 seconds, and you find a way to work the faucet 24 hours a day without missing a payment.

After 1 month, you will have collected 43,200 payments of 0.00001 BTC each.  You will have a total of 0.432 BTC.

Now you want to send 0.01 BTC to someone.

Your wallet needs to choose 1000 of those 0.00001 BTC payments to add up to 0.01 BTC. That's 1000 inputs!.

1000 inputs X 148 bytes per input = 148000 bytes.

Even if you only have 1 (34 bytes) output (plus the 10 bytes of framework), that's still 148044 bytes.

If the fee is going to be 180 satoshis per byte, then your fee to send the transaction will be:
180 satoshis per byte * 148044 bytes = 26647920 satoshis (or 0.26647920 BTC).



As you can see, the fee doesn't depend on the amount of BTC being sent.

In the first example, you can send 1.75 BTC with a fee of only 0.001206 BTC

In the second example, sending 0.01 BTC requires a fee of 0.2664792 BTC

So, the lesson is not to receive small payments if you can avoid it, and use wallet software that does a good job of optimizing which received payments to spend so that it can minimize the inputs and outputs in the long run.
legendary
Activity: 1904
Merit: 1074
June 19, 2017, 09:52:18 AM
#8
best thing is.. im guessing u do alot of sigcampaigns.. so instead of taking a daily /weekly withdrawal.. let your balance pile up and take a fortnightly/monthly withdrawal

(wording it in fiat terms to dismiss petty knitpick of random use of satoshi amounts which meanders away from the concept discussion)

EG if you make $1 a day stop asking for $1 a day and instead ask for $28 every 4 weeks

then when you get it ull have one unspend output of $28 instead of 28 outputs of $1..
to then use as a single input when you want to spend it

Yes, this might work BUT most signature campaigns turn scam and you would be wasting a whole months of posting IF the signature campaign

turns scam. The weekly payment option is the best bet, because it mitigates the risk. You can also pay the minimum fee, if you are not in a

hurry to spend the coins and just wait it out.  Wink
hero member
Activity: 546
Merit: 500
June 19, 2017, 09:49:00 AM
#7
best thing is.. im guessing u do alot of sigcampaigns.. so instead of taking a daily /weekly withdrawal.. let your balance pile up and take a fortnightly/monthly withdrawal

(wording it in fiat terms to dismiss petty knitpick of random use of satoshi amounts which meanders away from the concept discussion)

EG if you make $1 a day stop asking for $1 a day and instead ask for $28 every 4 weeks

then when you get it ull have one unspend output of $28 instead of 28 outputs of $1..
to then use as a single input when you want to spend it

No I'm not doing a lot of signature campaigns mate. I just make a lot of transactions from 20-500$ and I'd like to find an efficient way to spend my money without paying huge fees. I know about the rush hours and I'm not always in the position to wait and send the tx later.
Simply put, I noticed that some tx's of big value have a smaller size than smaller value tx's. So logically there should be a way to merge the coins somehow in order to minimize the fees in general.

@ralle14, I've done almost the same thing, I did spread 5BTC in sites with 2fa and a decent history, they somehow manage to keep their tx's in low size but I keep the rest in trezor.

@ranochigo, my question is about their size in kb, how it's gained or lost and how (and if) we can take advantage of it somehow.
You can reduce it by having less inputs.

Think of it in fiat terms - you accept fifty coins and spend them in a shop instead of spending one.  It's a hell of a lot harder to spend that money.  The same applies in Bitcoin - the more inputs you have in your transaction, the higher the size of the transaction will be and vice versa.

So ideally you'd only accept large amounts less regularly, rather than small amounts regularly.
legendary
Activity: 1372
Merit: 1252
June 19, 2017, 09:39:16 AM
#6
I've been noticing these differences for a while, is there a way to reduce the size of your coins? I've tried sending coins to the same address only to increase the end size of the next tx and pay more fees. Thanks Smiley

How so? If you were to select inputs and spend it to yourself, you would effectively be combining those inputs and that was what I was doing sometime ago. You can choose a small fee for those kind of transactions if you don't need the funds in the near future. Anyway, you can accelerate your transaction using ViaBTC's interface[1]. You just need a fee of 0.0001BTC/KB.

[1] https://www.viabtc.com/tools/txaccelerator/

Don't use anything provided by ViaBTC. They are garbage.

Anyway, just request higher payments. The more inputs you get, the bigger the transaction fee, so request that payments are dealt monthly and not weekly. Bitmixer should look into that, I don't see why it has to be weekly and not monthly.

With segwit activating soon hopefully we get lightning network so we can end this nonsense.
sr. member
Activity: 325
Merit: 250
Carpe noctem
June 19, 2017, 09:35:38 AM
#5
best thing is.. im guessing u do alot of sigcampaigns.. so instead of taking a daily /weekly withdrawal.. let your balance pile up and take a fortnightly/monthly withdrawal

(wording it in fiat terms to dismiss petty knitpick of random use of satoshi amounts which meanders away from the concept discussion)

EG if you make $1 a day stop asking for $1 a day and instead ask for $28 every 4 weeks

then when you get it ull have one unspend output of $28 instead of 28 outputs of $1..
to then use as a single input when you want to spend it

No I'm not doing a lot of signature campaigns mate. I just make a lot of transactions from 20-500$ and I'd like to find an efficient way to spend my money without paying huge fees. I know about the rush hours and I'm not always in the position to wait and send the tx later.
Simply put, I noticed that some tx's of big value have a smaller size than smaller value tx's. So logically there should be a way to merge the coins somehow in order to minimize the fees in general.

@ralle14, I've done almost the same thing, I did spread 5BTC in sites with 2fa and a decent history, they somehow manage to keep their tx's in low size but I keep the rest in trezor.

@ranochigo, my question is about their size in kb, how it's gained or lost and how (and if) we can take advantage of it somehow.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
June 19, 2017, 09:26:59 AM
#4
I've been noticing these differences for a while, is there a way to reduce the size of your coins? I've tried sending coins to the same address only to increase the end size of the next tx and pay more fees. Thanks Smiley

How so? If you were to select inputs and spend it to yourself, you would effectively be combining those inputs and that was what I was doing sometime ago. You can choose a small fee for those kind of transactions if you don't need the funds in the near future. Anyway, you can accelerate your transaction using ViaBTC's interface[1]. You just need a fee of 0.0001BTC/KB.

[1] https://www.viabtc.com/tools/txaccelerator/
legendary
Activity: 3374
Merit: 1922
Shuffle.com
June 19, 2017, 09:15:36 AM
#3
I've been using Bitcoin for quite some time now & while I know transaction fees are measured in Satoshis/Kb the thing I'm keen on is how for example a 1.18BTC tx can be something less than 720 Bytes, while another tx of just a mere 0.02BTC would be 1.12kb & cost more in fees.

I've been noticing these differences for a while, is there a way to reduce the size of your coins? I've tried sending coins to the same address only to increase the end size of the next tx and pay more fees. Thanks Smiley

I've experienced the same problem, there's no way to reduce the transaction size if you keep receiving small portion of bitcoins. One thing I did was to wait for the right time when sending bitcoins to avoid paying high fees.  I also thought of letting my bitcoins sit in a gambling/exchange account to avoid this situation but seems risky.
legendary
Activity: 4424
Merit: 4794
June 19, 2017, 08:56:27 AM
#2
best thing is.. im guessing u do alot of sigcampaigns.. so instead of taking a daily /weekly withdrawal.. let your balance pile up and take a fortnightly/monthly withdrawal

(wording it in fiat terms to dismiss petty knitpick of random use of satoshi amounts which meanders away from the concept discussion)

EG if you make $1 a day stop asking for $1 a day and instead ask for $28 every 4 weeks

then when you get it ull have one unspend output of $28 instead of 28 outputs of $1..
to then use as a single input when you want to spend it
sr. member
Activity: 325
Merit: 250
Carpe noctem
June 19, 2017, 08:30:15 AM
#1
I've been using Bitcoin for quite some time now & while I know transaction fees are measured in Satoshis/Kb the thing I'm keen on is how for example a 1.18BTC tx can be something less than 720 Bytes, while another tx of just a mere 0.02BTC would be 1.12kb & cost more in fees.

I've been noticing these differences for a while, is there a way to reduce the size of your coins? I've tried sending coins to the same address only to increase the end size of the next tx and pay more fees. Thanks Smiley

Edit:I'm parsing the best answer I could find here, I hope it helps more people!  Smiley
The fee you pay when you send bitcoins is all about how you receive the bitcoins.

. . . The size (in bytes) of a transaction depends on the number of inputs and the number of outputs.

The transaction will typically have 10 bytes required for the framework of the transaction.

If you are only sending to a single address with your transaction then the transaction will only have 1 or 2 outputs.  Each output is 34 bytes.

Your wallet will choose from the transactions that were paid to you in the past to supply value to the transaction.  Each of the previous payments you received that it chooses adds another input to the transaction.  Each input will probably be 148 bytes.



So, for example, if you previously received 8 payments to your wallet:
  • 0.1 BTC
  • 0.5 BTC
  • 0.04 BTC
  • 0.25 BTC
  • 0.0001 BTC
  • 0.34 BTC
  • 0.0032 BTC
  • 0.9 BTC
  • 0.00005 BTC

And you want to send 1.75 BTC to someone.  Your wallet might choose the following 4 inputs (I've color coded them in red above so you can see them):
  • 0.9 BTC
  • 0.5 BTC
  • 0.34 BTC
  • 0.04 BTC

That provides a total of:
0.9 + 0.5 + 0.34 + 0.04 = 1.78 BTC of value to the transaction.

Now your wallet creates 1 output of 1.75 BTC to send the bitcoins where you wanted them to go.

This leaves:
1.78 BTC - 1.75 BTC = 0.03 BTC of value remaining in the transaction.

The total size of the transaction so far is:
(4 inputs X 148 bytes each) + (1 output X 34 bytes each) + 10 bytes = 636 bytes.

If the transaction doesn't do anything with that extra 0.03 BTC, then it becomes a transaction fee.
That would be an excessive fee:
0.03 BTC / 636 bytes = 0.00004717 BTC (or 4717 satoshis) per byte.

Lets imagine for a moment that 180 satoshis (0.00000180 BTC) per byte is a reasonable fee...

So the transaction needs ANOTHER output so it can send the excess "change" BTC back into the wallet (sort of like getting $15 in change when you pay with a $20 bill for something that costs $5).

This extra output will add another 34 bytes to the transaction.  The transaction is now 670 bytes.

So, since we are imagining that we want to pay 180 satoshis per byte, and the final transaction size is 670 bytes (4 inputs and 2 outputs) we need a fee of:
180 satoshis per byte X 670 bytes = 120600 satoshis (or 0.001206 BTC).



Now lets imagine that you are using a faucet to collect BTC (that's a HORRIBLE idea). Let's say the faucet pays you 0.00001 BTC every 60 seconds, and you find a way to work the faucet 24 hours a day without missing a payment.

After 1 month, you will have collected 43,200 payments of 0.00001 BTC each.  You will have a total of 0.432 BTC.

Now you want to send 0.01 BTC to someone.

Your wallet needs to choose 1000 of those 0.00001 BTC payments to add up to 0.01 BTC. That's 1000 inputs!.

1000 inputs X 148 bytes per input = 148000 bytes.

Even if you only have 1 (34 bytes) output (plus the 10 bytes of framework), that's still 148044 bytes.

If the fee is going to be 180 satoshis per byte, then your fee to send the transaction will be:
180 satoshis per byte * 148044 bytes = 26647920 satoshis (or 0.26647920 BTC).



As you can see, the fee doesn't depend on the amount of BTC being sent.

In the first example, you can send 1.75 BTC with a fee of only 0.001206 BTC

In the second example, sending 0.01 BTC requires a fee of 0.2664792 BTC

So, the lesson is not to receive small payments if you can avoid it, and use wallet software that does a good job of optimizing which received payments to spend so that it can minimize the inputs and outputs in the long run.
Jump to: