Sending coins without a wallet isn't really supported. You need to import the key as you suggest, then you need to rescan the blockchain for any payments to the key. After the scan the balance should be up to date and you should be able to send any coins on the key.
On 12/25/2016 04:41 AM, Joseph wrote: > Work on SPV mode. > > Q1: How to get balance when I import a new private key which have some btc? > > Wallet wallet = new Wallet(params); > wallet.importKey(newKeys); > > wallet.getBalance(); // always 0 btc > > Q2: How to send btc without wallet? > I have a private key whiche have some btc, and how to create > a transaction and broadcast? > > -- > 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] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout. -- 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.
