<p>With java? Sign it with the program that created the raw transaction, bitcoin-cli.</p>
<p>With signrawtransactionwithwallet.</p>
<p>Or with signrawtransactionwithkey (0.17.0 RPC)</p>
<p>signrawtransactionwithkey &quot;hexstring&quot; [&quot;privatekey1&quot;,...] ( [{&quot;txid&quot;:&quot;id&quot;,&quot;vout&quot;:n,&quot;scriptPubKey&quot;:&quot;hex&quot;,&quot;redeemScript&quot;:&quot;hex&quot;,&quot;amount&quot;:value},...]</p>
<p>take txid,vout,scriptPubKey from an online explorer, live.blockcypher.com</p>
<p>redeemScript should be blank.</p>
<p>&quot;raw transaction&quot; &quot;[&quot;priv key&quot;]&quot; &quot;[{&quot;txid&quot;:&quot;the taxid&quot;,&quot;vout&quot;:the vout integer,&quot;scriptPubKey&quot;:&quot;from the explorer&quot;,&quot;redeemScript&quot;:&quot;&quot;,&quot;amount&quot;:the amount}]&quot;</p>
<p>after sign, if want to call sendrawtransaction, if the tx id is not synced will be &quot;Missing Inputs&quot;(in dogecoin-1.10.0 executed) ; or if wallet is offline or if started with -noconnect, then broadcast the transaction online like here <a href="https://live.blockcypher.com/btc/pushtx/" rel="nofollow noreferrer">https://live.blockcypher.com/btc/pushtx/</a></p>
<p>More info to deal with a -noconnect and no synced data situation: <a href="https://bitcoin.stackexchange.com/questions/89962/how-to-send-bitcoin-from-an-offline-bitcoin-core-that-doesnt-have-a-synced-bala/101433#101433">How to send bitcoin from an offline Bitcoin Core that doesn&#39;t have a synced balance?</a></p>

CC BY-SA 4.0
2019-02-28T15:03:47.250Z
Very Thanks for your answer. This is Good. I had to do this at offline, So I thought I should do it using some programming which I'd have to made. But your way is very good and works.
paul You
CC BY-SA 4.0
2019-02-28T13:34:31.120Z
2021-01-15T13:13:55.147Z
2021-01-15T13:13:55.147Z
Sam
<p>How to sign raw transaction with private key.
this is my raw transaction :</p>

<p><code>0200000001fcd54594bba82795afa84ebf500b3944546117c9371e951fc4539e7455ebafb20000000000ffffffff01b8f902000000000017a914b4e6b1471691d9e9e54cd19d39c8565bcadeb3338700000000</code></p>

<p>which is made by bitcoin-cli createrawtransaction .</p>

<p>That raw transaction made in server.</p>

<p>And I want to sign this raw transaction in my local PC.
How do I sign that with private key?</p>

<p>Please let me know with the sample code.
My language is java. </p>

<p>Very Thank you.</p>

<raw-transaction><java>
How to sign rawtransaction with private key
paul You
# How to sign rawtransaction with private key

(Asked by: username_0 on 2019-02-27)

How to sign raw transaction with private key.
this is my raw transaction :

`0200000001fcd54594bba82795afa84ebf500b3944546117c9371e951fc4539e7455ebafb20000000000ffffffff01b8f902000000000017a914b4e6b1471691d9e9e54cd19d39c8565bcadeb3338700000000`

which is made by bitcoin-cli createrawtransaction .

That raw transaction made in server.

And I want to sign this raw transaction in my local PC.
How do I sign that with private key?

Please let me know with the sample code.
My language is java.

Very Thank you.

**Tags:** raw-transaction, java


---

## 1 answers

### Answer by username_1 on 2019-02-28. Score: 1 | Accepted answer

With java? Sign it with the program that created the raw transaction, bitcoin-cli.

With signrawtransactionwithwallet.

Or with signrawtransactionwithkey (0.17.0 RPC)

signrawtransactionwithkey "hexstring" ["privatekey1",...] ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex","amount":value},...]

take txid,vout,scriptPubKey from an online explorer, live.blockcypher.com

redeemScript should be blank.

"raw transaction" "["priv key"]" "[{"txid":"the taxid","vout":the vout integer,"scriptPubKey":"from the explorer","redeemScript":"","amount":the amount}]"

after sign, if want to call sendrawtransaction, if the tx id is not synced will be "Missing Inputs"(in dogecoin-1.10.0 executed) ; or if wallet is offline or if started with -noconnect, then broadcast the transaction online like here <https://live.blockcypher.com/btc/pushtx/>

More info to deal with a -noconnect and no synced data situation: [How to send bitcoin from an offline Bitcoin Core that doesn't have a synced balance?](https://bitcoin.stackexchange.com/questions/89962/how-to-send-bitcoin-from-an-offline-bitcoin-core-that-doesnt-have-a-synced-bala/101433#101433)

> **Comments:**
> **username_0**: Very Thanks for your answer. This is Good. I had to do this at offline, So I thought I should do it using some programming which I'd have to made. But your way is very good and works.  

---

