Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: StackGambler on June 01, 2019, 08:33:13 AM



Title: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: StackGambler on June 01, 2019, 08:33:13 AM
My friend works for a Discord gambling bot and we are considering adding a precredit system, where users can gamble with their balance even if their deposit does not have a confirmation.

We will not accept transactions that signal RBF, and there are a few other criteria. I'm wondering, is it entirely safe to accept non-RBF transactions that are in the highest fee band? Is it possible for the average bitcoin user to cancel or double spend a non-RBF transaction? Thank you.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: ranochigo on June 01, 2019, 09:34:07 AM
In the past, there were several gambling sites that didn't require confirmations for the Bitcoins to be credited and only needed confirmations for withdrawals. AFAIK, most of them has stopped such practices.

Bitcoin transactions can be, in a sense,  "reversed" rather easily. With the participation of a miner[1], they can essentially double spend whenever they want. For an average Bitcoin user, it does get a lot harder given the few criterias:
1) Transaction is well propagated with majority of the nodes having knowledge of it
2) All inputs are confirmed
3) The fee included is sufficiently high
4) Transaction is NOT non-standard, etc.

However, given these factors, they are still potentially dangerous given the fact that the network conditions are volatile and it can change at any given moment. If you are able to operate with a slightly smaller margin (with the potential of losing money), then it wouldn't be that bad of an idea. At the end of the day, the risk is there but it depends on how much risk you want to take

[1] https://bitcointalk.org/index.php?topic=327767.0


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: o_e_l_e_o on June 01, 2019, 09:44:21 AM
I'm wondering, is it entirely safe to accept non-RBF transactions that are in the highest fee band? Is it possible for the average bitcoin user to cancel or double spend a non-RBF transaction? Thank you.
Is it entirely safe? No. Is it possible for the average user to double spend? Also no. But there is obviously a subset of more advanced users who could double-spend a non-RBF transaction, and leave you out of pocket. A good resource for more information is here: https://bitcoincore.org/en/faq/optin_rbf/. Pay particular attention to the first three paragraphs under the heading "Why aren’t unconfirmed transactions safe?".


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: AB de Royse777 on June 01, 2019, 10:23:44 AM
In the past, there were several gambling sites that didn't require confirmations for the Bitcoins to be credited and only needed confirmations for withdrawals. AFAIK, most of them has stopped such practices.
~snip~
In addition to the above quote,
Sportsbet.io still does not require any confirmations however without 3 confirmation of your deposit they will not allow your balance to withdraw. I do not see any risk here or there is?


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: o_e_l_e_o on June 01, 2019, 10:39:29 AM
Sportsbet.io still does not require any confirmations however without 3 confirmation of your deposit they will not allow your balance to withdraw. I do not see any risk here or there is?
Technically, someone could make a deposit, gamble it immediately at high odds, and if they win let the deposit confirm, and if they lose double spend to cancel the deposit. So although they could never cash out without letting the deposit confirm, they could theoretically have unlimited chances at hitting a winning bet. I'm sure their account would rapidly be deactivated/shut down, but they can always create another one and circumvent IP bans with VPNs or Tor. It's a lot of effort to go to, sure, but it's not impossible.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: AB de Royse777 on June 01, 2019, 11:10:39 AM
~snip~
Technically, someone could make a deposit, gamble it immediately at high odds, and if they win let the deposit confirm, and if they lose double spend to cancel the deposit. So although they could never cash out without letting the deposit confirm, they could theoretically have unlimited chances at hitting a winning bet. I'm sure their account would rapidly be deactivated/shut down, but they can always create another one and circumvent IP bans with VPNs or Tor. It's a lot of effort to go to, sure, but it's not impossible.
I see a point there.
But it will be a task of a lot of patience and enthusiasm. If anyone even tries it they will try it with high amount of deposit I think since with low amount the effort they will give will not worth it.

Anyway, yes I see the point of misuse it.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: AdolfinWolf on June 01, 2019, 12:36:53 PM
I see a point there.
But it will be a task of a lot of patience and enthusiasm. If anyone even tries it they will try it with high amount of deposit I think since with low amount the effort they will give will not worth it.

Anyway, yes I see the point of misuse it.
You'd be surprised to what length and effort some users are willing to go for even a couple bucks.
And a high amount - losing 0.1BTC could already be a significant portion of a casino's winnings for that day.

For the risk and (relative non-complexity) involved, it could be well worth it for some users to try this scam.

I'm wondering, is it entirely safe to accept non-RBF transactions that are in the highest fee band? Is it possible for the average bitcoin user to cancel or double spend a non-RBF transaction? Thank you.
Is it entirely safe? No. Is it possible for the average user to double spend? Also no.
I'm not so sure about this. I think there's some tools out there which, if you're familiar with just signing a transaction, will let you double-spend your funds with ease.

The only solution i see really is the one rachinogo already mentioned; only credit 0-conf tx's that have high fees. This way it becomes incredibly hard for scammers to orchestrate their scam correctly.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: ranochigo on June 01, 2019, 12:58:36 PM
I'm not so sure about this. I think there's some tools out there which, if you're familiar with just signing a transaction, will let you double-spend your funds with ease.
Really? The last time such a tool exist was with Blockchain.info. The tool basically just scripted two transactions with different outputs and they were broadcasted at the same time. This probably won't work anymore since Full RBF doesn't actually work with nodes rejecting subsequent transactions spending the same inputs.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: StackGambler on June 01, 2019, 01:04:17 PM
I see a point there.
But it will be a task of a lot of patience and enthusiasm. If anyone even tries it they will try it with high amount of deposit I think since with low amount the effort they will give will not worth it.

Anyway, yes I see the point of misuse it.
You'd be surprised to what length and effort some users are willing to go for even a couple bucks.
And a high amount - losing 0.1BTC could already be a significant portion of a casino's winnings for that day.

For the risk and (non-complexity) involved, it could be well worth it for some users to try this scam.

I'm wondering, is it entirely safe to accept non-RBF transactions that are in the highest fee band? Is it possible for the average bitcoin user to cancel or double spend a non-RBF transaction? Thank you.
Is it entirely safe? No. Is it possible for the average user to double spend? Also no.
I'm not so sure about this. I think there's some tools out there which, if you're familiar with just signing a transaction, will let you double-spend your funds with ease.

The only solution i see really is the one rachinogo already mentioned; only credit 0-conf tx's that have high fees. This way it becomes incredibly hard for scammers to orchestrate their scam correctly.

Thank you. I am aware that it is quite easy to double-spend a RBF-signalling transaction, but haven't heard of a simple way to do it for a non-RBF one. Yes, we will only be precrediting deposits in the highest fee band (that are expected to confirm within the next 2 blocks). Hope everything goes well: I appreciate everyone else's advice!


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: AdolfinWolf on June 01, 2019, 01:18:08 PM
I'm not so sure about this. I think there's some tools out there which, if you're familiar with just signing a transaction, will let you double-spend your funds with ease.
Really? The last time such a tool exist was with Blockchain.info. The tool basically just scripted two transactions with different outputs and they were broadcasted at the same time. This probably won't work anymore since Full RBF doesn't actually work with nodes rejecting subsequent transactions spending the same inputs.

Hmm yeah. You're probably right. i guess this has changed. I seem to recall a tool that had it's own full nodes broadcasting your tx, which i think prevented the txn-mempool-conflict errors for other nodes that hadn't yet gotten the other tx/miners somehow. Can't find it anymore though, so it probably wasn't as easy as i remembered it to be.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: AB de Royse777 on June 01, 2019, 01:21:13 PM
~snip~
You'd be surprised to what length and effort some users are willing to go for even a couple bucks.
And a high amount - losing 0.1BTC could already be a significant portion of a casino's winnings for that day.

For the risk and (non-complexity) involved, it could be well worth it for some users to try this scam.
LOL
I am a regular gambler in sprotsbet.io and one of the best feature I like about them is this feature of not to wait for the confirmation. I may move to cloudbet long ago if sportsbet would not have this feature because I was amazed by the friendly welcome Ronnie had for me.

Anyway, I think we are going off topic.
The point is that even though their is a little chance to take advantage but I never even thought about it that it was possible until o_e_l_e_o (https://bitcointalk.org/index.php?topic=5149693.msg51306270#msg51306270)'s response.

Cheers :-)


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: LoyceV on June 01, 2019, 01:21:27 PM
I am aware that it is quite easy to double-spend a RBF-signalling transaction, but haven't heard of a simple way to do it for a non-RBF one.
I've used double spending a few times back in the days where 0-fee transactions were still possible, but didn't get confirmed for 2 weeks.
I'd say you can prepare a double spend transaction with much higher fee even before you send your transaction (this is quite easy with coinb.in), and broadcast it when needed later on.
I'm not sure if nodes still allow broadcasting this way, and I don't really want to make a test-transaction with very high fee (say 2000 sat/byte) to find out.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: malevolent on June 01, 2019, 09:40:31 PM
I'd ask devans (https://bitcointalk.org/index.php?action=profile;u=935622) or RHavar (https://bitcointalk.org/index.php?action=profile;u=389331), how they decided to design bustadice/bustabit's precredit systems (if it's something they're willing to share). I'm wondering if they're just following the criteria mentioned by ranochigo, or if it's something fancier. They charge a fee for precrediting, and I imagine they're pretty conservative when deciding which transactions are safe enough.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: StackGambler on June 02, 2019, 01:26:16 AM
I'd ask devans (https://bitcointalk.org/index.php?action=profile;u=935622) or RHavar (https://bitcointalk.org/index.php?action=profile;u=389331), how they decided to design bustadice/bustabit's precredit systems (if it's something they're willing to share). I'm wondering if they're just following the criteria mentioned by ranochigo, or if it's something fancier. They charge a fee for precrediting, and I imagine they're pretty conservative when deciding which transactions are safe enough.

I asked Ryan a few days ago, and he gave me some valuable advice which I'll be incorporating. Daniel doesn't reveal the details of his precredit system so that users don't try to game it, but as far as I can see, it's pretty complex. It even takes into account the number of mempools the transaction is in, so that a transaction that is not precreditable at one time may be precreditable 5 minutes later.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: o_e_l_e_o on June 02, 2019, 08:40:14 AM
It even takes into account the number of mempools the transaction is in, so that a transaction that is not precreditable at one time may be precreditable 5 minutes later.
If a node already has a transaction stored in its mempool waiting to be confirmed, and it learns of a new conflicting transaction which is attempting to double spend, by default it will simply reject the new transaction and it also will not broadcast the new conflicting transaction on to other nodes.

I don't know the details, but presumably once a transaction is stored on a "critical number" of nodes/mempools, it becomes very hard for a conflicting double spend transaction to propagate through the network. That's not to say it's impossible (and there remain other ways to double spend a transaction), but it would give an extra level of protection.


Title: Re: Is it easy to reverse a 0-conf transaction without signalling RBF?
Post by: bob123 on June 03, 2019, 08:08:24 AM
There are several ways of double spending a transaction.

While a regular user probably won't be able to achieve that, more technical people might still be able to do so.

Especially if a miner is involved, this could create quite a risk.


But it also depends on how much money is being gambled. If you don't have a limit (or a very high limit) i would definitely suggest to NOT accept 0-conf transactions.
However, if the amount is pretty low, it shouldn't be a problem.


Just broadcasting a second transaction with a higher fee, will probably be rejected by most nodes.


But for example, if my nodes connects to your node and to 7 of my 'helper nodes' (which all are connected to multiple other nodes), i could send you the transaction which sends you the funds and simultaneously broadcast the double-spending transaction from my 7 other nodes.

While your node would only see the transaction with you being the recipient (because it rejects conflicting transactions by default), you would never see the conflicting transaction, while the majority of the network would have the double-spending transaction in their mempool.


Another example would be, if i know that a specific mining pool doesn't care about conflicting transaction in the mempool and is profit-orientated, i could try to get a direct connection to his node.
Then i'd simply broadcast the double-spending transaction with an insanely high fee.

If he doesn't care about the conflict in the mempool, he will include the one with the insanely high fee (lets say 1000x higher) once he mines a block.



Noone would probably go trough all of that hassle for 50$.
But if bets with 1 or more BTC are allowed, this definitely is an existing threat.