Author

Topic: Non-zero final balance of input address (Read 165 times)

staff
Activity: 4284
Merit: 8808
October 28, 2020, 07:22:09 PM
#4
When your wallet chooses inputs, it doesn't seem to consider addresses at all. If you want to ensure that an address has no balance after being used as an input, you should receive bitcoins at the address only once.
Current versions of Bitcoin core will first try to spend all outputs paid to a common address as a group.

That behavior is controlled by two options:

Quote
    -avoidpartialspends
       Group outputs by address, selecting all or none, instead of selecting on
       a per-output basis. Privacy is improved as an address is only
       used once (unless someone sends to it after spending from it),
       but may result in slightly higher fees as suboptimal coin
       selection may result due to the added limitation (default: 0
       (always enabled for wallets with "avoid_reuse" enabled))

     -maxapsfee=
       Spend up to this amount in additional (absolute) fees (in BTC) if it
       allows the use of partial spend avoidance (default: 0.00)


The first, if enabled, forces all payments to the same address to always be grouped.

Otherwise,  it tries computing the transaction both ways, and if the grouped way doesn't pay more than a threshold amount of fees more then it uses the grouped way.  The default threshold is the conservative value of 0.  ... so it will prefer to group the inputs, but only if doing so doesn't make it pay more in total fees.


This is still kinda dumb: the threshold should probably be in terms of fee ABOVE the minimum feerate (e.g. so if your transaction is at the minimum feerate, it'll always do it, because you were going to pay the minimum feerate eventually in any case)... but at least it's something.
legendary
Activity: 4522
Merit: 3426
October 28, 2020, 03:32:14 AM
#3
I sent an amount to an address and my transaction has as input multiple addresses of my wallet. As a result, most of the input addresses have a non-zero final balance after the transaction. Is this normal? I know that there is a security issue if you use an address as input and it still has a positive balance after the transaction. I have seen this topic explained by Antonopoulos but I don't know if it is an important security issue. Is there a way to make my used addresses to have 0 final balance?

When your wallet chooses inputs, it doesn't seem to consider addresses at all. If you want to ensure that an address has no balance after being used as an input, you should receive bitcoins at the address only once.
legendary
Activity: 1463
Merit: 1886
October 27, 2020, 07:30:46 PM
#2
I wrote a technical reply, but I realize it's probably on the wrong level.

I know that there is a security issue if you use an address as input and it still has a positive balance after the transaction.

Theoretically. And people love flexing this bit of trivia, but in reality it's not an issue. There's literally tens of billions of dollars of bitcoin with an exposed public key (the problem with having a positive balance after a transaction), and it's never been a real concern.

But the best way to avoid this is is to try not to reuse addresses. Sometimes it's going to be unavoidable (people will unsolicited send you money, normally tiny amounts) but generally with a bit of effort you can create a new address for every time you receive money. There are some nice privacy (and organizational) benefits to doing this.

So yeah, try avoid re-using addresses. But don't worry about your money getting jacked if you don't.

Quote
Is there a way to make my used addresses to have 0 final balance?
Some wallets (but most won't) will try spend all money from an address when spending from that address. It's done for privacy reasons really, but generally done at the expense of less desirable coin-selection [Although most wallets are literally so bad at coin selection that it's actually hard to do worse]
newbie
Activity: 13
Merit: 1
October 27, 2020, 06:47:51 PM
#1
I sent an amount to an address and my transaction has as input multiple addresses of my wallet. As a result, most of the input addresses have a non-zero final balance after the transaction. Is this normal? I know that there is a security issue if you use an address as input and it still has a positive balance after the transaction. I have seen this topic explained by Antonopoulos but I don't know if it is an important security issue. Is there a way to make my used addresses to have 0 final balance?
Jump to: