Author

Topic: Bitcoin transactions as inputs - Someone knowledgeable please clarify (Read 240 times)

HCP
legendary
Activity: 2086
Merit: 4361
So basically most wallets already summarize the inputs?
No. What Danny was saying is that if you have multiple UTXO's, when you go to spend a value that requires you to use several of them, the wallet will include as many as required. For instance, if you have 1, 2, 3 and 4... and you want to spend 8 (ignoring transaction fees Wink)... it will use ALL of them... however, if you want to spend 7.5 it could just use 1,3 and 4... or 2, 3 and 4. This, in effect, is "consolidating" inputs when you spend them...

However, some people like to do this pre-emptively when fee rates are low, so when they need to send a large BTC value transaction during times of high fee rates, it helps minimise the total fee required as the transaction has a smaller data size due to less inputs.


Quote
Does that incur a fee of some sorts? If I summarize 1,2,3,4 into 8 by myself how does the network know my 8 = 1,2,3,4 and it is valid?
It is all done using a standard transaction. You simply "send" the bitcoins to yourself in a transaction that has inputs of 1, 2, 3 and 4... and creates one output of 8... sent to your own address. Obviously, like an other transaction, this will require a fee.


Quote
I assume that is doing something similar to a multisig address to join inputs and outputs?  (I must apologize here I cannot write an essay on multisig yet, and only have a very vague understanding so far. I am still working to understand bitcoin under the hood well )
If this is like a multisig you can just say so an I will google on from there.
MultiSig addresses don't "join inputs and outputs"... MultiSig addresses require multiple signatures from multiple private keys to be able to make a transaction valid: https://en.bitcoin.it/wiki/Multisignature


Quote
The inputs should surely be announced to the network and say "this is the new input that summarizes them" and it needs to be recorded somewhere and agreed upon?
Yes, it is done via a normal transaction and recorded on the blockchain like any other transaction.


Quote
Since this will be a hash of sorts I expect there is no way to know that these 4 inputs = the new input. If you guys can shed some light around that I would appreciate.
Again, it's simply a normal transaction, so anyone can see and verify that those 4 inputs -> new output, as per any other transaction on the blockchain.
legendary
Activity: 1946
Merit: 1427

Thanks Danny,
That is actually a pretty good way to explain LN from a high level view.

So basically most wallets already summarize the inputs? Does that incur a fee of some sorts? If I summarize 1,2,3,4 into 8 by myself how does the network know my 8 = 1,2,3,4 and it is valid? I assume that is doing something similar to a multisig address to join inputs and outputs?  (I must apologize here I cannot write an essay on multisig yet, and only have a very vague understanding so far. I am still working to understand bitcoin under the hood well )
If this is like a multisig you can just say so an I will google on from there.
The inputs should surely be announced to the network and say "this is the new input that summarizes them" and it needs to be recorded somewhere and agreed upon?

Since this will be a hash of sorts I expect there is no way to know that these 4 inputs = the new input. If you guys can shed some light around that I would appreciate.

Sorry for asking such questions, I know these actually warrant very long answers. Unfortunately getting answers around things like this on google is difficult, you just find irrelevant results on "when moon" or information that even I know is wrong. Nobody is interested in understanding the protocol Sad

Thanks again for taking the time to explain to newbie old me. I promise to pass on the knowledge imparted onto me by you and educate my fellow bitcoiners.

I believe that is called "Consolidating", and that would indeed need confirmation by the network ( meaning that you'd need to broadcast a transaction with all the inputs you want to merge into the new one.)

I don't think most wallets do this by default, (They rather list all the individual UTXO you have) but it shouldn't be too hard to do so manually. It's more deeply explained here.
member
Activity: 210
Merit: 29
Note that the following can reduce this problem...

If you have a trust relationship with Bob (so you don't have any concern that he might broadcast a competing transaction using the same inputs) and if Bob has the technical know-how, then Bob can send his first payment transaction directly to you without broadcasting it.  When it is time for the next payment, Bob can generate and send to you a transaction that spends the same inputs, but which sends you a total of 2.5 BTC in a single payment, again without broadcasting it. Then you can both discard the original unbroadcast 1.25 BTC transaction. When it is time for the third payment, Bob can generate and send to you a transaction that spends the same inputs, but which sends you a total of 3.75 BTC in a single payment, again without broadcasting it. Then you can both discard the unbroadcast 2.5 BTC transaction. You can continue this until the entire loan is paid off and then just broadcast the final transaction. That way, you'll only have one input at the end. Then, if you need access to the money that has been paid to you prior to the balance being paid off, you can just broadcast the most recent transaction that you've received from Bob, and he can create a new payment with a new input for his next payment.

Note:  Lightning Network is effectively what is described above, only it does it without either user needing as much technical knowledge (much of what is described above is handled by the software that you run when you open a Lightning Network channel, and it does it in a way that you don't need to trust Bob.  Once Lightning Network reaches widespread use, it will be possible to send MANY payments in transactions that are not broadcast.  At any time, when you want to access your funds outside of the Lightning Network, you'll just broadcast the most recent transaction with a single output payment to yourself to close the Lightning Network channel.

I wasn't aware that we can consolidate our inputs. I think if this can start happening automatically at a protocol level that would be best though.

Most wallets will choose multiple inputs for a single transaction (and thereby "consolidate input") in various circumstances.

You described one such example in your original post:

I now have 10 valid inputs worth 12.5 BTC in total. If I send my 12.5 BTC to binance now I will be sending them 10 valid inputs, meaning my transaction will use 2.25 KB in the block. Thus in turn I pay 10x more fees than my first transaction.

In that example which you described Binance is receiving a SINGLE 12.5 BTC payment from you.  Your transaction spends 10 inputs, and creates a single new input for Binance.  Therefore, your 10 inputs on the blockchain will have been "consolidated" into a single new input.

Thanks Danny,
That is actually a pretty good way to explain LN from a high level view.

So basically most wallets already summarize the inputs? Does that incur a fee of some sorts? If I summarize 1,2,3,4 into 8 by myself how does the network know my 8 = 1,2,3,4 and it is valid? I assume that is doing something similar to a multisig address to join inputs and outputs?  (I must apologize here I cannot write an essay on multisig yet, and only have a very vague understanding so far. I am still working to understand bitcoin under the hood well )
If this is like a multisig you can just say so an I will google on from there.
The inputs should surely be announced to the network and say "this is the new input that summarizes them" and it needs to be recorded somewhere and agreed upon?

Since this will be a hash of sorts I expect there is no way to know that these 4 inputs = the new input. If you guys can shed some light around that I would appreciate.

Sorry for asking such questions, I know these actually warrant very long answers. Unfortunately getting answers around things like this on google is difficult, you just find irrelevant results on "when moon" or information that even I know is wrong. Nobody is interested in understanding the protocol Sad

Thanks again for taking the time to explain to newbie old me. I promise to pass on the knowledge imparted onto me by you and educate my fellow bitcoiners.
legendary
Activity: 3472
Merit: 4801
Note that the following can reduce this problem...

If you have a trust relationship with Bob (so you don't have any concern that he might broadcast a competing transaction using the same inputs) and if Bob has the technical know-how, then Bob can send his first payment transaction directly to you without broadcasting it.  When it is time for the next payment, Bob can generate and send to you a transaction that spends the same inputs, but which sends you a total of 2.5 BTC in a single payment, again without broadcasting it. Then you can both discard the original unbroadcast 1.25 BTC transaction. When it is time for the third payment, Bob can generate and send to you a transaction that spends the same inputs, but which sends you a total of 3.75 BTC in a single payment, again without broadcasting it. Then you can both discard the unbroadcast 2.5 BTC transaction. You can continue this until the entire loan is paid off and then just broadcast the final transaction. That way, you'll only have one input at the end. Then, if you need access to the money that has been paid to you prior to the balance being paid off, you can just broadcast the most recent transaction that you've received from Bob, and he can create a new payment with a new input for his next payment.

Note:  Lightning Network is effectively what is described above, only it does it without either user needing as much technical knowledge (much of what is described above is handled by the software that you run when you open a Lightning Network channel, and it does it in a way that you don't need to trust Bob.  Once Lightning Network reaches widespread use, it will be possible to send MANY payments in transactions that are not broadcast.  At any time, when you want to access your funds outside of the Lightning Network, you'll just broadcast the most recent transaction with a single output payment to yourself to close the Lightning Network channel.

I wasn't aware that we can consolidate our inputs. I think if this can start happening automatically at a protocol level that would be best though.

Most wallets will choose multiple inputs for a single transaction (and thereby "consolidate input") in various circumstances.

You described one such example in your original post:

I now have 10 valid inputs worth 12.5 BTC in total. If I send my 12.5 BTC to binance now I will be sending them 10 valid inputs, meaning my transaction will use 2.25 KB in the block. Thus in turn I pay 10x more fees than my first transaction.

In that example which you described Binance is receiving a SINGLE 12.5 BTC payment from you.  Your transaction spends 10 inputs, and creates a single new input for Binance.  Therefore, your 10 inputs on the blockchain will have been "consolidated" into a single new input.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
As far as I know these are some of the features and upgrades that will be coming to bitcoin in future. (hopefully if they work and can be implemented)
I indeed didn't read too much about it, but MimbleWimble Won't ICO But Will Launch Cryptocurrency made me think it's an altcoin.

Quote
But thanks for clarifying, I wasn't aware that we can consolidate our inputs. I think if this can start happening automatically at a protocol level that would be best though.
This shouldn't happen on a protocol level, it would reduce privacy and charge fees.
Wallets can improve on it though, when fees where high I've seen many transactions that included dust inputs. The fees required for the dust were more than it's worth. In this case the dust shouldn't be used as input. I've always used manual coin control for this.
member
Activity: 210
Merit: 29
Thanks for taking the time to respond.

Below is a video where Andreas discusses MimbleWimble (lol @ that name) and Schnorr Signatures as proposals for bitcoin. It is really cool technologies.

https://www.youtube.com/watch?v=qloq75ekxv0

As far as I know these are some of the features and upgrades that will be coming to bitcoin in future. (hopefully if they work and can be implemented)

But thanks for clarifying, I wasn't aware that we can consolidate our inputs. I think if this can start happening automatically at a protocol level that would be best though.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
~now I will be sending them 10 valid inputs, meaning my transaction will use 2.25 KB in the block. Thus in turn I pay 10x more fees than my first transaction.
You're on the right track, but the exact numbers are off. https://coinb.in/#fees gives great insight, it has sliders to adjust the number of inputs and outputs, and tells you the transaction size.

Quote
In short the more bitcoin gets spent  the more inputs we will use to make up a transaction?
The number of inputs is what matters, the amount in Bitcoin doesn't matter (for the transaction size/fee).

Quote
If I understand the above correctly.
This then means that any max block size will eventually run out if we cannot summarize those inputs back into single inputs? Regardless of how big we make the blocks. Using bitcoin as currency in this case would then mean we slowly kill it. If all inputs are worth 10 satoshi's then we cant use BTC anymore?
That's why it's important to consolidate your small inputs. Just a month ago, anything under 0.001BTC ($10-15 at the time) wasn't worth the fee to send it! Now, you can send amounts smaller than 0.00001BTC again.
Unfortunately many people still receive tiny dust amounts from cloud mining and faucets. Those inputs are worth almost nothing, and once fees are high again, they'll open threads complaining they can't spend any of it.
It's like collecting (metal) coins in your (IRL) wallet: if you collect a lot, it becomes annoying to pay someone. Use them wisely, and you'll never run into this problem.

Quote
I am aware NimbleWimble is a technology that can fix this. If my understanding is correct then this is quite an urgent problem to fix.
This is the first time I read about MimbleWimble. It looks like an altcoin, which has nothing to do with Bitcoin.

Quote
Also please clarify with the transaction fees involved in a block, do they become part of the newly created input from the block I mined?
Check the latest block mined, the first transaction sends 12.53608821 BTC (block reward + fees) to the miner's address.

Quote
You are welcome to call me an idiot haha
Not on this board Wink
member
Activity: 210
Merit: 29
Hi Forum
Let me first state my understanding of how a bitcoin transaction works. Please correct me if I have this wrong.

Let's say I am a miner  and I mined a block, I got my fresh and unspent 12.5 BTC. Bob loans 12.5 BTC from me and I send it to him. He is supposed to pay me back 1.25 BTC every day for 10 days.
When I send him the 12.5, I send him  a valid Input worth 12.5BTC. Which equals the size of 1 Input( 0.225 KB I think?).  10 Days now pass and Bob has paid me back. I now have 10 valid inputs worth 12.5 BTC in total. If I send my 12.5 BTC to binance now I will be sending them 10 valid inputs, meaning my transaction will use 2.25 KB in the block. Thus in turn I pay 10x more fees than my first transaction.
In short the more bitcoin gets spent  the more inputs we will use to make up a transaction?

If I understand the above correctly.

This then means that any max block size will eventually run out if we cannot summarize those inputs back into single inputs? Regardless of how big we make the blocks. Using bitcoin as currency in this case would then mean we slowly kill it. If all inputs are worth 10 satoshi's then we cant use BTC anymore?
I am aware NimbleWimble is a technology that can fix this. If my understanding is correct then this is quite an urgent problem to fix.

Also please clarify with the transaction fees involved in a block, do they become part of the newly created input from the block I mined?

If I understand the above incorrectly

You are welcome to call me an idiot haha, as long as you explain where my understanding is wrong. We all gotta learn Smiley

Thanks for taking the time to answer guys Smiley
Jump to: