according to Hammurabi, what was his purpose for having written these laws?

Hammurabi's purpose for writing his code of laws, known as the Code of Hammurabi, was to establish a set of rules and regulations to govern the Babylonian society. He aimed to promote justice, maintain order, and provide a legal framework for his kingdom. The laws were meant to ensure social stability, protect the weak, and maintain the rights and privileges of different social classes. Additionally, Hammurabi wanted to assert his authority as a king and make his subjects aware of his power and position.