I'm new to bitcoin programming and decided to give it a try with the release of bitcoinjs-lib 1.0. Here is how I generate the hex for the transaction

var bitcoin = require('bitcoinjs-lib');

var key = bitcoin.ECKey.fromWIF("cS4fb6sHrJ2VrfqRNBkk6eHMCB5PY6Bayyo695VaSdfZLMbPZiGv");
var tx = new bitcoin.Transaction();

tx.addInput("129aa78e5649715ecc7121aee0cdba06527061976be9c38c3a9fd9ae258665c3", 0);
tx.addOutput("msj42CCGruhRsFrGATiUuh25dtxYtnpbTx", 15000)

tx.sign(0, key)


and here is the hex output


I looked through the lib but couldn't find where to inject the bitcoin.networks.testnet object and the documentation is empty


Everything is fine with your tx.

Here it is: http://test.webbtc.com/tx/034dfa392aa7ea46bc0917cdaa2794a5f03e6f935b6518a103cb0f5e923a05be

I've pushed it to the network with this form: http://test.webbtc.com/relay_tx

  • weird I used tbtc.blockr.io/tx/push and got an error when trying to push, i'll use webbtc.com instead thanks ! – JohnT Jul 3 '14 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.