<p>Every transaction output locks funds to one specific output script. These scripts can have various spending conditions such as for example requiring a signature of one specific private key (P2KH, P2KH, P2TR key path spend) or fulfillment of an arbitrary script defined by the recipient (P2SH, P2WSH, P2TR script path spend).</p>
<p>A common script used in the latter category is 2-of-3 multisig, but it would be incorrect to describe this as &quot;2 addresses being funded in one output&quot;. Either way, that would be not the limit.</p>
<p>So, tbh, I'm a bit confused when you describe that one output can fund two addresses.</p>
<p>If I was misconstruing that and you're asking how many inputs and outputs a transaction can have, the answer is that standard transactions must have at least one input and one output, and otherwise are limited to 400,000 weight units. So, a transaction could have thousands of inputs or outputs.</p>

CC BY-SA 4.0
2020-10-16T06:42:58.833Z
i was referring to this transaction for example: https://www.blockchain.com/btc/tx/aed3cda4203fa9f2ab225e1722ad7202fa888a8ad5818116f5cfab4682784746 , it has 1 input and 2 outputs, i know that 1 of the output is the `change` of the input sender
Linh Nguyen
CC BY-SA 4.0
2020-10-16T07:01:35.383Z
@Linh Nguyen That is likely the case, but you don't *know* that. A transaction does not need to have change.
Pieter Wuille
CC BY-SA 4.0
2020-10-16T07:11:01.713Z
right, i remember if i'm not the owner of the sender i can't know if it's a `change` address, but that not bother the logic i have on because i know which 1 of the output address belong to me then the amount it receive is the intended amount the sender put in transaction :) I'm trying to detect the amount come to address from certain sender addresses, that my goal right now
Linh Nguyen
CC BY-SA 4.0
2020-10-16T07:12:41.403Z
it's like a deposit monitor system that constantly call api to check if the system pool address received bitcoin from certain listed addresses
Linh Nguyen
CC BY-SA 4.0
2020-10-16T07:19:57.823Z
You should never try to identify sender addresses in Bitcoin. There is by design no reliable of doing that.
Pieter Wuille
CC BY-SA 4.0
2020-10-16T10:38:56.677Z
i'm not mean by physical adresses, but public key address in an input. For example my system will save certains users bitcoin addresses in database, and i only record transaction where those user addresses send bitcoin to my single pool address by info in 1 transaction
Linh Nguyen
CC BY-SA 4.0
2020-10-16T20:17:55.683Z
You should give every user a different address instead. Don't try to identity senders, it's not possible.
Pieter Wuille
CC BY-SA 4.0
2020-10-16T20:31:47.947Z
I have added a second answer to elaborate this point
Murch
CC BY-SA 4.0
2020-10-16T06:07:58.097Z
2020-10-16T06:07:58.097Z
Murch
<p>After sleeping and looking at your question again, I think I am getting what you were asking.</p>
<p>While in Ethereum it is common to have a single address when operating a wallet because there is efficiency of scale that way, the Bitcoin way of transacting is to treat addresses as <em>invoice identifiers</em>. You give out a new address for each payment that you expect to receive. Since the address is unique, you can use the address itself as the identifier tying it to a specific business deal. A wallet can track many addresses, and a Bitcoin wallet can efficiently operate with many addresses (in fact there is no efficiency advantage to spending multiple unspent transaction outputs that were received to the same address together in Bitcoin).</p>
<p>Trying to track who paid you by means of &quot;sender addresses&quot; is a terrible approach, because</p>
<ul>
<li>people will use many different addresses, so you will need to collect this information over and over again, especially, each input usually was received to a different address prior</li>
<li>when people use custodial services, they may be the initiator of
payments even when they do not actually control the address the funds were sent from, nor the address is associated with their account</li>
<li>there is often no easy way to give proof of control of addresses</li>
</ul>
<p>Using only a single address for all of your transactions destroys any possibility of financial privacy for your business and diminishes that of your customers.</p>
<p>Using a new address for each payment instead puts you into control, clearly identifies the business deal getting funded, and has better UX.</p>

CC BY-SA 4.0
2020-10-16T13:20:27.573Z
2020-10-16T13:32:32.003Z
2020-10-16T13:32:32.003Z
Murch
<p>I have read through this <a href="https://bitcoin.stackexchange.com/questions/74003/multiple-input-and-output-addresses-in-bitcoin-transactions">question</a> and i understand that there can be many sender and receiver addresses within 1 transaction(i'm new to bitcoin transaction, previous i was working with ethereum where 1 transaction can only have 1 sender and 1 receiver).</p>
<p>I'm working with blockcypher api <a href="https://www.blockcypher.com/dev/bitcoin/?python#address-full-endpoint" rel="nofollow noreferrer">endpoint</a> to monitor incoming bitcoin to an address. I need to get all the possible number of address that can happen in input or output.</p>
<p>Here the logic of my monitor system, user can input their addresses to send(save in database), and my system also has an address to receive that amount. The monitor system only detect the incoming transactions to my address from the user addresses in the input addresses (exists in database)</p>
<p>I have categorized it into these to know the correct value that was send to an address:</p>
<pre><code>input | output  | incoming amount to address
1     | 1 or 2  | amount show on receiver(output) of my address
1     | &gt;2      | amount show on receiver(output) of my address
&gt;1    | 1       | amount show on sender(of the system)(input)
</code></pre>
<p>Now i need to know can there be more then 2 on the input and more than 2 on the output? i haven't found any example of it yet</p>
<p>Also please tell me if my monitor logic is correct, are there different logic to monitor incoming bitcoin transaction to an address?</p>
<p>Thank in advance</p>
<p>Sorry if i mess up somewhere in my question, i'm pretty new to bitcoin system.</p>

<transactions><blockchain><transaction-input><blockcypher>
How many addresses can be in input and output of a transaction
Linh Nguyen
# How many addresses can be in input and output of a transaction

(Asked by: username_0 on 2020-10-16)

I have read through this [question](https://bitcoin.stackexchange.com/questions/74003/multiple-input-and-output-addresses-in-bitcoin-transactions) and i understand that there can be many sender and receiver addresses within 1 transaction(i'm new to bitcoin transaction, previous i was working with ethereum where 1 transaction can only have 1 sender and 1 receiver).

I'm working with blockcypher api [endpoint](https://www.blockcypher.com/dev/bitcoin/?python#address-full-endpoint) to monitor incoming bitcoin to an address. I need to get all the possible number of address that can happen in input or output.

Here the logic of my monitor system, user can input their addresses to send(save in database), and my system also has an address to receive that amount. The monitor system only detect the incoming transactions to my address from the user addresses in the input addresses (exists in database)

I have categorized it into these to know the correct value that was send to an address:

```
input | output  | incoming amount to address
1     | 1 or 2  | amount show on receiver(output) of my address
1     | >2      | amount show on receiver(output) of my address
>1    | 1       | amount show on sender(of the system)(input)

```

Now i need to know can there be more then 2 on the input and more than 2 on the output? i haven't found any example of it yet

Also please tell me if my monitor logic is correct, are there different logic to monitor incoming bitcoin transaction to an address?

Thank in advance

Sorry if i mess up somewhere in my question, i'm pretty new to bitcoin system.

**Tags:** transactions, blockchain, transaction-input, blockcypher


---

## 2 answers

### Answer by username_1 on 2020-10-16. Score: 3 | Accepted answer

Every transaction output locks funds to one specific output script. These scripts can have various spending conditions such as for example requiring a signature of one specific private key (P2KH, P2KH, P2TR key path spend) or fulfillment of an arbitrary script defined by the recipient (P2SH, P2WSH, P2TR script path spend).

A common script used in the latter category is 2-of-3 multisig, but it would be incorrect to describe this as "2 addresses being funded in one output". Either way, that would be not the limit.

So, tbh, I'm a bit confused when you describe that one output can fund two addresses.

If I was misconstruing that and you're asking how many inputs and outputs a transaction can have, the answer is that standard transactions must have at least one input and one output, and otherwise are limited to 400,000 weight units. So, a transaction could have thousands of inputs or outputs.

> **Comments:**
> **username_0**: i was referring to this transaction for example: https://www.blockchain.com/btc/tx/aed3cda4203fa9f2ab225e1722ad7202fa888a8ad5818116f5cfab4682784746 , it has 1 input and 2 outputs, i know that 1 of the output is the `change` of the input sender  
> **username_2**: @username_0 That is likely the case, but you don't *know* that. A transaction does not need to have change.  
> **username_0**: right, i remember if i'm not the owner of the sender i can't know if it's a `change` address, but that not bother the logic i have on because i know which 1 of the output address belong to me then the amount it receive is the intended amount the sender put in transaction :) I'm trying to detect the amount come to address from certain sender addresses, that my goal right now  
> **username_0**: it's like a deposit monitor system that constantly call api to check if the system pool address received bitcoin from certain listed addresses  
> **username_2**: You should never try to identify sender addresses in Bitcoin. There is by design no reliable of doing that.  
> **username_0**: i'm not mean by physical adresses, but public key address in an input. For example my system will save certains users bitcoin addresses in database, and i only record transaction where those user addresses send bitcoin to my single pool address by info in 1 transaction  
> **username_2**: You should give every user a different address instead. Don't try to identity senders, it's not possible.  
> **username_1**: I have added a second answer to elaborate this point  

---

### Answer by username_1 on 2020-10-16. Score: 2

After sleeping and looking at your question again, I think I am getting what you were asking.

While in Ethereum it is common to have a single address when operating a wallet because there is efficiency of scale that way, the Bitcoin way of transacting is to treat addresses as *invoice identifiers*. You give out a new address for each payment that you expect to receive. Since the address is unique, you can use the address itself as the identifier tying it to a specific business deal. A wallet can track many addresses, and a Bitcoin wallet can efficiently operate with many addresses (in fact there is no efficiency advantage to spending multiple unspent transaction outputs that were received to the same address together in Bitcoin).

Trying to track who paid you by means of "sender addresses" is a terrible approach, because

* people will use many different addresses, so you will need to collect this information over and over again, especially, each input usually was received to a different address prior
* when people use custodial services, they may be the initiator of
  payments even when they do not actually control the address the funds were sent from, nor the address is associated with their account
* there is often no easy way to give proof of control of addresses

Using only a single address for all of your transactions destroys any possibility of financial privacy for your business and diminishes that of your customers.

Using a new address for each payment instead puts you into control, clearly identifies the business deal getting funded, and has better UX.


---

