1

Is there a smart contract where you can create a crowd funding campaign. Say I wanted to raise 1000 ETH within 30 days or X number of blocks. If the 1000 eth goal isn't reached, it will return all the funds back to the users that sent it to my smart contract. Does something like this exists? And what issues might one run into when doing something like this?

I'm curious to how funds are returned. Say if 10000 addresses sent me random amounts of eth. Wouldn't gas cost alot as it would have to loop through all those 10000 addresses to do a refund?

1
  • Divide et impera
    – user38075
    May 8, 2018 at 21:20

1 Answer 1

2

Here's a post from my blog about that very subject: https://programtheblockchain.com/posts/2018/01/19/writing-a-crowdfunding-contract-a-la-kickstarter/.

We took what I believe is the typical approach, where each account that sent ether is responsible for collecting their own refund (and thus paying for their own gas).

8
  • How would the funder claim it back? Let's say its some grandma that heard about this "crowdfunding" campaign, and knows how to send Eth to the address, but how does she claim it back as a refund? What does she need to do exactly? May 9, 2018 at 13:26
  • Presumably, she clicks a button on the website called "get refund." (That button calls getRefund() in the smart contract.)
    – user19510
    May 9, 2018 at 13:28
  • but does that mean she has to provide her private key since she's paying for the gas to get the refund? or am I seeing this incorrectly. May 9, 2018 at 14:04
  • She needs to know her private key to make transactions. This includes when she donates (e.g. by clicking the "donate" button) and when she gets a refund (e.g. by clicking the "get refund" button). Most typically, her private key will live in a web3 provider, like the MetaMask extension.
    – user19510
    May 9, 2018 at 14:06
  • I see. So the metamask wallet would interact with the "donate" and "refund" button without her having to deal with any keys. I'm just trying to understand how to solve this from a simple UX perspective as most people don't want to deal with keys. What if the user sent their ETH from coinbase? How does one get their refund then? May 9, 2018 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.