I have a set of
address values, each of them can contain a real Ethereum account (user account or contract) or a "virtual" address (an address pseudo-randomly generated by my contract, in fact first 160 bits of an NFT token ID).
I want virtual addresses to be distinguished from real accounts by being less than a certain
I generate a virtual address like this:
address next = address(truncate(keccak256(abi.encodePacked(previous))));
truncate() takes the lower N bits.
How to choose N for both:
- low probability that a real address will be less than
2**Nand mistook for a virtual address;
- low probability that two virtual addresses will clash.