Bitcoin Forum
September 23, 2018, 09:20:50 PM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: signrawtransaction offline with qt wallet  (Read 52 times)
ra213
Member
**
Offline Offline

Activity: 294
Merit: 10


View Profile WWW
January 03, 2018, 05: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?

   ⚡⚡ PRiVCY ⚡⚡   ▂▃▅▆█ ✅ PRiVCY (PRIV) is a new PoW/PoS revolutionary privacy project ● ☞ ✅ Best privacy crypto-market! ● █▆▅▃▂
    Own Your Privacy! ─────────────────║ WebsiteGithub  |  Bitcointalk  |  Twitter  |  Discord  |  Explorer ║─────────────────
   ✯✯✯✯✯                 ✈✈✈[Free Airdrop - Starts 9th June]✅[Tor]✈✈✈ ║───────────║ Wallet ➢ ✓ Windows  |  ✓ macOS  |  ✓ Linux
1537737650
Hero Member
*
Offline Offline

Posts: 1537737650

View Profile Personal Message (Offline)

Ignore
1537737650
Reply with quote  #2

1537737650
Report to moderator
1537737650
Hero Member
*
Offline Offline

Posts: 1537737650

View Profile Personal Message (Offline)

Ignore
1537737650
Reply with quote  #2

1537737650
Report to moderator
1537737650
Hero Member
*
Offline Offline

Posts: 1537737650

View Profile Personal Message (Offline)

Ignore
1537737650
Reply with quote  #2

1537737650
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1537737650
Hero Member
*
Offline Offline

Posts: 1537737650

View Profile Personal Message (Offline)

Ignore
1537737650
Reply with quote  #2

1537737650
Report to moderator
1537737650
Hero Member
*
Offline Offline

Posts: 1537737650

View Profile Personal Message (Offline)

Ignore
1537737650
Reply with quote  #2

1537737650
Report to moderator
HCP
Hero Member
*****
Offline Offline

Activity: 728
Merit: 923

<insert witty quote here>


View Profile
January 04, 2018, 02:21:18 AM
 #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"]'

DannyHamilton
Legendary
*
Offline Offline

Activity: 2198
Merit: 1373



View Profile
January 04, 2018, 03:04:21 AM
 #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.

ra213
Member
**
Offline Offline

Activity: 294
Merit: 10


View Profile WWW
January 04, 2018, 02:33:31 PM
 #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.

   ⚡⚡ PRiVCY ⚡⚡   ▂▃▅▆█ ✅ PRiVCY (PRIV) is a new PoW/PoS revolutionary privacy project ● ☞ ✅ Best privacy crypto-market! ● █▆▅▃▂
    Own Your Privacy! ─────────────────║ WebsiteGithub  |  Bitcointalk  |  Twitter  |  Discord  |  Explorer ║─────────────────
   ✯✯✯✯✯                 ✈✈✈[Free Airdrop - Starts 9th June]✅[Tor]✈✈✈ ║───────────║ Wallet ➢ ✓ Windows  |  ✓ macOS  |  ✓ Linux
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!