0

Are there are any design patterns or gas efficient methods of mass updating user balances (for ERC20 tokens)?

For instance, say I wanted to run a casino where, after Block number X, all of the accounts such that Hash(Account address + hash of block number X) is even get one token added to their balance and if the value is odd, one token is deducted from their balance.

Are there any good methods out there for choregraphing such a process? The obvious way is to send a transaction after that block which updates all the balances, yet as the number of accounts becomes large, such a function call is very expensive. Any ideas? Thanks

1 Answer 1

0

Each blockchain state write, where a state is modified using SSTORE instruction is, going to cost a lot of gas.

You need to design a different mechanism where all users as a pool members get new tokens through liquidity mining or similar program and then can claim any received tokens.

Your Answer

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

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