<p>Check out <a href="https://github.com/ValleZ/Paper-Wallet" rel="nofollow noreferrer">https://github.com/ValleZ/Paper-Wallet</a> - it is android lite project what does this task. Start with createTransaction method in <a href="https://github.com/ValleZ/Paper-Wallet/blob/master/app/src/main/java/ru/valle/btc/BTCUtils.java" rel="nofollow noreferrer">https://github.com/ValleZ/Paper-Wallet/blob/master/app/src/main/java/ru/valle/btc/BTCUtils.java</a></p>

CC BY-SA 3.0
2013-07-28T20:05:33.187Z
2017-07-16T21:43:34.573Z
2017-07-16T21:43:34.573Z
user2112961
<p>Mike Hearn's WalletTool (included in the bitcoinj library) is a pretty good starting point.</p>

<p>If you have a look at the 'send' method in WalletTool you can see that it:</p>

<p>1) Creates a SendRequest</p>

<p>2) Decrypts the private key if necessary</p>

<p>3) Completes the tx to get the inputs and find the fee</p>

<p>4) Signs the tx</p>

<p>5) Starts up a PeerGroup</p>

<p>6) Broadcasts it</p>

<p>For an offline transaction you can do 1 to 4, serialize the tx and then call the blockchain pushtx.</p>

<p>There is a method on Transaction called bitcoinSerialize to convert it to the bytes that need transmitting. I think you just have to convert the bytes to hex for the blockchain pushtx but you would have to try it out.</p>

CC BY-SA 3.0
2013-06-30T16:49:48.653Z
2013-06-30T16:49:48.653Z
jim618
<p>Blockchain.info has a <a href="http://blockchain.info/pushtx" rel="noreferrer">PushTX API</a>.</p>

<p>How do I create &amp; sign a raw transaction in Java for use in this API?
Should I use bitcoinj?</p>

<p>Are there any code samples?</p>

<transactions><bitcoinj><java>
How do I create an offline transaction in java to broadcast via blockchain.info?
ripper234
# How do I create an offline transaction in java to broadcast via blockchain.info?

(Asked by: username_0 on 2013-02-16)

Blockchain.info has a [PushTX API](http://blockchain.info/pushtx).

How do I create & sign a raw transaction in Java for use in this API?
Should I use bitcoinj?

Are there any code samples?

**Tags:** transactions, bitcoinj, java


---

## 2 answers

### Answer by username_2 on 2013-06-30. Score: 5 | Accepted answer

Mike Hearn's WalletTool (included in the bitcoinj library) is a pretty good starting point.

If you have a look at the 'send' method in WalletTool you can see that it:

1) Creates a SendRequest

2) Decrypts the private key if necessary

3) Completes the tx to get the inputs and find the fee

4) Signs the tx

5) Starts up a PeerGroup

6) Broadcasts it

For an offline transaction you can do 1 to 4, serialize the tx and then call the blockchain pushtx.

There is a method on Transaction called bitcoinSerialize to convert it to the bytes that need transmitting. I think you just have to convert the bytes to hex for the blockchain pushtx but you would have to try it out.


---

### Answer by username_1 on 2013-07-28. Score: 5

Check out <https://github.com/ValleZ/Paper-Wallet> - it is android lite project what does this task. Start with createTransaction method in <https://github.com/ValleZ/Paper-Wallet/blob/master/app/src/main/java/ru/valle/btc/BTCUtils.java>


---

