Bitcoin Forum
May 07, 2024, 08:38:19 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: signrawtransaction offline with qt wallet  (Read 186 times)
ra213 (OP)
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
1715071099
Hero Member
*
Offline Offline

Posts: 1715071099

View Profile Personal Message (Offline)

Ignore
1715071099
Reply with quote  #2

1715071099
Report to moderator
1715071099
Hero Member
*
Offline Offline

Posts: 1715071099

View Profile Personal Message (Offline)

Ignore
1715071099
Reply with quote  #2

1715071099
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, which will follow the rules of the network no matter what miners do. Even if every miner decided to create 1000 bitcoins per block, full nodes would stick to the rules and reject those blocks.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715071099
Hero Member
*
Offline Offline

Posts: 1715071099

View Profile Personal Message (Offline)

Ignore
1715071099
Reply with quote  #2

1715071099
Report to moderator
1715071099
Hero Member
*
Offline Offline

Posts: 1715071099

View Profile Personal Message (Offline)

Ignore
1715071099
Reply with quote  #2

1715071099
Report to moderator
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4316

<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"]'

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4623



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 (OP)
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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!