When was the first set of hockey rules made?

Since the first game was ever played there obviously had to be some sort of rules. However, the first set of formal hockey rules was published by Mr. J. G. A. Creighton in Montreal way back in 1877. Obviously, over the years, rules have been changed, refined and new rules invented as the game evolved into what it is today.