<p>To expand on Andrew's answer a little, many application that interact with the Bitcoin network include some kind of "sane defaults". For Bitcoin Core, this is visible in the form of not allowing very high fee transactions, ensuring there aren't any duplicate addresses in outputs, attempting to use change addresses of the same type as the address you are sending coins to in an attempt to preserve privacy, and so on.</p>

<p>In many of these cases, these rules are different from the actual Bitcoin Protocol - For example, although Bitcoin Core tries to prevent absurdly high fees, there have been numerous cases of very high fee transactions (paying several BTC in fees) being mined.</p>

<p>Similarly, although the protocol allows multiple outputs to a single address, Bitcoin Core attempts to prevent that at an RPC level to reduce user error unintentionally costing them money. The Bitcoin Protocol itself has no rules against this, and will let you make such a transaction, and mine it, without any complaints.</p>

CC BY-SA 4.0
2019-12-02T21:02:43.190Z
2019-12-02T21:02:43.190Z
Raghav Sood
<p>It is not invalid.</p>

<p>The code you are looking it is unrelated to validation and relay of actual transactions. You are looking at the code for RPCs which are just things for users. The RPC disallows sending to an address multiple times because this is not efficient and usually a mistake by the user.</p>

<p>But this is only for creating a raw transaction using the Bitcoin Core RPC. A transaction received over the network or in a block that has dupllicate addresses in the outputs would not be rejected or be invalid in any way.</p>

CC BY-SA 4.0
2019-12-02T17:30:44.637Z
2019-12-02T17:30:44.637Z
Ava Chow
<p>I'm studying Bitcoin Core currently. I found incomprehensible code, that shows making a transaction is rejected if there are same output addresses in a transaction.</p>

<p>See Fig1, Fig2</p>

<p><a href="https://i.sstatic.net/Qiewl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Qiewl.png" alt="enter image description here"></a></p>

<p>Origin source code : <a href="https://github.com/bitcoin/bitcoin/blob/8aac85d71e218783bc7ce06e5bf8bc660e24079d/src/rpc/rawtransaction_util.cpp#L95" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/8aac85d71e218783bc7ce06e5bf8bc660e24079d/src/rpc/rawtransaction_util.cpp#L95</a></p>

<p>So, the transaction illustrated in Fig1 will be rejected as shown Fig3.
<a href="https://i.sstatic.net/VGaWQ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VGaWQ.png" alt="enter image description here"></a></p>

<p>Can you give reason about the policy of described in this post ?</p>

<bitcoin-core><raw-transaction><output>
Why same output address is invalid in a transaction on Bitcoin Core?
Hyunsoo
# Why same output address is invalid in a transaction on Bitcoin Core?

(Asked by: username_0 on 2019-12-02)

I'm studying Bitcoin Core currently. I found incomprehensible code, that shows making a transaction is rejected if there are same output addresses in a transaction.

See Fig1, Fig2

[![enter image description here](https://i.sstatic.net/Qiewl.png)](https://i.sstatic.net/Qiewl.png)

Origin source code : <https://github.com/bitcoin/bitcoin/blob/8aac85d71e218783bc7ce06e5bf8bc660e24079d/src/rpc/rawtransaction_util.cpp#L95>

So, the transaction illustrated in Fig1 will be rejected as shown Fig3.
[![enter image description here](https://i.sstatic.net/VGaWQ.png)](https://i.sstatic.net/VGaWQ.png)

Can you give reason about the policy of described in this post ?

**Tags:** bitcoin-core, raw-transaction, output


---

## 2 answers

### Answer by username_2 on 2019-12-02. Score: 5 | Accepted answer

It is not invalid.

The code you are looking it is unrelated to validation and relay of actual transactions. You are looking at the code for RPCs which are just things for users. The RPC disallows sending to an address multiple times because this is not efficient and usually a mistake by the user.

But this is only for creating a raw transaction using the Bitcoin Core RPC. A transaction received over the network or in a block that has dupllicate addresses in the outputs would not be rejected or be invalid in any way.


---

### Answer by username_1 on 2019-12-02. Score: 3

To expand on Andrew's answer a little, many application that interact with the Bitcoin network include some kind of "sane defaults". For Bitcoin Core, this is visible in the form of not allowing very high fee transactions, ensuring there aren't any duplicate addresses in outputs, attempting to use change addresses of the same type as the address you are sending coins to in an attempt to preserve privacy, and so on.

In many of these cases, these rules are different from the actual Bitcoin Protocol - For example, although Bitcoin Core tries to prevent absurdly high fees, there have been numerous cases of very high fee transactions (paying several BTC in fees) being mined.

Similarly, although the protocol allows multiple outputs to a single address, Bitcoin Core attempts to prevent that at an RPC level to reduce user error unintentionally costing them money. The Bitcoin Protocol itself has no rules against this, and will let you make such a transaction, and mine it, without any complaints.


---

