We’re rewarding the question askers & reputations are being recalculated! Read more.
3

The pattern you are using is valid for certain table-like sets, but you should be aware of the limitations. It is ill-advised to do anything with a contract that loops - Getting Loopy with Solidity. You can, however, make it possible for a client to loop. It should be understood that "client" is an off-chain entity, in this context, because if it wasn't ...


3

Trust me. Everytime (everytime!) you are thinking to loop trough a dataset whose dimensions you cannot predict at the “start of the time“ in a blockchain based system, you are using blockchain for the wrong thing and/or your algorithm must be changed by rethinking it. Your model should be something where if a new “user” is added, the simply operation to add ...


2

I input the string "Cow", to a function in the smart contract. Next, I should be able to create a parent token which represents the string, and each child token should have a numerical ID within the range 1-50. A contract factory could serve as both an ERC721 deployer and a registry (inventory) of the deployed tokens. ERC721, itself takes care of ...


2

I haven't studied this in-depth but I see a clear problem outside of the mutex. This is not random. function random() private view returns(uint){ uint source = block.difficulty + now; bytes memory source_b = toBytes(source); return uint(keccak256(source_b)) % 100; } It is also not hard to guess. You are trying to make ...


Only top voted, non community-wiki answers of a minimum length are eligible