Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

automate bitcoin payouts #1960

Closed
chadwhitacre opened this issue Jan 30, 2014 · 25 comments
Closed

automate bitcoin payouts #1960

chadwhitacre opened this issue Jan 30, 2014 · 25 comments

Comments

@chadwhitacre
Copy link
Contributor

Right now we're doing bitcoin payouts manually in response to user requests to [email protected]. We're starting to see enough of these requests that we should consider automating it via the Coinbase API (the user doesn't need to know or care that we're using Coinbase).

The twist is that Coinbase doesn't give us an API to buy BTC given a USD price. We have to check the price and then buy the BTC in two separate API calls, and the amount can and does shift in between those calls. So there's some fudge.

Here's the basic flow:

Unlike PayPal, we should fully automate this as part of the payout loop of payday.

@sim6
Copy link
Contributor

sim6 commented Jan 30, 2014

There is an issue for automate payins and payouts #1964

@chadwhitacre
Copy link
Contributor Author

+1 from @xnyhps in IRC (logging down :-( ).

@chadwhitacre
Copy link
Contributor Author

+0 from @garyburd via support@.

@chadwhitacre
Copy link
Contributor Author

+1 from @pjz in IRC.

@pjz
Copy link

pjz commented Apr 25, 2014

Having > 1 withdrawl option means there needs to be a mechanism to choose one, to handle the case where they're all defined.

@chadwhitacre
Copy link
Contributor Author

@pjz Yeah, I made a ticket about a "funding rules UI" to address that sort of thing: #2299.

@chadwhitacre
Copy link
Contributor Author

@patcon is looking at scripting this as a step on the way. IRC

@lyndsysimon
Copy link
Contributor

I'm currently simmering on ways that Gittip can control the disbursement of BTC-denominated tips over time without having exposing ourselves to undue risk of loss of funds.

I don't have a specific recommendation yet, but GreenAddress.it (a/k/a/ "gait") is currently using multisig for some of this - the user can't spend without gait's signing the transaction, and since gait doesn't store the user's private key, even dumping their database wouldn't allow user funds to be spent.

They're offsetting the risk of lost coins due to service disruption with nLockTime transactions. From their FAQ:

But what happens if your service goes away? Will I lose my coins?

GreenAddress.it signs each transaction with its own key in addition to client-side signing by user's keys, and funds are stored in 2-of-2 multisignature outputs requiring both signatures to spend. The drawback of it is that you cannot control your funds without GreenAddress.it's signature, so you are right to worry that you can lose your coins.

But! We have solved this issue by providing nLockTime transactions which essentially make deposits 'expire' after some time, which allows redeeming them without our intervention after this pre-set period of time. It is enabled by default when you have email notifications and two factor enabled.

This allows you to keep your ease of mind even in case GreenAddress.it disappears with its keys.

It also means that every time the funds expire the user has to re-transfer them. This can be automated on login and notified in advance via email or manually done.

For redeeming the funds after expiration, you can use a tool we've developed specifically for this purpose - see Gentle and its project on GitHub. It's open source!

I'm thinking we can use a series of nLockTime transactions to ensure that disbursement will happen, and that it happens over time. Automating the process of creating and submitting these transactions are problems I've thought about but not yet addressed.

@bjorn
Copy link

bjorn commented Jun 2, 2014

The twist is that Coinbase doesn't give us an API to buy BTC given a USD price. We have to check the price and then buy the BTC in two separate API calls, and the amount can and does shift in between those calls. So there's some fudge.

Is this old information? Looking at https://coinbase.com/api/doc/1.0/transactions/send_money.html there seem to be amount_string and amount_currency_iso fields that can be used to send a particular amount of USD to somebody in Bitcoin. In addition, the instant_buy parameter can be used to tell it to immediately purchase any Bitcoins necessary for sending. Wouldn't that provide exactly the required functionality?

I did read that there is a limit on Instant Buy of just $1000 per week. I'm not sure how close to this Bitcoin payouts currently are on gittip, but it seems to me like this limit is easily reachable so possibly Coinbase would need to be approached about raising this limit.

@steveklabnik
Copy link

It's still not really technically possible to pay out to btc when you take in from visa/mastercard. Bitcoin doesn't get around the 'card networks want you to have a banking partnership' issue.

Donations in bitcoin can absolutely be paid out to anyone in btc. the issue is donations that start with visa/mc.

@lyndsysimon
Copy link
Contributor

@steveklabnik I don't think it's not technically possible. I do believe that it's not possible to do it in a single step.

The biggest issue I see if fraud. What happens when I send $1,000 to a bunch of people on Gittip, then reverse the charge after the Bitcoin has been disbursed?

@bjorn
Copy link

bjorn commented Jun 3, 2014

@steveklabnik This issue is just about Bitcoin payouts. I don't see how the donation source comes into it. I was only pointing out that Coinbase's API does seem to support our use-case better than suggested in this issue.

@lyndsysimon Wouldn't there be a time limit after which credit card transactions can no longer be reversed? If so, payouts to Bitcoin should only be done from credit that has sufficiently aged in escrow. This is of course a little more complicated technically.

@lyndsysimon
Copy link
Contributor

@bjorn Typically, credit card transactions can be reversed for 3 to 6 months - but it depends on the issuer's policy. As far as I know, there is no real hard limit on that timeframe. I don't suppose it matters if there is or isn't though, because waiting 6 months for a payment to be released from escrow isn't reasonable anyhow.

This is one of the biggest advantages of Bitcoin IMO - transactions are nonrepudiatable. Once sent, they cannot be reversed.

I agree that Coinbase's support has gotten better and now more fully supports our use case. Unfortunately though, we have to consider the funding source before paying out in Bitcoin. The only "safe" sources are ones that are also nonrepudiatable: physical cash transfers and incoming Bitcoin payments. Anything else will expose us to risk of chargeback.

There have even been cases of people depositing cash in a provider's account at a bank branch, getting their Bitcoin, then going back in the bank and "canceling" the transaction to get the cash back. It's crazy.

I don't mean to come off as hysteric here, but I am confident that if we pay out in Bitcoin based on payments in fiat, we will be scammed.

@martindale
Copy link

I will reiterate some of my previous comments, but please do not muddy the water of Bitcoin vs. fiat. Treat Bitcoin as its own currency, do not become or concern yourselves with becoming an exchange.

@steveklabnik
Copy link

You cannot not muddy them, do to Visa and Mastercard's rules. That is my point. ACH in, BTC out: fine. Visa/MC in, BTC out: bad.

@rohitpaulk
Copy link
Contributor

It's still not really technically possible to pay out to btc when you take in from visa/mastercard. Bitcoin doesn't get around the 'card networks want you to have a banking partnership' issue.

Donations in bitcoin can absolutely be paid out to anyone in btc. the issue is donations that start with visa/mc.

Aren't we doing that right now? We're paying out manually, but we are paying out bitcoin for money that we pulled off CCs.

@chadwhitacre
Copy link
Contributor Author

IRC

@chadwhitacre
Copy link
Contributor Author

Filing this here:

Greetings!

Could you demystify something for me? Earlier this week I purchased ~$700 worth of btc. Now today my instant buy limit was $673.51. I purchased that much btc, and now my limit is $0.18 ... and I refresh and see $0.62. Now it's $1.33!

How is my instant buy limit calculated?

Thanks! :-)

Reply from Coinbase:

Your limit refills over time across a seven day period, so the calculation looks like this: CurrentLimit = ( MaxLimit * T ) / ( 7 * 24 ) where T = time since last instant purchase. I didn’t realize that we recalculate it more often than once a minute though, that’s pretty cool.

@rohitpaulk
Copy link
Contributor

We're one step closer than before - The manual BTC payouts are now processed via a script which was added in #2802.

@chadwhitacre
Copy link
Contributor Author

@sim6
Copy link
Contributor

sim6 commented Oct 11, 2015

If I understood correctly, no more bitcoins in gratipay, so I'm going to close this issue. More info at gratipay/inside.gratipay.com#201 (comment)

@sim6
Copy link
Contributor

sim6 commented Oct 11, 2015

I cannot close it, I am out of gratipay :(

@chadwhitacre
Copy link
Contributor Author

I cannot close it, I am out of gratipay :(

A bug! :-)

Invite resent ...

@sim6
Copy link
Contributor

sim6 commented Oct 12, 2015

Thanks!

@sim6 sim6 closed this as completed Oct 12, 2015
@chadwhitacre
Copy link
Contributor Author

:-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants