If there's an ICO with a cap of $1 million usd and there's $10 million Ether being sent all at the same time, I'm assuming the transaction with the highest gas gets prioritized...but is there a limit to how much gas you can put? For example will 500,000,000 gas get rejected by the miners?
Edit 1/2019: ~8 mil. gas limit
Edit 1/2020: ~10 mil. gas limit
There is a block gas limit of ̶a̶̶r̶̶o̶̶u̶̶n̶̶d̶̶ ̶̶4̶̶,̶̶3̶̶ ̶̶m̶̶i̶̶l̶̶l̶̶i̶̶o̶̶n̶ at the time of writing. You can look it up here: https://ethstats.net/
It does not matter how much gas you send along, as the unused will be returned to you anyway. What matters, though, is the price you offer, which has no limit. Of course, you must be able to pay the total sum.
- Max gas limit for a transaction is the gas limit for that particular block.
- you can get the gas limit of block by eth.getBlock('latest') and checking gasLimit parameter in it.
- gas limit of the next block is 1.2 times of the moving avg of gas limit of all previous blocks.
so. maximum gas limit upcoming transactions approximately equals (1.2 times avg gas-limit)
Gas limit per transaction is in theory the same as block gas limit (if the block was only to fit 1 transaction). And it is a dynamic limit.
A convenient way to look it up is visiting https://etherscan.io/blocks selecting the latest block, and see value in "Gas Limit:"