PIVX-Project / PIVX

Protected Instant Verified Transactions - Core wallet.
https://www.pivx.org
MIT License
528 stars 714 forks source link

Watch Only addresses not working. #476

Closed siulynot closed 6 years ago

siulynot commented 6 years ago

Using watchonly addresses wont show a balance unless wif key gets imported to native wallet.

In Komodo Platform we are working on a decentralized exchange called BarterDEX that relies on watchonly addreses to show balances in the application. It turns out that we discovered that the PIVX daemon is not working with watchonly addresses and might make users think that they lose PIVX if they interact with a watch only address.

Fuzzbawls commented 6 years ago

Please provide more details other than "not working"

cipig commented 6 years ago

When you call listunspent with an address previously imported with pivx-cli importaddress, the list is empty, but it should not be empty.

rejectedpromise commented 6 years ago

With some initial research, it looks like the inner wallet logic has changed to disclude watch only addresses as spendable inputs, because they are not considered unspent since the local wallet can not spend them. I think the root of this change was because watch only address UTXOs were showing up in coin control (still not spendable by local wallet) and caused confusion for users of coin control and watch only addresses since it would work the same on the gui as an owned UTXO, up to the point of trying to actually spend it since it is not able to be signed by the local wallet. I will look into potential solutions and keep the issue updated.

leto commented 6 years ago

If there is a bounty for this, I can help y'all. I wrote the 2way replay protection for BTCP and I am a core dev of HUSH, and I helped add HUSH to BarterDEX via ElectrumX .

I am very familiar with the wallet code that has this bug.

jl777 commented 6 years ago

the solution is to check isspendable:true and to not count it if it is false or ismine:true would work too

presstab commented 6 years ago

Changing the logic here isn't complicated in any sense. We just need to decide how we would like to change this. Leaning towards adding an extra bool to listunspent that will allow users to determine whether or not they want watch only UTXOs included.

jl777 commented 6 years ago

https://chainquery.com/bitcoin-api/listunspent

for a while listunspent returns watchonly, but with the iswatchonly:true, ismine:false, isspendable:false

blondfrogs commented 6 years ago

listunspent now allows allows for configurations that allow watchonly transactions to be shown in the output. Fixed in pull request #539