What happens if the person who gets the vaccine develops a very painful condition (like cancer)? All effective painkillers work in exactly the same way heroin does, so I assume if it stops the effects of heroin it'll stop the effects of other opiods/opiates as well.
Sounds like trading one kind of suffering for another.
It's also well-known that the most successful quitters of drugs are people who truly WANT to be clean/sober, and deal with the issues that made them drug users in the first place. I have a feeling this would be effective in the short-term, but it doesn't really address the root causes of most people's addictions.