When creating tron wallet account some random private key and wallet key is created. Should I check the balance before using it?
Is there any chance that this address is being used by someone? Should I check the balance before using it? Is that the right way to generate tron wallet address?
You’re asking multiple questions in one, I’ll give my best to answer them each.
when creating tron wallet account some random private key and wallet key is created. should i check the balance before using it?
No, it’s usually not required to do that. Unless you’re hyper paranoid about generating the same private key as someone else, which isn’t impossible, and it has happened before¹ but a good random key will in practice never be generated twice.
It’s advisable to create private keys with dedicated hardware though, as dedicated hardware greatly improves the quality of the random numbers used to create the private key from.
i have created tron wallet address using this code or that one or the official one which works offline without calling any API from the node to verify the address or register it.
Only the first link appears to create a random key, the other two only seem to convert an already created private key into a different format, or do some other operation on it.
You should (as a good developer) ALWAYS check EXACTLY how the private key is generated IF you’re using a solution from someone else.
Since you’re asking these questions here, I highly doubt you understand the mechanism behind cryptographic wallets and how they’re created.
I advise you to first understand how the underlying math works or get someone else who does.
Private keys can be seen as one of the most valuable type of data these days, you don’t want to mess with them lightly.
¹ well, not by accident. It was a targeted attack to a software wallet using an insecure random number generator. I don’t know the source of that information though. It was related to Bitcoin.