I'm building an app where every user will have app-generated ETH Wallet to do transactions with internal ERC20 Tokens.

I would like to pre-generate wallets for my users, and assign every wallet upon signup to users.

How can I automatically create let's say 100,000 ETH accounts, and keep the information on my database (address, keys, etc)

Thanks, any advice would be appreciated!

1 Answer 1


On first look, this is an anti-pattern.

In summary, it looks like confusing authentication with privilege and internal organization. The pattern goes against the natural organization of the platform and will likely lead to non-trivial difficulties.

The natural way.

You will presumably need authentication and access control. The good news is that all users are authenticated and you can reliably know the address they used to sign a transaction.

You can use that as the basis for identifying users and controlling access to sensitive functions. E.g. some accounts, like the account your server is using, get special privileges.


Balances of all (100,000+) users that will ever exist:

mapping(address => uint) userBalances;

Access control:

require(msg.sender == ownerAddress, "You are not the owner.");

Under no circumstances would you ever divulge the server's signing key or ask the users to do that.

The unnatural way.

  1. Create 100,000 accounts and signing keys with a script.
  2. Create data on the chain for 100,000 accounts (at your expense).
  3. Server switches personnas for each transaction.
  4. Contract is unaware and does not disclose the server's special status.


It's better form and more transparent to favor:

  • from: Server, transaction concerning a certain user and other arguments


  • from: User (actually the server signing but this fact is significantly obfuscated)

To say it another way, there is no improvement over a fully centralized process when the server has signing keys for each user.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.