Bitcoin Forum
May 12, 2024, 07:06:15 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: safest way to accept unconfirmed transactions  (Read 618 times)
anonymoustroll420 (OP)
Full Member
***
Offline Offline

Activity: 196
Merit: 101


View Profile
March 16, 2017, 08:04:28 PM
 #1

I realize that accepting unconfirmed transactions is very risky, especially now that the network is congested.

When a customer places an order on the website, I want to order the product as soon as possible from the supplier and only deliver it to the customer when the transaction is confirmed.

No product will be delivered until the transaction is confirmed, therefore the customer cannot make money by double spending, however, there is a risk that a customer could make lots of orders, causing lots of products to be ordered from suppliers, and if those transactions never confirmed then I would lose money.

So here is what my idea is so far.

1. When a transaction is received, rebroadcast this transaction to a large number of nodes and continually do this until it confirms.

2. Wait 30 seconds to ensure transaction has fully propagated, and to check for double spends.

3. If the transaction fee/byte is above a certain amount (dynamically calculated), then order the product from the supplier

4. Once the transaction receives 2-3 confirmations, deliver the product

5. If there are X number of transactions that have not confirmed in an hour (or some other timeframe), assume that someone is attempting to cause financial loss and wait for at least 1 confirmation before ordering any more products.

What other ways can I improve this?

Please don't stop us from using ASICBoost which we're not using
1715497575
Hero Member
*
Offline Offline

Posts: 1715497575

View Profile Personal Message (Offline)

Ignore
1715497575
Reply with quote  #2

1715497575
Report to moderator
1715497575
Hero Member
*
Offline Offline

Posts: 1715497575

View Profile Personal Message (Offline)

Ignore
1715497575
Reply with quote  #2

1715497575
Report to moderator
Whoever mines the block which ends up containing your transaction will get its fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
March 16, 2017, 08:09:50 PM
 #2

Check that the transaction does not spend from any other unconfirmed transactions. Check that the transaction is final, I.e. the sequence number of the inputs are all Max sequence and that the locktime has passed.

HI-TEC99
Legendary
*
Offline Offline

Activity: 2772
Merit: 2846



View Profile
March 16, 2017, 08:14:17 PM
 #3

If the sequence numbers are all FF FF FF FF, then the transaction's opted out of replace by fee, and the transaction is final.

Bitpay does everything you want, but charges a fee for its service.
anonymoustroll420 (OP)
Full Member
***
Offline Offline

Activity: 196
Merit: 101


View Profile
March 16, 2017, 08:27:10 PM
 #4

Thanks for the help guys.

Bitpay does everything you want, but charges a fee for its service.

Do you know if I have to use their payment system, or is this feature provided via an API or something so that I can use it with my own payment system?

Please don't stop us from using ASICBoost which we're not using
HI-TEC99
Legendary
*
Offline Offline

Activity: 2772
Merit: 2846



View Profile
March 16, 2017, 08:37:05 PM
Last edit: March 16, 2017, 08:52:09 PM by HI-TEC99
 #5

Thanks for the help guys.

Bitpay does everything you want, but charges a fee for its service.

Do you know if I have to use their payment system, or is this feature provided via an API or something so that I can use it with my own payment system?

Bitpay's REST interface API for interacting with your BitPay account is explained here.

https://bitpay.com/api

Bitpay's Bitcoin Payment Gateway API for interacting with its Payment Gateway is explained here.

https://bitpay.com/bitcoin-payment-gateway-api

You can use it to embed a Bitpay invoice on your website.


There are alternatives to Bitpay, but I don't know much about them. This website compares some of the top alternatives.

https://alternatives.financesonline.com/p/bitpay/

This page gives a bigger list of alternatives.

https://payment-gateway.financesonline.com/
Quickseller
Copper Member
Legendary
*
Offline Offline

Activity: 2870
Merit: 2301


View Profile
March 19, 2017, 09:08:12 PM
 #6

How diverse is your product base? -- if not very diverse then having a few extra products might not cause very much financial harm.

Do you have a way of tracking if someone is a repeat customer (also are your customers' identities verified)? -- If so, then you can assign each customer a risk profile based on their prior behavior. For example, a customer who has ordered from you multiple times and that has not ever had any kind of failed payment/deposit will probably have a higher chance of having their transaction confirm (or a transaction in the appropriate amount) than a customer who has a history of failed payments/deposits. Also if you have done business with someone many times in the past (and earned profit from this person), then the risk of someone trying to cause you financial harm would be low.

What you are describing sounds very similar to how Gemini will pre-credit some Bitcoin deposits for trading nearly immidiately after receiving the transaction. If this is something similar to what you are trying to implement (or improve), then you can look at the total value of the account verses the value of the deposit. If the deposit is under a certain percentage of the account's balance, then the amount under the certain percentage threshold might be able to be excluded from the total credit risk.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!