<p>In the Bitcoin Core wallet, it depends:</p>
<ul>
<li>For P2PK outputs to a public key that's in your wallet, yes for current wallet versions, but this won't be the case for the new &quot;descriptor&quot; wallets (unless explicitly imported).</li>
<li>For bare multisig, only when explicitly imported. Before <a href="https://github.com/bitcoin/bitcoin/pull/13002" rel="nofollow noreferrer">PR 13002</a>, bare N-of-N multisig was automatically treated as incoming payment (in case you had <em>all</em> N private keys). Since that PR you need to explicitly import these scripts to watch them.</li>
</ul>
<p>For other wallet software, things may be different.</p>
<p>In general, you cannot assume that anyone will ever treat an incoming transaction as a valid payment, unless it was sent to an exact address they gave you (or you have some other explicit arrangement). Which scripts/addresses a user considers &quot;theirs&quot; is up to them, depends heavily on the software they use, and not something you can infer.</p>

CC BY-SA 4.0
2020-09-16T00:45:03.373Z
So do you mean that before the pr that it wasn t enough to be able to spend automatically the outputs in bare multisig and that all of the 3 keys of bare multisig 2 of 3 transaction has to be inside the wallet?
user2284570
CC BY-SA 4.0
2020-09-16T00:46:42.940Z
I don't understand your question. If you explicitly import a script, you can watch whatever you want in your wallet. Before that PR, some bare multisigs were automatically watched (N-of-N ones where you had all private keys).
Pieter Wuille
CC BY-SA 4.0
2020-09-16T00:48:08.400Z
Correct but I m thinking about use cases where everything has to be implicit and automatic. The only thing that has to be done from the receiver end is generating a payment from a new address.
user2284570
CC BY-SA 4.0
2020-09-16T00:51:45.070Z
You cannot assume that anyone will ever treat an incoming transaction as a valid payment, unless it was sent to an exact address they gave you (or you have some other explicit arrangement). You can't send to public keys extracted from transactions, you can't even send back to the "sender" addresses in incoming transactions that pay you - the address may be of a joint wallet or website rather than crediting the specific person who sent things to you.
Pieter Wuille
CC BY-SA 4.0
2020-09-16T00:57:08.937Z
what you describe depends on the address type.
user2284570
CC BY-SA 4.0
2020-09-16T00:58:58.583Z
No it does not, sorry.
Pieter Wuille
CC BY-SA 4.0
2020-09-16T01:01:55.663Z
For an addres to be owned by several parties yes. Otherwise what do you mean by descriptor wallets?
user2284570
CC BY-SA 4.0
2020-09-16T01:05:04.877Z
You cannot tell from the address or the address type whether it belongs to a person directly, or whether it belongs to say a web wallet that manages multiple people's funds. Sending to such an address - even a P2PKH 1xxx one - could result in any of the site's users being credited. Transactions can also have multiple inputs, each with their own "previous output's address", who belong to multiple people. Descriptor wallets are new Bitcoin Core wallet version, which is still being developed.
Pieter Wuille
CC BY-SA 4.0
2020-09-16T01:12:52.557Z
In my case I know it s about a web wallet where each address is linked to only one account.
user2284570
CC BY-SA 4.0
2020-09-16T01:14:08.250Z
In that case you should probably ask these questions to the operator of said website, not here. What scripts/addresses they credit is entirely up to them.
Pieter Wuille
CC BY-SA 4.0
2020-09-17T08:02:20.103Z
One last thing since a wallet.dat supports multiple accounts, when you say all the keys before the patch for multisig, is it per account only or for the wall wallet.dat?
user2284570
CC BY-SA 4.0
2020-09-17T08:13:00.530Z
Bitcoin Core's account feature was deprecated in 0.17.0, and removed in 0.18.0. Bare multisig is no longer automatically watched since 0.16.0.
Pieter Wuille
CC BY-SA 4.0
2020-09-17T08:15:46.953Z
I was meaning before the 2018 patch of course.
user2284570
CC BY-SA 4.0
2020-09-17T16:08:46.533Z
It used to be for the entire wallet.dat.
Pieter Wuille
CC BY-SA 4.0
2020-09-20T07:24:20.507Z
And per my understanding, the current code still  requires to own all the keys if watched, right?
user2284570
CC BY-SA 4.0
2020-09-20T07:26:28.933Z
Single-key addresses are automatically watched for private keys you have yourself. Beyond that, anything needs to be watched explicitly (through `importmulti`, `importaddress`, ...), but watching doesn't require having keys.
Pieter Wuille
CC BY-SA 4.0
2020-09-20T07:48:08.570Z
So do you mean that it I m having only non multisig addresses where I own the private keys that this patch doesn t change anything? That the patch change the behavior only for the addresses where I m only having the public key?
user2284570
CC BY-SA 4.0
2020-09-20T09:26:53.257Z
Or rephrased, does it means I don t have to watch manually the single key address where I do own the private keys?
user2284570
CC BY-SA 4.0
2020-09-20T16:50:02.020Z
You do not have to watch single-key addresses where you have the private key. That would be extremely surprising! It would mean you create a wallet, and then need manual steps before you can see incoming transactions.
Pieter Wuille
CC BY-SA 4.0
2020-09-20T17:30:24.660Z
I was talking about receiving bare multisig to single key address not about receiving pay to pubkey or pay to to address. Are you sure to understand what I meant?
user2284570
CC BY-SA 4.0
2020-09-20T17:39:59.737Z
By single key address I only mean P2PK, P2PKH, P2WPKH, P2SH-P2WPKH. Bare multisig is never automatically watched.
Pieter Wuille
CC BY-SA 4.0
2020-09-20T19:11:52.273Z
So again, per my understanding, the current code still requires to own all the keys for bare multisig if watched, right?
user2284570
CC BY-SA 4.0
2020-09-20T19:18:37.557Z
No it does not. You just need to import the address/script. You only need the private keys for automatic single-key address watching.
Pieter Wuille
CC BY-SA 4.0
2020-09-16T00:38:52.943Z
2020-09-16T00:53:54.250Z
2020-09-16T00:53:54.250Z
Pieter Wuille
<p>Couldn’t find the answer inside the source code.</p>
<p>If I receive a pay to pubkey transaction to the pubkey of a <code>1r</code> address, will it shows up using <code>getreceivedbyaddress</code> or <code>listreceivedbyaddress</code> or <code>listunspent</code>? Or will it ignore the coins received that way.<br />
The same question apply when 1-of-n bare multisig.</p>

<json-rpc><multi-signature><p2pk>
Does getreceivedbyaddress or listreceivedbyaddress or listunspent shows pay to pubkey and bare mutlisig transactions?
user2284570
# Does getreceivedbyaddress or listreceivedbyaddress or listunspent shows pay to pubkey and bare mutlisig transactions?

(Asked by: username_0 on 2020-08-31)

Couldn’t find the answer inside the source code.

If I receive a pay to pubkey transaction to the pubkey of a `1r` address, will it shows up using `getreceivedbyaddress` or `listreceivedbyaddress` or `listunspent`? Or will it ignore the coins received that way.  
The same question apply when 1-of-n bare multisig.

**Tags:** json-rpc, multi-signature, p2pk


---

## 1 answers

### Answer by username_1 on 2020-09-16. Score: 1 | Accepted answer

In the Bitcoin Core wallet, it depends:

* For P2PK outputs to a public key that's in your wallet, yes for current wallet versions, but this won't be the case for the new "descriptor" wallets (unless explicitly imported).
* For bare multisig, only when explicitly imported. Before [PR 13002](https://github.com/bitcoin/bitcoin/pull/13002), bare N-of-N multisig was automatically treated as incoming payment (in case you had *all* N private keys). Since that PR you need to explicitly import these scripts to watch them.

For other wallet software, things may be different.

In general, you cannot assume that anyone will ever treat an incoming transaction as a valid payment, unless it was sent to an exact address they gave you (or you have some other explicit arrangement). Which scripts/addresses a user considers "theirs" is up to them, depends heavily on the software they use, and not something you can infer.

> **Comments:**
> **username_0**: So do you mean that before the pr that it wasn t enough to be able to spend automatically the outputs in bare multisig and that all of the 3 keys of bare multisig 2 of 3 transaction has to be inside the wallet?  
> **username_1**: I don't understand your question. If you explicitly import a script, you can watch whatever you want in your wallet. Before that PR, some bare multisigs were automatically watched (N-of-N ones where you had all private keys).  
> **username_0**: Correct but I m thinking about use cases where everything has to be implicit and automatic. The only thing that has to be done from the receiver end is generating a payment from a new address.  
> **username_1**: You cannot assume that anyone will ever treat an incoming transaction as a valid payment, unless it was sent to an exact address they gave you (or you have some other explicit arrangement). You can't send to public keys extracted from transactions, you can't even send back to the "sender" addresses in incoming transactions that pay you - the address may be of a joint wallet or website rather than crediting the specific person who sent things to you.  
> **username_0**: what you describe depends on the address type.  
> **username_1**: No it does not, sorry.  
> **username_0**: For an addres to be owned by several parties yes. Otherwise what do you mean by descriptor wallets?  
> **username_1**: You cannot tell from the address or the address type whether it belongs to a person directly, or whether it belongs to say a web wallet that manages multiple people's funds. Sending to such an address - even a P2PKH 1xxx one - could result in any of the site's users being credited. Transactions can also have multiple inputs, each with their own "previous output's address", who belong to multiple people. Descriptor wallets are new Bitcoin Core wallet version, which is still being developed.  
> **username_0**: In my case I know it s about a web wallet where each address is linked to only one account.  
> **username_1**: In that case you should probably ask these questions to the operator of said website, not here. What scripts/addresses they credit is entirely up to them.  
> **username_0**: One last thing since a wallet.dat supports multiple accounts, when you say all the keys before the patch for multisig, is it per account only or for the wall wallet.dat?  
> **username_1**: Bitcoin Core's account feature was deprecated in 0.17.0, and removed in 0.18.0. Bare multisig is no longer automatically watched since 0.16.0.  
> **username_0**: I was meaning before the 2018 patch of course.  
> **username_1**: It used to be for the entire wallet.dat.  
> **username_0**: And per my understanding, the current code still  requires to own all the keys if watched, right?  
> **username_1**: Single-key addresses are automatically watched for private keys you have yourself. Beyond that, anything needs to be watched explicitly (through `importmulti`, `importaddress`, ...), but watching doesn't require having keys.  
> **username_0**: So do you mean that it I m having only non multisig addresses where I own the private keys that this patch doesn t change anything? That the patch change the behavior only for the addresses where I m only having the public key?  
> **username_0**: Or rephrased, does it means I don t have to watch manually the single key address where I do own the private keys?  
> **username_1**: You do not have to watch single-key addresses where you have the private key. That would be extremely surprising! It would mean you create a wallet, and then need manual steps before you can see incoming transactions.  
> **username_0**: I was talking about receiving bare multisig to single key address not about receiving pay to pubkey or pay to to address. Are you sure to understand what I meant?  
> **username_1**: By single key address I only mean P2PK, P2PKH, P2WPKH, P2SH-P2WPKH. Bare multisig is never automatically watched.  
> **username_0**: So again, per my understanding, the current code still requires to own all the keys for bare multisig if watched, right?  
> **username_1**: No it does not. You just need to import the address/script. You only need the private keys for automatic single-key address watching.  

---

