refactor CoinRPC to support multiple protocols