liberapay / liberapay.com

Source code of the recurrent donations platform Liberapay
https://liberapay.com/
1.67k stars 215 forks source link

Add bitcoin support #364

Closed MartinDelille closed 3 years ago

MartinDelille commented 8 years ago

After today email discussion, I think it's time to think about bitcoin support. I have collected two ressources that might help me in the process:

I need to do some further investigation but the main issue will be how to deal with the situation where someone give bitcoin to another accept only euro. I think we agree not to partition money flow? What should be the referal value in the system?

Feel free give me your point of view!

Changaco commented 8 years ago

This is blocked on #182.

Changaco commented 7 years ago

Quote from Learning From A Year of Security Breaches:

Bitcoin is targeted, even if you store none.

Platform companies are often compromised with the assumption that they may have access to, or integrate with, a bitcoin company. Please refer to the Blockchain Graveyard for more information on this trend, or this public example from SendGrid’s blog.

Nutomic commented 7 years ago

It should be pretty simple to do this kind of integration with Coinbase Payment Buttons. Basically you just have to register a merchant account and embed the button. And you can configure it to do automatic, daily payouts to a bank account.

ollieparanoid commented 7 years ago

I am afraid to use my card online (especially on liberapay.com I have never heard about), any option for paypal or bitcoin?

I've gotten similar e-mails (with bitcoin, monero, not paypal) and would appreciate this feature very much 🎉

Thanks for making this awesome platform in the first place, and I understand that the feature is blocked right now.

ericfont commented 7 years ago

Sorry if I'm pointing out the obvious, but I feel compelled to note that bitcoin itself does not have a mechanism for recurring payments (in other words an owner of a wallet can only "push" payments, but a receiver can't "pull" payments), which clearly is essential for any patronage-based donation service.

It seems Coinbase has implemented "pull" payments, so I'd second what Nutomic says.

(I do understand that this issue is blocked on #182, but I'm really hoping to integrate bitcoin, because that would be a game-changer).

pm73 commented 6 years ago

I would like to say that I actually prefer to have option of making "push" payment. I see you allow wire transfer according to FAQ, so it is already supported.

Please note that Coinbase can arbitrary suspend an account. If you go with them anyway, please make sure user can make one-time payment without Coinbase account and giving them his/her data.

CoinPayments allows sender to choose one of many cryptocurrencies, which is quite useful considering how expensive Bitcoin transaction can be. I'm not affiliated with them, I just paid them for something and it worked.

bjorn commented 6 years ago

bitcoin itself does not have a mechanism for recurring payments (in other words an owner of a wallet can only "push" payments, but a receiver can't "pull" payments), which clearly is essential for any patronage-based donation service.

I don't get this statement, and would also prefer to "top up" manually rather than having a service pull money out of my pocket on its own account. It's not like I'm paying for a service here, I'm just donating. So if the balance runs out, then the donation won't go through. No legal action is required since I wasn't obliged to keep donating. A "low balance" warning would be nice of course.

ericfont commented 6 years ago

You're right, it's not a problem for topping up.

maurokenny commented 6 years ago

@bjorn you are right. Maybe just a message to remember to send more money to liberapay would be enough.

@pm73 CoinPayments seems to be cheaper.

Another option is https://www.bitwage.com/

How does it work today? I mean, when someone sends money, does it go to a liberapay's bank account and then every month you send some amount to the content creator using mangopay? Or does it go to mangopay's account and then they send every month?

maurokenny commented 6 years ago

@MartinDelille I think that CoinPayments and https://www.bitwage.com/ do the job

hopeseekr commented 6 years ago

I can definitely implement CoinPayments.net support for this project.

I have done this both commercially and for free for non-profits and open source projects many times. It takes me about 2-3 hours of work.

Just let me know!

jorgesumle commented 6 years ago

@hopeseekr, sure.

It would be great. Now this issue isn't blocked by #182, so if it works well we will merge it. Remember that there are also other cryptocurrencies apart from BitCoin (for example, FairCoin), so you probably should try to make some of the code reusable. If you decide to work on that, let us know, and we will add you to the Liberapay team.

hopeseekr commented 6 years ago

It will support over 50 cryptocurrencies, but faircoin isn't one of them (first I heard of it).

I will do this next week if you get everything setup.

It's a 90% HTML5 + JS implementation. The only part that comes from Python would be the fiat currency price and item name.

hopeseekr commented 6 years ago

If the coin supports QR codes, then once I get the HTML5 framework setup, your devs should be able to add additional QR/coins relatively easily. That's what my existing clients do.

hopeseekr commented 6 years ago

@jorgesumle What I need:

  1. The source code location for where your checkout button is. Like where they say "pay" by credit card.
  2. A snippet of code (in the form of a GitHub gist) showing how to inject the product name and fiat currency price into a JavaScript JSON object.

In this format:

{
    "item_name": "<?php echo $item->name; ?>",
    "item_price": "<?php echo $item->price; ?>",
}
  1. The location of CSS and HTML for the shopping cart page.

I have a very limited familiarity with Python. That's the only risk I see.

jorgesumle commented 6 years ago

@Changaco has more knoledge of the codebase than me, but I think that you can find pretty much everything using grep with the option -R and some text of the English page you want to modify. For example, grep -R '\<Pay\>' www/ returns:

www/%username/invoices/%invoice_id.spt:        <button class="btn btn-success btn-lg" name="action" value="accept">{{ _("Accept and Pay") }}</button>
Serkan-devel commented 6 years ago

Has anyone here looked into POA bridge for this?

markasoftware commented 6 years ago

If this becomes implemented, in the "spirit" of Bitcoin it would be best if transactions are handled through a self-hosted Bitcoin node, either by directly interacting with the Bitcoin Core RPC/REST API, or a combination of the FOSS BTCPay server and the Bitcoin Core APIs only for sending outgoing transactions.

MartinDelille commented 6 years ago

There is an interesting proposal about Nano crypto currency here: https://github.com/liberapay/liberapay.com/issues/1171#issuecomment-405363470

rikur commented 6 years ago

People have barely heard of Bitcoin and now we want to get them to learn about Nano? How would you ever buy that? You first setup Bitcoin wallet, then buy some Bitcoin, then setup a Nano wallet and then find some online exchange to buy Nano?

I think you'd lose most of your users.

guilhermelawless commented 6 years ago

First of all, there are places to buy Nano directly, and more projects incoming. Most promising (yes they are different):

  1. https://www.localnano.com/
  2. https://localnanos.com/

By the time you would be done with implementation, they will be ready.

Also, even in the case that you need to buy Bitcoin, you don't have to setup a wallet. Just transfer to wherever you can buy Nano with Bitcoin, they have a wallet ready for you.

Finally, setting up a Nano wallet is literally the easiest thing ever.

Cheers.

rikur commented 6 years ago

For whatever it's worth, I wouldn't go for a Nano only solution. If you want to support cryptocurrencies, start with Bitcoin.

guilhermelawless commented 6 years ago

Definitely.

arthurgervais commented 6 years ago

Transaction fees on Bitcoin/Ethereum are highly volatile, accepting on-chain transaction will therefore likely make you loose several USD per donation: https://bitinfocharts.com/comparison/bitcoin-transactionfees.html https://bitinfocharts.com/comparison/ethereum-transactionfees.html

Hi there, my name is Arthur from Liquidity.Network, and I'm Assistant Professor at Imperial College London. We have the first off-chain solution for the Ethereum network ready, which allows to process crypto transactions (currently ETH) without incurring transaction fees.

I believe that in particular for the donation use-case that is important as typical donations are small value transfers.

For two short demos on Liquidity I would refer you to here: https://www.youtube.com/watch?v=43DFoNiE5mQ https://www.youtube.com/watch?v=FD5E5LMt7SI

Our website is available under https://liquidity.network, and our blog under https://medium.com/@liquidity.network

Happy to further evaluate how we could help you accepting crypto!

markasoftware commented 6 years ago

@arthurgervais the lightning network for Bitcoin is like that, but much more peer-reviewed, more implementations, and overall more widespread support plus a more open development environment. Additionally, it is not run by any for profit group. It is more suitable for this project than technologies like yours or the Raiden network.

Serkan-devel commented 6 years ago

@markasoftware but the lightning network causes bitcoin to be more centralized

https://www.youtube.com/watch?v=UYHFrf5ci_g https://medium.com/@jonaldfyookball/mathematical-proof-that-the-lightning-network-cannot-be-a-decentralized-bitcoin-scaling-solution-1b8147650800

DiGitHubCap commented 6 years ago

@Serkan-devel This is misleading and likely inaccurate. See: https://www.youtube.com/watch?v=c4TjfaLgzj4

This issue seems to be getting a little bit off-topic. No one is saying that Liberapay can only implement support for one cryptocurrency, but if you had to pick only one, it would obviously be Bitcoin (possibly with Lightning Network as well). Proposals for other cryptocurrencies should be in separate issues.

arthurgervais commented 6 years ago

@markasoftware @DiGitHubCap @Serkan-devel Lightning is a great choice for Bitcoin indeed. Please bear in mind that for each payment channel (i.e. each donator), you'd need to fund an onchain transaction, even if you're only on the receiving end (which in Liquidity is not the case).

Apologies, didn't mean to bring the thread off topic. I believe the more cryptocurrencies you can accept, the merrier :-) There are millions of people that would love to donate their different coins (see the market caps here https://coinmarketcap.com/).

To clarify, Liquidity is published and open academic research: https://liquidity.network/NOCUST_Liquidity_Network_Paper.pdf, https://eprint.iacr.org/2017/823.pdf

Will move over to https://github.com/liberapay/salon/issues/247 for broader cryptocurrency discussions 👍

CameronNemo commented 6 years ago

BitPay offers payments in two currencies (Bitcoin and Bitcoin Cash), Coinbase Commerce offers support for four (BTC/BCH, Ethereum, and Litecoin). Both charge very minimal processing fees and can be great options for someone looking to send donations without a card. Best part: Liberapay does not need to "hold the bag" (so to speak); BitPay and Coinbase support settlement to fiat. This can be automated with BitPay.

https://commerce.coinbase.com/ https://bitpay.com/tour

markasoftware commented 6 years ago

@CameronNemo Liberapay's rejection from Mango should be a lesson. Not a lesson that USD is bad or that cryptocurrency is great, but rather a lesson that relying on centralized services is bad. BitPay and Coinbase Commerce are both centralized, and, like Mango, they could start refusing service to LiberaPay, triggering this whole problem a second time. Even if they don't outright refuse service, they could lower the quality of service (for example, BitPay recently starting using a widely despised Bitcoin address/payment format (BIP71), and there was nothing merchants could do about it)

If LiberaPay is going to use crypto, it's important to do it properly by self-hosting an open-source payment gateway like BTCPay Server, Electrum, or maybe just directly interfacing with Bitcoin Core's RPC or REST API.

cryptify commented 6 years ago

Hey guys, I run the cryptify token on the Eth network and have done a decent amount of crypto work using Go, Java, and C++. Let me know if you're interested in a collaboration. I'm a supporter of archive.is and came across this project here --> https://blog.archive.is/post/170812427911/please-accept-cryptocurrency-donations-eg-bch#notes

MartinDelille commented 6 years ago

@cryptify would you have the technical skill to help us implementing this new currency in Liberapay?

MartinDelille commented 6 years ago

A blog post about Bitcoin explaining why it is a technological advance: https://becominghuman.ai/explained-in-5-minutes-cryptocurrency-43be6a9253e9

MartinDelille commented 6 years ago

@markasoftware I just fix the URL for https://bitcoincore.org/

MartinDelille commented 6 years ago

And I just applied to the developer slack to get support.

MartinDelille commented 6 years ago

Here is a short article about Bitcoin: https://becominghuman.ai/explained-in-5-minutes-cryptocurrency-43be6a9253e9

trebmuh commented 6 years ago

https://becominghuman.ai/explained-in-5-minutes-cryptocurrency-43be6a9253e9

@MartinDelille : I'm really not convinced by the "*coins movement of using and producing money will save the world". For my point of view, most of the time, the xxx-coin moneys are mostly just another Ponzi scheme.

My guess is this full of errors/approximations article (but that is what it is) isn't going to help anyone to be convinced that a move to Bitcoin or another *coin is valuable for a project like LiberaPay.

Examples:

So every time you put in 10 million dollars in to the bank, they’d only have 1 million out of the 10 you gave them in cash.

ahahah ! The person who write that is (at minimum) at least thinking back several centuries ago when "consumption credit" and '"credit money" wasn't a thing.

Since nobody can just get gold out of thin air, it doesn’t inflate like fiat currencies.

Sure thing, there has never been market speculation and market deformation against gold/silver... obviously there are!

It’s still volatile and a very risky investment, but in the long run, will prove extremely valuable.

I think this is the only sentence really honest in the whole article. Bitcoin is a new toy for people who want to invest and they hope it to be valuable in the future. Casino game, here we are.

MartinDelille commented 6 years ago

@trebmuh Thank you for the valuable feedback on this article. I personnaly don't have enough economic knowledge to say if bitcoin is better or worse than fiat money. My point was just to add some documentation here.

Anyway, using bitcoin should be an alternative for people who want to use Liberapay. There is currently 14 votes for and only 2 votes against this issue, so I think we should go further.

The main reason to implement bitcoin in Liberapay would help us the neutrality principle which is at the project origin (currently discussed here by the way: https://github.com/liberapay/liberapay.org/issues/40).

trebmuh commented 6 years ago

I've added a third vote against that, FWIW.

MartinDelille commented 6 years ago

Ok this is not nice for people who want to use bitcoin but I respect your vote.

trebmuh commented 6 years ago

That is not more "not nice for people who want to use bitcoin" that people who want to use it are then being "not nice for people who doesn't want to use bitcoin".

Please, don't encourage people with different opinions to be one against each other. Thanks for the respect anyway.

MartinDelille commented 6 years ago

Ok I answered too quickly. Having different point of view is crucial for a project like this and I would like to apologize.

trebmuh commented 6 years ago

Thank you.

trebmuh commented 5 years ago

2 more people interested in having bitcoin support in LP from the Diaspora* LP account.

MagicFab commented 5 years ago

One way to implement this for Bitcoin (or any crypto currency, really) would be to initially:

Phase 2 of this integration could include validating addresses, using an API to Bitcore, etc.

MartinDelille commented 5 years ago

This would be a good start. We could even remove the QR-Code from the first version.

mattbk commented 5 years ago

For subscription/recurrent contributions, generate an email at the same frequency that would remind the donor to send funds by providing a URL to the Liberapay user page.

This would require storing the cryptocurrency donation in the database in some way, but not having any control over whether the donation was actually completed. I'm not sure how keen I am on that.

MagicFab commented 5 years ago

This would require storing the cryptocurrency donation in the database in some way, but not having any control over whether the donation was actually completed. I'm not sure how keen I am on that.

Can you elaborate ? Is your concern the amount of donations, the inability to confirm them automatically or both?

The transaction confirmation could be entered manually but it's not convenient and can't be expected of donors. Every crypto transaction is in the blockchain so this is available, just not automatically.

This is the kind of "2.0" feature that could be crowdfunded by crypto donors.

mattbk commented 5 years ago

The inability to confirm them.

MagicFab commented 5 years ago

Re-thinking this there really is no reason why you couldn't check a user's crypto address after a link to pay has been sent (within 1-2 days?) and verify any funds have been sent there, for those with public blockchain support (like Bitcoin). For others it may not evene be wanted to track the amounts (eg. Monero). What's the reason for wanting confirmation of such donations on LP? Commitments to donate could be tracked separately in this case (vs. hard-confirmed donations).