i am working on watching wallet and Offline wallet using bitcoinj 
i am receiving payment on watching wallet *Fine*
now i want to spend coins from watching wallet
what i am doing is creating rawTx from Watching Wallet then sign it with 
private key from Offline Wallet
but when i broadcast it, its throw an exception InsufficientMoneyException.
my wallet balance is 6.001 BTC 
My code snippet is 

*For creating Raw Transaction from Watching Wallet*
























*private static void bla(){    Coin coin = Coin.parseCoin("0.01");    
Address address = Address.fromBase58(params, 
"n4oLPFUGvohSdDxvJS3amXvfE1GEdZBddd");    Transaction tx = new 
Transaction(params);    System.out.println("Raw TX: " + tx.toString());    
byte[] bytes = 
Script.createInputScript("5ff01d61e67c706cb79653aa1e7ad2c7254b841167e0a34055504c35c7240469".getBytes());
 
// tx hash     TransactionInput input = new TransactionInput(params, null, 
bytes);    //Creates a scriptPubKey that encodes payment to the given 
address.    Script scriptPubKey = 
ScriptBuilder.createOutputScript(address);    // Signature Script    Script 
scriptSig = input.getScriptSig();    // Adding output that involves Amount 
and Script    tx.addOutput(coin, scriptPubKey);    
System.out.println("Script pub key: " + scriptPubKey);    //Adding input to 
the raw transaction    tx.addInput(Sha256Hash.wrap(tx.getHashAsString()), 
0, scriptSig);    System.out.println("After adding inputs: " + 
tx.toString());}*

*Signing Transaction from Offline Wallet Using Private Key*










*Enter code here...private static String signTx(){    // TX Hash from 
Watching wallet    String unSignHash = 
"f348ceadcb66e811799aa543107b63b9c92afebda5bc47d11222ba218df6638f";    // 
Signing Hash with private key    System.out.println("Signed Hash from prv 
key: " + 
DatatypeConverter.printHexBinary(prvKey().sign(Sha256Hash.wrap(unSignHash)).encodeToDER()));}Now
 
i don't know how to broadcast it what i am doing for broadcastin is *










*try {    kit.wallet().sendCoins(SendRequest.forTx(tx));} catch 
(InsufficientMoneyException e){    System.err.println("Exception: " + 
e.toString());}*
*i am clearly doing something wrong here, i am stuck in this for days *

*any idea what i am doing wrong in here and how can i make this happen ?*

-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to