Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: CryptoPravda on June 10, 2018, 04:24:21 AM



Title: Bitcoin money back. Very useful function.
Post by: CryptoPravda on June 10, 2018, 04:24:21 AM
It is very weird that I did not find such a necessary thing as money back. (script for money back).  What I mean.

For example I'm doing crowdfunding.

I publish my bitcoin address
1ApEkg4iGheZ6rgpA8ZP4jmPfCqzDcTrM7

I put the condition, if I do not collect enough of money or conditions are not met, I return all the money to the senders.

I'm looking for a script who would return the money back. But I did not find it and this is very strange.
This is a very useful function. If you received 1000 payments, it is very difficult to return everything manually.
This is not a decentralized solution. But even this I did not find.


Or let's do crowdfunding on writing such a script.  Or tell me please where to find this.

This will turn the world around crowdfunding.

Thank you and sorry for my english.





Title: Re: Bitcoin money back. Very useful function.
Post by: achow101 on June 10, 2018, 07:31:54 AM
This is impossible to do in Bitcoin.

Doing such contracts requires using the Bitcoin scripting language. However the scripting language does not have access to output amounts, nor does it have access to other UTXOs which it would in order to have the correct balance for an address.


Title: Re: Bitcoin money back. Very useful function.
Post by: nc50lc on June 10, 2018, 09:02:31 AM
Even if it is possible on protocol level, the majority will surely be against this kind of feature due to some dangerous exploits.
But it's not possible, just a "what-if" example.

From my understanding, what OP meant was a script to select or flag all the output's addresses and the corresponding amounts to be able to use them as "contacts" and locally saved in case of a "return-transaction" (just a regular transaction) is needed.
This is possible to implement on 3rd-party wallets or the Bitcoin wallet GUI if you can back it up.


Title: Re: Bitcoin money back. Very useful function.
Post by: pebwindkraft on June 10, 2018, 09:51:58 AM
Bitcoin scripting don't support feature you mentioned since it's not turing complete.
...

Can you explain, what this means? Why is Turing completeness required to access data of previous transaction?
As achow pointed out, it is a limitation of the scripting language to access the internal data structures. And the Turing completeness is explicitly removed from bitcoin scripting, to also avoid security issues.


Title: Re: Bitcoin money back. Very useful function.
Post by: bones261 on June 15, 2018, 07:27:48 PM
Is it possible to do this via the Lightning network? You can have people open a channel with your crowdsourcing. Then if you want to do a mass refund, you just return the money to them in the channels they opened with you. You would probably need some kind of script to do this if you don't want to do it manually. I would think this would end up costing no fee to you, since it would be 0 hop transactions. (The funders would incur the fees of first opening the channel and then closing the channel.) I have not personally fiddled with the Lightning Network, yet; so I apologize if this suggestion is way out in left field.


Title: Re: Bitcoin money back. Very useful function.
Post by: reingard on June 15, 2018, 07:31:21 PM
You can't do this in a descentralized way. You would need a 3rd party or an script (not "inside the bitcoin protocol") runned by yourself.

For example: cronjob a PHP file that checks the address balance and the date. If when date X arrives the balance is lower than Y, you get every sender address and sends the amount back to them. One of the problems is that you would need to pay the fees for the transactions back to the sender.



Title: Re: Bitcoin money back. Very useful function.
Post by: btj on June 15, 2018, 08:07:33 PM
This is possible if there one input in the transaction ...

If you have 1000 transactions for example, you scan for the transaction that contain only one INPUT, and you can send them back her/his money.

Like this you will solve half of problem, and the others transactions can be made manually.


Title: Re: Bitcoin money back. Very useful function.
Post by: CryptoPravda on June 16, 2018, 05:41:14 AM
You would need a 3rd party or an script (not "inside the bitcoin protocol") runned by yourself.

yes, that's what I mean.
This is not a decentralized solution. But even this I did not find.

And I think it can be a built-in function in the wallet. When a person decides to return all the funds, minus the fees.