<p>No, it is not possible for a script to be able to determine who "owns" the input (as in whether the input was created by Alice or by Bob). Scripts cannot look at things like the txid of the input it belongs to, the index of the output the input spents, or any of the output scripts. There is no facility in Bitcoin to do that. So no, such a script is impossible to do in Bitcoin.</p>

CC BY-SA 4.0
2018-10-19T20:06:04.490Z
2018-10-19T20:06:04.490Z
Ava Chow
<p>Let's imagine:
We have just one BTC address.
Users send some coins to this shared address. And can spend only own inputs.</p>

<p>P.S. If someone can provide some example script for this I'll be very thankful.</p>

CC BY-SA 4.0
2018-10-19T19:25:29.723Z
What do you mean by "can spend only own inputs"?
Ava Chow
CC BY-SA 4.0
2018-10-19T20:02:59.207Z
Alice and Bob send coins to one address (to Carol). Alice send 5 BTC to Carol and Bob send 2 BTC to Carol. Is it possible to write a script, which allow Alice spend only 5BTC, not 7 BTC ?
Andrew
CC BY-SA 4.0
2018-10-20T09:36:50.067Z
Though you cannot do this with scripts, you could create a multi-sig payment channel between Alice and Bob for similar effect: Alice and Bob could co-fund the channel, so that there will be an initial state of Alice 5 BTC, Bob 2 BTC. Each person would only be able to spend their share of the BTC, but in this situation they would both need to spend it simultaneously.
chytrik
<script>
Is it possible to write a script, which can allow spend only own inputs except all of them?
Andrew
# Is it possible to write a script, which can allow spend only own inputs except all of them?

(Asked by: username_0 on 2018-10-19)

Let's imagine:
We have just one BTC address.
Users send some coins to this shared address. And can spend only own inputs.

P.S. If someone can provide some example script for this I'll be very thankful.

**Tags:** script

> **Comments:**
> **username_1**: What do you mean by "can spend only own inputs"?  
> **username_0**: Alice and Bob send coins to one address (to Carol). Alice send 5 BTC to Carol and Bob send 2 BTC to Carol. Is it possible to write a script, which allow Alice spend only 5BTC, not 7 BTC ?  
> **username_2**: Though you cannot do this with scripts, you could create a multi-sig payment channel between Alice and Bob for similar effect: Alice and Bob could co-fund the channel, so that there will be an initial state of Alice 5 BTC, Bob 2 BTC. Each person would only be able to spend their share of the BTC, but in this situation they would both need to spend it simultaneously.  

---

## 1 answers

### Answer by username_1 on 2018-10-19. Score: 1 | Accepted answer

No, it is not possible for a script to be able to determine who "owns" the input (as in whether the input was created by Alice or by Bob). Scripts cannot look at things like the txid of the input it belongs to, the index of the output the input spents, or any of the output scripts. There is no facility in Bitcoin to do that. So no, such a script is impossible to do in Bitcoin.


---

