Hey guys!
So apparently ETH can only handle so many computations in a single transaction.
The first iteration of the test Raffle was a success, we had three winners.
The second iteration (this one that we're on right now) however, we've had a few more tickets registered and a few more unique players and:
Having to trigger the Raffle Reset function, we sent the maximum allowable gas for a block and we still encountered the
out of gas error.
A simple computation, that your laptop can do in under 0.5 seconds, the ETH network can
not handle due to its sluggish nature.
This being said however, I already have some ideas on how to get a working version of the Raffle:
We can optimize the Raffle code, to loop more efficiently and thus take less processing time, but that still won't give us an unlimited number of players, the ETH Network will still have its limits.
After optimizing the Raffle we could go even further and split the winner selection loops into three separate transactions. And then ultimately, we can just have the Raffle auto reset itself after a certain number of tickets have been registered, making sure that we are never in any danger of having the Raffle stuck like we have here. This will increase the player&ticket limit, while ensuring that the Raffle Reset transaction will never run out of gas.
Now... The Raffle will work after a few little programming tricks and everyone will be happy, but I think we have to understand that ultimately, the underlying problem here is that the Ethereum Network is way too slow to have any real large scale DAPPS built on it.
This is one of the key reasons I am such a big advocate for moving over all of our infrastructure to a new, faster Decentralized Application Blockchain - like EOS.
If EOS delivers what is in their roadmap, then problems like these will be a thing of the past. We'll be talking about this like we are talking right now about ancient slow PCs ("Remember when they had a 2 MB Hard Drive the size of a truck back in the day?" - this is Ethereum in its current state a little bit further down the road).