What do you mean by not in your wallet? I think you need the UTXO in some 
way. But it doesn't have to be contained in a wallet. When you have 
information about a transaction that pays to your bitcoin address you can 
construct a transaction using this UTXO without a wallet by construction 
the transaction yourself.
Let's say you have a list of transaction outputs that pay to your address 
and are not already spent:

List<TransactionOutput> outputsToMyAddr = something(); // where ever you 
got these from

Transaction myOwnConstructedTx = new 
Transaction(myconf.getNetworkParameters());

myOwnConstructedTx.addInput(outputsToMyAddr.get(0));

KeyBag keys = getSomeKeyChainGroup(); // or a wallet, or something else 
with keys that can sign the used UTXO

TransactionInput input = myOwnConstructedTx.getInput(0);
Script scriptPubKey = 
myOwnConstructedTx.getInput(0).getConnectedOutput().getScriptPubKey();
RedeemData redeemData = txIn.getConnectedRedeemData(keys);
input.setScriptSig(scriptPubKey.createEmptyInputScript(redeemData.keys.get(0), 
redeemData.redeemScript));
TransactionSigner.ProposedTransaction proposal = new 
TransactionSigner.ProposedTransaction(tx);
new LocalTransactionSigner().signInputs(proposal, keys);

PeerGroup peerGroup = getAPeerGroup();
peerGroup.broadcastTransaction(tx);

I think something like that should do it.

Am Montag, 12. Dezember 2016 08:33:31 UTC+1 schrieb liuwh:
>
> is it possible send transaction from one bitcoin address (not in wallet) 
> to another address by bitcoinj?
> I have read some bitcoinj sample about send transaction in bitcoinj, 
> almost all of them are realized by Wallet, UTXO's are  in wallet.
>

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