<p>Wallets will only consider outputs to be theirs if it is something that it can spend from. This usually entails checking the output script against the set of scripts that your addresses will be used to generate. So even if you can sign for something, if the script does not match any of the scripts stored in your wallet, then it will not consider that output to be yours.</p>

<p>If the output was a P2SH output, then you would need to have the redeemScript in order to spend from it, so unless the sender shared that with you (and if they did, you could check for any nastiness), your wallet won't even know that you could spend that P2SH output.</p>

<p>Also, there is no "claiming the balance" or claiming of any sort except when you spend an output.</p>

CC BY-SA 3.0
2017-12-08T07:52:22.580Z
so, there is something like set of acceptable script templates which could be used for addr to addr transfer?
smrt28
CC BY-SA 3.0
2017-12-08T07:54:22.517Z
Yes. There are script templates, and most wallets will only watch those script templates. There is no need to try every single output to see if you could spend it; that would be extremely computationally expensive and open up several DoS vectors.
Ava Chow
CC BY-SA 3.0
2017-12-08T07:39:59.160Z
2017-12-08T07:39:59.160Z
Ava Chow
<p>when somebody send me BTCs I recognize that by seeing a transaction output is equal to my address. But how can I be sure that it's really me and only me who can spend the output?</p>

<p>I can check, I can unlock the output.
But consider I'm an evil, I sell BTCs to somebody. But I create a multisign-script wich unblocks the transaction output also by my private key and when I receive $ I take my BTCs back.</p>

<p>Is there a protection against this? Do wallets check the output scripts somehow before claiming the balance?</p>

<security><wallet-security><scrypt>
Are received BTCs really mine?
smrt28
# Are received BTCs really mine?

(Asked by: username_0 on 2017-12-08)

when somebody send me BTCs I recognize that by seeing a transaction output is equal to my address. But how can I be sure that it's really me and only me who can spend the output?

I can check, I can unlock the output.
But consider I'm an evil, I sell BTCs to somebody. But I create a multisign-script wich unblocks the transaction output also by my private key and when I receive $ I take my BTCs back.

Is there a protection against this? Do wallets check the output scripts somehow before claiming the balance?

**Tags:** security, wallet-security, scrypt


---

## 1 answers

### Answer by username_1 on 2017-12-08. Score: 3 | Accepted answer

Wallets will only consider outputs to be theirs if it is something that it can spend from. This usually entails checking the output script against the set of scripts that your addresses will be used to generate. So even if you can sign for something, if the script does not match any of the scripts stored in your wallet, then it will not consider that output to be yours.

If the output was a P2SH output, then you would need to have the redeemScript in order to spend from it, so unless the sender shared that with you (and if they did, you could check for any nastiness), your wallet won't even know that you could spend that P2SH output.

Also, there is no "claiming the balance" or claiming of any sort except when you spend an output.

> **Comments:**
> **username_0**: so, there is something like set of acceptable script templates which could be used for addr to addr transfer?  
> **username_1**: Yes. There are script templates, and most wallets will only watch those script templates. There is no need to try every single output to see if you could spend it; that would be extremely computationally expensive and open up several DoS vectors.  

---

