BitCoinJ custom transaction I'm trying to learn a few things about the API. I've managed to send coins on testnet via wallet.sendCoins(Peergroup,Address,BigInteger) so I don't think I have a network problem.

Here's what I'm trying to do, assume my wallet has the transaction, a Peergroup already exists and is connected, and the blockstores and such exist:

    Transaction tin = wallet.getTransaction(
            new Sha256Hash("015a7cff7048b622315fe610e9e72347420a5528b938bffc931ddacf24b9ce88"));

    System.out.println("Input transaction: " + tin.toString());

    Transaction t = new Transaction(nwp);

    t.addOutput(Utils.toNanoCoins(4, 10), new Address(nwp, "mmhmMNfBiZZ37g1tgg2t8DDbNoEdqKVxAL"));
    t.addOutput(Utils.toNanoCoins(4, 0), new Address(nwp, "mrtUDRNFuwVPrKgwaGLuc3VvRCVYbayLkC"));

    t.addInput(tin.getOutput(0));
    p.broadcastTransaction(t);


As you can see, the transaction is trying to spend a specific previous transaction of 8.10 incoming by sending 4.10 back to the faucet and 4 back as change.

Unfortunately it doesn't propagate on the network. What do I need to do? I've been trying to follow the code in Wallet.java, but it's pretty complicated. From what I can see it's some checks on the amounts, coin selection, and locks on the coins to be used. Attempts to sign the transaction cause a warning (already signed) and a crash.

Can someone let me know what the minimum necessary steps for creating and sending this transaction are?
Right, figured it out. It's a matter of picking the correct output from the previous transaction and running signInputs. After that it works.