I ended up solving this by wiring up a utxo provider that's populated from 
a different "online/hot" application. This allowed me to use 
Wallet#completeTx without throwing an insufficient funds exception and 
still meet my requirements.

On Saturday, May 19, 2018 at 3:31:42 PM UTC-4, Tyga wrote:
>
> i am also working on the same thing signing offline transaction and 
> broadcast it using watching wallet but i am having trouble in broadcasting 
> it my method is differ from yours and i am using Java, here is my code 
> snippet
> *Creating tx hash from Watching Wallet*
>
> private static void createUnsignedTx()
> {
>     try
>     {
>
>         sendRequest = SendRequest.to(Address.fromBase58(params, 
> "mzA8jspyG5gjpZG8bvJWEatv3TAUTxJA8F"), Coin.parseCoin("0.01"));
>         sendRequest.signInputs = false;
>         sendRequest.tx.getInputs();
>         System.out.println("Transaction Hash: " + 
> sendRequest.tx.getHashAsString());
>     }
>     catch (Exception e)
>     {
>         System.err.println(e.toString());
>     }
> }
>
> *Signing hash from Offline wallet*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *public static void signTransaction(){    // message (hash) to be signed 
> with private key    //String msg = 
> "15953935a135031bfec37d36a9d662aea43e1deb0ea463d6932ac6e537cb3e81";    
> String msg = 
> "d2553a4da83207a0b2959c6a6be9f3b5a298dcbc095d64b887030b4765f6c361"; // 
> unsign tx hash from watching wallet    // an example of WiF for private key 
> (taken from 'Mastering Bitcoin')    //String wif 
> ="KxFC1jmwwCoACiCAWZ3eXa96mBM6tb3TYzGmf6YwgdGWZgawvrtJ";    ECKey ecKey = 
> new ECKey();    String wif = ecKey.getPrivateKeyAsWiF(params);    // 
> creating a key object from WiF    DumpedPrivateKey dpk = 
> DumpedPrivateKey.fromBase58(null, wif);    ECKey key = dpk.getKey();    // 
> checking our key object        String check = 
> key.getPrivateKeyAsWiF(params);    System.out.println(wif.equals(check)); 
>  // true    // creating Sha object from string    Sha256Hash hash = 
> Sha256Hash.wrap(msg);    // creating signature    ECKey.ECDSASignature sig 
> = key.sign(hash);    // encoding    byte[] res = sig.encodeToDER();    // 
> converting to hex    String hex = DatatypeConverter.printHexBinary(res);    
> System.out.println("Signed Hash: " + hex);    } }*After that i don't know 
> how to broadcast it and i don't know either that i am on the right track ?
>
>

-- 
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