Author

Topic: safest way to accept unconfirmed transactions (Read 637 times)

copper member
Activity: 2996
Merit: 2374
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.
legendary
Activity: 2772
Merit: 2846
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/
full member
Activity: 196
Merit: 101
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?
legendary
Activity: 2772
Merit: 2846
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.
staff
Activity: 3458
Merit: 6793
Just writing some code
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.
full member
Activity: 196
Merit: 101
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?
Jump to: