Author

Topic: BTC Core offline wallet to Elecrum Watching Only Problem (Read 345 times)

HCP
legendary
Activity: 2086
Merit: 4361
As per the "signrawtransaction" documentation... you need to provide the appropriate input information if it is not contained within your wallet file. Your offline version of Bitcoin Core has no record of the transactions that create the UTXOs that you are trying to spend as it does not have the blocks. So you provide them when you execute the "signrawtransaction" command... this is so your offline wallet knows which private key it needs to be using to sign the transaction, as per the signdemo.txt:

https://people.xiph.org/~greg/signdemo.txt
and
https://bitcoin.org/en/developer-examples#offline-signing

The top sections in signdemo.txt show how to get the txid(s), vout(s) and scriptPubKey(s) that you need. Basically, use "getrawtransaction" on your ONLINE machine with the txid for the transaction(s) that generated the UTXOs that you're spending. You'll get something like:

Quote
[online]$ bitcoind getrawtransaction a9d4599e15b53f3eb531608ddb31f48c695c3d0b3538a6bda871e8b34f2f430c 1
{
    "hex" : "0100000001344630cbff61fbc362f7e1ff2f11a344c29326e4ee96e787dc0d4e5cc02fd06900000 0004a493046022100ef89701f460e8660c80808a162bbf2d676f40a331a243592c36d6bd1f81d6b df022100d29c072f1b18e59caba6e1f0b8cadeb373fd33a25feded746832ec179880c23901fffff fff0100f2052a010000001976a914dd40dedd8f7e37466624c4dacc6362d8e7be23dd88ac000000 00",
    "txid" : "a9d4599e15b53f3eb531608ddb31f48c695c3d0b3538a6bda871e8b34f2f430c",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "69d02fc05c4e0ddc87e796eee42693c244a3112fffe1f762c3fb61ffcb304634",
            "vout" : 0,
            "scriptSig" : {
                "asm" : "3046022100ef89701f460e8660c80808a162bbf2d676f40a331a243592c36d6bd1f81d6bdf02210 0d29c072f1b18e59caba6e1f0b8cadeb373fd33a25feded746832ec179880c23901",
                "hex" : "493046022100ef89701f460e8660c80808a162bbf2d676f40a331a243592c36d6bd1f81d6bdf022 100d29c072f1b18e59caba6e1f0b8cadeb373fd33a25feded746832ec179880c23901"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 50.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 dd40dedd8f7e37466624c4dacc6362d8e7be23dd OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a914dd40dedd8f7e37466624c4dacc6362d8e7be23dd88ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "n1gqLjZbRH1biT5o4qiVMiNig8wcCPQeB9"
                ]
            }
        }
    ]
}

Note the TXID, the "n" value and the "ScriptPubKey" hex value for the VOUT that you are spending in your new transaction. In this example we have:
txid: a9d4599e15b53f3eb531608ddb31f48c695c3d0b3538a6bda871e8b34f2f430c
vout: 0
scriptpubkey: 76a914dd40dedd8f7e37466624c4dacc6362d8e7be23dd88ac

Then you give these values as parameters on the OFFLINE machine when you use the "signrawtransaction" command:
If we're happy, we'll sign. We need to provide the scriptpubkey of the
inputs we're signing so our offline wallet knows which of its keys
to use.

[offline]$ bitcoind signrawtransaction 01000000010c432f4fb3e871a8bda638350b3d5c698cf431db8d6031b53e3fb5159e59d4a900000 00000ffffffff0100f2052a010000001976a9143744841e13b90b4aca16fe793a7f88da3a23cc71 88ac00000000 '[{"txid":"a9d4599e15b53f3eb531608ddb31f48c695c3d0b3538a6bda871e8b34f2f430c","vout":0,"scriptPubKey":"76a914dd40dedd8f7e37466624c4dacc6362d8e7be23dd88ac"}]'
{
    "hex" : "01000000010c432f4fb3e871a8bda638350b3d5c698cf431db8d6031b53e3fb5159e59d4a900000 0006b48304502201123d735229382f75496e84ae5831871796ef78726805adc2c6edd36d23e7210 022100faceab822a4943309c4b6b61240ae3a9e18ed90a75117c5dc4bfd8f7e17a21d301210367c e0a1c3b3e84cece6dad1a181d989d8e490b84f5431a1f778a88b284c935e6ffffffff0100f2052a 010000001976a9143744841e13b90b4aca16fe793a7f88da3a23cc7188ac00000000",
    "complete" : true
}


Be careful with the "'s and {'s and ['s etc Wink  Also, you will probably need to unlock your offline wallet first using "walletpassphrase" command before you can use the "signrawtransaction" command.

It *might* also be possible to copy your blocks folder from your online machine to your offline machine (if the offline machine has sufficient storage space)... and allow the offline machine to reindex those blocks which will bring your offline machine up to date with all the inputs etc... but I've never tried that, so I'm not sure if it will work or if it is advisable from a security point of view.

newbie
Activity: 50
Merit: 0
Hi again Smiley
I tried this (-zapwallettxes) and got the same error "no inputs found or already spent"

If anyone has any ideas to try please share.
newbie
Activity: 50
Merit: 0
Thanks for the tip, I am about to give this a try!

QQ: If I go ahead and remove those unconfirmed transactions, which is the whole balance of the wallet, how will the offline wallet be able to verify anything afterwards? It couldn't find the inputs on the previous attempt to sign, so it's counter intuitive to me, to remove the limited data I do have (the unconfirmed transactions) would that force the offline wallet to use the inputs from the raw transaction? If that's the idea I'll give it a try.

Thanks again for the help and the lead to the documentation which is helpful but very technical! Smiley

HCP
legendary
Activity: 2086
Merit: 4361
I highly recommend you take a backup of your offline wallet.dat first... once you have it safely backed up, you might want to try using the -zapwallettxes command to remove all the unconfirmed transactions from your offline wallet.

Also, I believe that when you are trying to use Bitcoin Core as offline signer, you may need to give it the appropriate inputs so it can validate that they exist and use the appropriate keys... check the documentation for "signrawtransaction"...
newbie
Activity: 50
Merit: 0
I didn't explain that very well! to simplify

1 I had a Bitcoin core wallet stored offline on a USB
2 I didn't want to expose this to the web, so imported it to an air gapped machine.
3 The balances show in this wallet, but they are unconfirmed as this machine does not have the blockchain
3 I have set up an Elctrum offline wallet on this air gapped machine
4 I have set up an Electrum watching only wallet on an online machine
5 I have checked blockchain info and all the inputs and balance is showing for my receive address
6 I go to coinb.in and create a new transaction
7 coinb.in sees the correct balance and inputs
8 Raw transaction is created and taken to air gapped machine to sign with BTcore
9 Bt core gives the error "no inputs found or already spent" when I try to sign it in the debug window.

I think that explains it much better than my previous post!

Grateful for any suggestions!
newbie
Activity: 50
Merit: 0
I'm trying to create a transaction using an on line wallet service to get btc out of my offline BC Core install. Im Creating the raw transaction on line and signing it offline.

I have unconfirmed inputs/balance showing in my offline Core. The transactions I received were never confirmed.

Is this the reason why my raw transaction that I create in an on line wallet fails when I run it through the debug window?
The message I get is "no inputs found or already spent"? I suspect its because those inputs are unconfirmed as this wallet has not been on line since it received the payment some time ago. How can i fix this and get my Core install to recognise the inputs it has inside?

I have core on another machine with the full block chain downloaded, could that be used to confirm these inputs to my offline wallet so that it can find them in order to sign my raw transaction? I know the inputs are there as I checked the address and the on line wallet found them no problem.
Or perhaps the on line wallet can create some kind of transaction to verify the inputs in the offline wallet?

How does the offline wallets balance and transaction history get updated?

Thanks for helping Smiley
Jump to: