0
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.
0
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.
1
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.
1What do you mean by "can spend only own inputs"? – Andrew Chow – 2018-10-19T19:25:29.723
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 – 2018-10-19T20:02:59.207
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 – 2018-10-20T09:36:50.067