Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Nergon on August 12, 2020, 01:49:01 PM



Title: Bitcoin Core won't allow me to spend unconfirmed BTC
Post by: Nergon on August 12, 2020, 01:49:01 PM
Hello,
I setup a Bitcoin Full Node (Bitcoin Core 0.20.0) for a website and i want to use it with rpc for a website. The website involves sending BTC to another walllet while they are still unconfirmed. The problem is that Bitcoin core won't let me spend Bitcoin from unconfirmed transactions (i always get a "Insufficent founds" error. I tried using -zeroconfspend=1 but it didin't work either. Do you guys know what im doing wrong?
Im using sendtoaddress command for sending btw.


Title: Re: Bitcoin Core won't allow me to spend unconfirmed BTC
Post by: HCP on August 12, 2020, 02:23:55 PM
I tried using -zeroconfspend=1 but it didin't work either. Do you guys know what im doing wrong?
AFAIK, there is no -zeroconfspend option... the only option similar to this for Bitcoin Core is -spendzeroconfchange, but that is for change outputs... not UTXOs from "incoming" transactions.

The problem is that the sendtoaddress API option will only work with confirmed coins (or your unconfirmed change). Basically, the UTXOs that you can see using listunspent command (with default options)... and if those aren't available, then only unconfirmed UTXOs that we created and are then "trusted". If you want to send unconfirmed coins that were not created by your wallet, you'll need to manually create, sign and send a "raw" transaction.

Refer: https://github.com/bitcoin/bitcoin/issues/3288#issuecomment-28939903


Title: Re: Bitcoin Core won't allow me to spend unconfirmed BTC
Post by: Nergon on August 12, 2020, 03:39:18 PM
I tried using -zeroconfspend=1 but it didin't work either. Do you guys know what im doing wrong?
AFAIK, there is no -zeroconfspend option... the only option similar to this for Bitcoin Core is -spendzeroconfchange, but that is for change outputs... not UTXOs from "incoming" transactions.

The problem is that the sendtoaddress API option will only work with confirmed coins (or your unconfirmed change). Basically, the UTXOs that you can see using listunspent command (with default options)... and if those aren't available, then only unconfirmed UTXOs that we created and are then "trusted". If you want to send unconfirmed coins that were not created by your wallet, you'll need to manually create, sign and send a "raw" transaction.

Refer: https://github.com/bitcoin/bitcoin/issues/3288#issuecomment-28939903

Thank you for your fast reply. I implemented it with a "raw" transaction and it works now