What is a workaround to fundrawtransaction for watchonly addresses

1

I have imported watchonly addresses in Bitcoin and trying to createrawtransaction with input watchonly listunspend which has spendable=false, scriptSig=empty.

after that, I'm getting an error on fundrawtransaction with message "Signing transaction failed"

I know it's unsigned and can't calculate fee but if I put in order createrawtransaction signrawtransaction fundrawtransaction sendrawtransaction

still, it gives me an error "Signing transaction failed"?

user2224893

Posted 2017-08-30T15:20:41.360

Reputation: 23

I'm confused - what results do you expect to be able to achieve here? Of course you can't sign the transaction because you don't have any private keys.Nate Eldredge 2017-08-30T16:08:35.867

fundrawtransaction does not sign, and does not need the private key. The error message is confusing. I'll write an answer later.Pieter Wuille 2017-08-30T22:31:17.670

Answers

-1

A bitcoin address, watchonly or not, represents a public key. This public key has a corresponding private key.

If you import a watch only address the corresponding private key is not imported. So you cannot spend any unspent outputs from those addresses.

If you want to send bitcoin to the watch only address, you have to make sure you know the corresponding private key or your bitcoin will be lost.

Choose an unspent output from another address where you know the private key. Take this output when you run 'createrawtransaction'. Sign the transaction with this private key then 'sendrawtransaction'.

Optionally before you 'sendrawtransaction', decode your hex string with 'decoderawtransaction' and make sure everything is correct.

Matos303

Posted 2017-08-30T15:20:41.360

Reputation: 34

1This does not explain why fundrawtransaction doesn't work (which does not need the private key).Pieter Wuille 2017-08-30T22:21:59.837

thanks I didn't know about fundrawtransaction and wrongly assumed user2224893 was mixing up api calls with the english language. Sorry user2224893! I ran the call fundrawtransaction on my node but got an error 'Method not found' I run a node with wallet disabled so I checked https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list and could not see it either. Meanwhile I can see on github it does exist, my bad.

Matos303 2017-08-30T22:40:22.873

Don't use that wiki, it's outdated by many years.Pieter Wuille 2017-08-30T22:48:08.817

Thanks it is even mentioned on the wiki but I didn't see it, the new version has fundrawtransaction covered: https://bitcoin.org/en/developer-reference#fundrawtransaction

Matos303 2017-08-31T00:30:17.707