To regulate the relationships among his people and promote their welfare. It was a code of ancient Mesopotamia.Babylonian king Hammurabi established the code. It consists of laws, punishments etc. The code used cuneiform script. The code mainly consisted of contracts.