There are many known painless and very effective ways of killing a human being. For example, suffocation with Nitrogen gas. It will cause a state of euphoria, then unconsciousness, then death. No pain, dead simple (pun not intended), and 100% success rate. It's a no-brainer. Or a simple, massive overdose of pretty much any anesthetic will do. It does not take complicated mixtures.
But it would mean, your convict would die "happy". And that thought would be too much to bear for the victims. The death penalty is not about justice. It is about revenge. It is designed to be gruesome, the suffering is intentional. The deliquent is no longer considered a human being, and the pig deserves to suffer. It seems to be consensus even here on slashdot.