# How many addresses can be in input and output of a transaction

I have read through this question 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 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?

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

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.

• i was referring to this transaction for example: blockchain.com/btc/tx/… , it has 1 input and 2 outputs, i know that 1 of the output is the `change` of the input sender Commented Oct 16, 2020 at 6:42
• @Linh Nguyen That is likely the case, but you don't know that. A transaction does not need to have change. Commented Oct 16, 2020 at 7:01
• 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 Commented Oct 16, 2020 at 7:11
• You should never try to identify sender addresses in Bitcoin. There is by design no reliable of doing that. Commented Oct 16, 2020 at 7:19
• I have added a second answer to elaborate this point
– Murch
Commented Oct 16, 2020 at 20:31

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