Dealing With Misbehavior In Distributed Systems: A Game-Theoretic Approach