It's known issue. Bitcoinj is designed around the assumption of approx.
one wallet per device (or at least only a low number). The "webwallet"
usecase has always been excluded.
On 11/13/2017 06:32 PM, Ajit Soman wrote:
> I have a java web application. When ever a user signup i create a wallet
> for them. I use the below code to create wallet for user and put that
> wallet object in Map<String,Wallet>.
>
> |
> /**
> * This is the global map that maintain wallet across application. When ever
> * i have to get balance or make transaction i use wallet object in the map.
> *
> * The main reason for doing this is that Wallet object in map will always
> * be in synchronization with the blockchain
> */
> Map<String,Wallet>applicationWalletMap =newHashMap<String,Wallet>();
>
>
> publicvoidcreateWalletForUser()throwsIOException{
> intbits =128;
> SecureRandomrandom =newSecureRandom();
> DeterministicKeyChaindeterminstickeychain
> =newDeterministicKeyChain(random,bits);
> DeterministicSeedseed =determinstickeychain.getSeed();
> System.out.println("seed "+seed.getSeedBytes());
> Walletwallet =Wallet.fromSeed(TestNet3Params.get(),seed);
> ECKeyeckey =newECKey();
> wallet.importKey(eckey);
> StringfileName =UUID.randomUUID().toString();
> wallet.saveToFile(newFile("/opt/"+fileName+".dat"));
> System.out.println("Wallet has been created");
> applicationWalletMap.put(fileName,wallet);
> }
> |
>
>
>
> Also I put all user's synchronized wallet object in
> *applicationWalletMap *when i start web application.
>
> The issue is that when user keep on increasing the size
> of *applicationWalletMap *increases. *This consumes a lot of RAM*. So is
> there is any efficient way to handle this problem.
>
> Thanks in advance
>
> --
> 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.