I am creating utility token on top of NEM Mosaics much like loyalty tokens , for this I am creating android application which interacts with NEM blockchain. One thing in which I am confused in is Should I create wallet for each user who signups ? What approach should I take ?
Having applications is completely plausible. You can create private key wallets and use the private keys to sign a push transactions. This can all be kept under the hood and allows you to overlay more features specific to your app. Just be careful that you keep the private keys secure and that your users know that the wallet that you create is manipulatable by a central entity (you) and it’s not their “own” wallet. You’ll also need to have an amount of XEM in each account to be able to send mosaics as well. It really just depends on what you want to do.
Hope this helps
Hey @Daniel thanks for reply . So I would create a custom wallet for my tokens just like LoyalWallet ?
If you have any example to share regarding custom wallet please let me know. It will help me to setup a benchmark
I’m sure you’ve seen but I’ll drop the link to the NEM-sdk here first, as everything I’ve used comes from there.
I’ve never seen the LoyalWallet so I can’t really say how much this method is similar. So you’ll notice there are functions for generating private keys. You’ll first create a private key and then use that private key to generate a wallet. And that’s basically all there is to do it. From that wallet you can access NEM blockchain to receive and send mosaics and so forth.
// Create random bytes from PRNG
var rBytes = nem.crypto.nacl.randomBytes(32);
// Convert the random bytes to hex
var privateKey = nem.utils.convert.ua2hex(rBytes);
// Set a wallet name
var walletName = "QuantumMechanicsImported";
// Set a password
var password = "Something";
// Set private key
var privateKey = "Private key to import";
// Create a private key wallet
var wallet = nem.model.wallet.importPrivateKey(walletName, password, privateKey, nem.model.network.data.testnet.id);
Be sure to check out the examples for sending mosaics I’m sure they’ll help you out
Hey Daniel Thanks a lot Just one more question . I have to create wallet for each user because to send XEM or NEM compatible token from one user to another I should have NEM compatible address which will be generated by creating wallet. Right ? Sorry for continuously bugging you
Yep, I think you’ve got it.