Why not have paper ballots that can be read by a machine? It doesn't get around the issue entirely, but you can always look at the physical ballots for a recount. It's a lot harder to tamper with an election at scale when you need to handle physical ballots.
Or just abandon electronic voting entirely. Ireland tried electronic voting, but scrapped it for just these reasons. You could even keep the ballots in a machine-readable format for sanity checks if necessary.