Author

Topic: signrawtransaction offline with qt wallet (Read 212 times)

member
Activity: 294
Merit: 10
January 04, 2018, 09:33:31 AM
#4
Yes, you are missing the "prevtxs".... you need to provide all the input information to signrawtransaction as well as createrawtransaction.

something like this:
Code:
signrawtransaction "UNSIGNED_TRANSACTION_HEX_FROM_CREATERAWTRANSACTION" '[{"txid": "11307beeced6797a9d84c9d2431f013dab2a1f5449e9459208fbd156dfb6e9b4", "vout": 1, "scriptPubKey": "SCRIPT_PUB_KEY_FOR_TRANSACTION", "amount": "AMOUNT_OF_ORIGINAL_INPUT"}]' '["PRIVATE_KEY"]'

Thank you, this worked.
legendary
Activity: 3472
Merit: 4801
January 03, 2018, 10:04:21 PM
#3
you need to provide all the input information to signrawtransaction as well as createrawtransaction.

Or, you can copy the entire blockchain data directory from the online computer to the offline computer so that it can look up the  inputs itself in the blockchain.

It can't sign without knowing what the inputs are.  Your choices are to either provide the blockchain so they can be looked up, or provide the inputs as parameters to the signrawtransaction.
HCP
legendary
Activity: 2086
Merit: 4361
January 03, 2018, 09:21:18 PM
#2
Yes, you are missing the "prevtxs".... you need to provide all the input information to signrawtransaction as well as createrawtransaction.

something like this:
Code:
signrawtransaction "UNSIGNED_TRANSACTION_HEX_FROM_CREATERAWTRANSACTION" '[{"txid": "11307beeced6797a9d84c9d2431f013dab2a1f5449e9459208fbd156dfb6e9b4", "vout": 1, "scriptPubKey": "SCRIPT_PUB_KEY_FOR_TRANSACTION", "amount": "AMOUNT_OF_ORIGINAL_INPUT"}]' '["PRIVATE_KEY"]'
member
Activity: 294
Merit: 10
January 03, 2018, 12:11:45 PM
#1
I would like to sign my transaction on an offline computer with bitcoin core. I already created the raw transaction (testnet) on an online computer with
Code:
createrawtransaction "[{\"txid\":\"11307beeced6797a9d84c9d2431f013dab2a1f5449e9459208fbd156dfb6e9b4\",\"vout\":0}]" "{\"mfeUWfwmuMPoLuANMFPHQhJ1YFYVtWnaqT\":0.01}"

Output
Quote
0200000001b4e9b6df56d1fb089245e949541f2aab3d011f43d2c9849d7a79d6ceee7b301100000 00000ffffffff0140420f00000000001976a914016c22d6025803eec522e04161e0cdf9d813d410 88ac00000000


The next step would be to sign the transaction on an offline computer, therefor I tried to execute this code
Code:
signrawtransaction "0200000001b4e9b6df56d1fb089245e949541f2aab3d011f43d2c9849d7a79d6ceee7b30110000000000ffffffff0140420f00000000001976a914016c22d6025803eec522e04161e0cdf9d813d41088ac00000000"

Unfortunately I get this error
Quote
{
  "hex": "0200000001b4e9b6df56d1fb089245e949541f2aab3d011f43d2c9849d7a79d6ceee7b301100000 00000ffffffff0140420f00000000001976a914016c22d6025803eec522e04161e0cdf9d813d410 88ac00000000",
  "complete": false,
  "errors": [
    {
      "txid": "11307beeced6797a9d84c9d2431f013dab2a1f5449e9459208fbd156dfb6e9b4",
      "vout": 0,
      "witness": [
      ],
      "scriptSig": "",
      "sequence": 4294967295,
      "error": "Input not found or already spent"
    }
  ]
}

"Input not found or already spent" - I thought I need only to provide the transaction id when I create the transaction.

This is the help output from the console.

Quote
Arguments:
1. "hexstring"     (string, required) The transaction hex string
2. "prevtxs"       (string, optional) An json array of previous dependent transaction outputs
     [               (json array of json objects, or 'null' if none provided)
       {
         "txid":"id",             (string, required) The transaction id
         "vout":n,                  (numeric, required) The output number
         "scriptPubKey": "hex",   (string, required) script key
         "redeemScript": "hex",   (string, required for P2SH or P2WSH) redeem script
         "amount": value            (numeric, required) The amount spent
       }
       ,...
    ]
3. "privkeys"     (string, optional) A json array of base58-encoded private keys for signing
    [                  (json array of strings, or 'null' if none provided)
      "privatekey"   (string) private key in base58-encoding
      ,...
    ]
4. "sighashtype"     (string, optional, default=ALL) The signature hash type. Must be one of
       "ALL"
       "NONE"
       "SINGLE"
       "ALL|ANYONECANPAY"
       "NONE|ANYONECANPAY"
       "SINGLE|ANYONECANPAY"

Do I have to provide additional parameters?
Jump to: