   #-----------------------------------
 
   submit_transaction : (cb) ->
-    #await @client.sendRawTransaction @out_tx.toHex(), defer err, @out_tx_id
-    console.log @out_tx.toHex()
+    err = null
+    await @client.sendRawTransaction @out_tx.toHex(), defer err, @out_tx_id
+    console.error "Raw transaction: " + @out_tx.toHex()
     cb err
 
   #-----------------------------------

  write_output : (cb) ->
    console.log JSON.stringify {
      @out_tx_id,
      @data_to_address,
      @change,
      @change_address,
      input_tx_id : @input_tx.txid


    fee = btcjs.networks.bitcoin.estimateFee(tx)
    @change = @input_tx.amount * SATOSHI_PER_BTC - num*@min_amount() - fee
    if @change < 0
      err = new Error "Cannot transfer a negative amount of change"
    else
      tx.outs[change_offset].value = @change
