Yeah sure, I've had my pain days. :) I'm still up overall, fwiw.<p>I lost 15 ETH writing a faulty script to trade automatically on EtherDelta, when that was still a thing. Their UI was (intentionally?) poor and didn't have client-side checks to ensure people weren't fat fingering their trades. It also didn't have an automatic market maker. So, if someone typo'ed an order, the typo'd order would sit on the books as there wasn't a process to automatically match overlapping bid/asks. As a user, this meant you would sometimes see free money literally sitting there waiting to be clicked and taken.<p>So I thought I'd automate the process and trade for the typo automatically. This didn't work out so well. First, it turns out there were other bots running already. Since it was all on-chain, the gas price you bid determines your transactions in-block priority. So, all the bots were trapped in a game theory dilemma. If there was a $10,000 typo, and all you need to do is submit "Yes", then how much should you pay to try and beat others to saying yes? Well, if you're the only participant, then you pay $0. If you're one of 2 participants then you pay $5,000. If you're one of 3 then $3,333.33, etc. The issue? You don't know how many other bots are out there.<p>This situation has weird outcomes. There was <i>actually</i> free $10k+ trades sitting there to be taken. They were <i>actually</i> being taken, but those taking were <i>never</i> the ones profiting. Instead, it was the ETH miners receiving huge priority tips that were making out like bandits... but if all the unprofitable bots ever gave up then, suddenly, there would be free money once again.<p>Anyway. The EtherDelta service was comprised of two wallets. One was within their smart contract and one was external. You place bids with money that you moved inside their smart contract, but you pay your bid's gas with money you kept outside their smart contract. I ran my code for a while, thought it seemed OK enough to run overnight, and, just before bed, decided that "to be safe" I would move most of my money from in-contract to out-of-contract. This would make it so that I didn't wake up to a ton of lost money because my bot wouldn't have a ton of money to trade with.<p>Unfortunately, there was an edge case in my code that would cause the bot to try and place a bid and fail in a way that burned gas. That edge case came up while I was sleeping and my bot burned through all my gas. This wouldn't have been an issue if I had left my money where it was originally, but, because I moved it all to the wallet which was used to pay for gas, I ended up burning a bunch of ETH in gas overnight.