Crowd Funding on the Cogwheels

Crowdfunding on Bitcoin

This post was first published on Medium.

No, not ICO

We show how to develop a crowdfunding platform on Bitcoin. Similar to Kickstarter, funding is all or nothing. That is, if the fundraising target is not reached, the funds are guaranteed to be returned.

Kickstarter Logo

Compared to Kickstarter, our approach is automatically enforced by Bitcoin, does not entrust funds to a trusted third party, and enjoys low fees.

We first introduce a traditional way to achieve this and present an improved version afterwards.

A first try: Lighthouse

Early Bitcoin developer Mike Hearn built a crowdfunding platform Lighthouse based on assurance contracts. It uses SIGHASH flags ALL | ANYONECANPAY.

ANYONECANPAY inputs
ANYONECANPAY inputs can be combined

  • ALL ensures all the funds go to the desired recipient and the total is exactly a certain target. The recipient and target cannot be altered after signing, preventing donations from being redirected.
  • ANYONECANPAY ensures each contributor can pledge independently. Each signs her own input and hands the partially transaction to the recipient, who combine all inputs in a single transaction and redeem the funds.

Note that before the target is reached, the sum of input values is less than the output value, the transaction is invalid and the recipient cannot claim the funds.

Improvement

The above crowdfunding has several drawbacks:

  1. A contributor can withdraw his pledge fund at any moment
  2. The fundraising cannot be oversubscribed. Even if people want to contribute more than the target, the extra amount will be paid as fees to miners, instead of going to the recipient.

To improve, each contributor locks her fund into the following contract and broadcasts a transaction containing it. This commits her fund, which cannot be withdrawn before a deadline.

Contract Crowdfund
Contract Crowdfund

If enough total funds have been raised before the deadline, the beneficiary can collect all pledged funds as in Figure 1, by calling pledge() at Line 13. Otherwise, each contributor can retract her fund after the deadline as in Figure 2, by calling refund() at Line 28.

pledged funds
Figure 2: Campaign failure

New to blockchain? Check out CoinGeek’s Blockchain for Beginners section, the ultimate resource guide to learn more about blockchain technology.

Related News