Another matter, “the Lord said to Moses: Write for yourself these matters” (Exodus 34:27) – that is what is written: “It is good for me that I was afflicted, so I might learn Your statutes” (Psalms 119:71). It was for Moses’s benefit that he fasted the one hundred and twenty days that he received the Torah.16This includes the forty days Moses spent on Mount Sinai before he descended with the first tablets; the forty days he spent on Mount Sinai pleading for forgiveness for Israel after the sin of the Golden Calf; and the forty days he spent there before descending with the second tablets.

He studied Torah on all those days (Etz Yosef). From what would Moses eat? It was from the aura of the Divine Presence, as it is stated: “And You sustain them all” (Nehemiah 9:6). Another matter, from what did he eat?

It was from the Torah, as it is stated: “Son of man, eat what you find, [eat this scroll]…I ate it” (Ezekiel 3:1, 3). Why? It is because the Torah is sweet, as it is stated: “And sweeter than honey and the nectar of ripe fruit” (Psalms 19:11). Another matter, it was from the bread of Torah, as it is written: “Come, partake of my bread” (Proverbs 9:5).

From where is it derived that he did not sleep and did not doze? This is analogous to a king who was fond of his treasurer. He said to him: ‘Weigh gold dinars for yourself.’17He gave him a certain time in which he could collect gold dinars for himself from the royal treasury. In his joy, he sought neither to eat nor to drink.

He sought to sleep.18In his eagerness to collect treasure, he did not eat or drink but just collected gold dinars. Eventually, though, he became tired. He said: ‘If I sleep, I will lose these.’19Even when he was tired he did not sleep so that he would not lose out on the unique opportunity to collect golden dinars. So too, Moses was assessing the Torah, and he forgot and neither ate nor drank.

He sought to sleep. He said: ‘If I sleep, I will lose, as He told me only forty days.’ The Holy One blessed be He said to him: ‘You afflicted yourself; by your life, you will not lose. On the first tablets there were only the Ten Commandments.

Now that you afflicted yourself, I will give you halakhot, midrashim, and aggadot,’ as it is stated: “Write for yourself these matters” (Exodus 34:27). Why did the Holy One blessed be He say: “Write for yourself”? Is it not written: “The script was the script of God” (Exodus 32:16) and it is written: “He inscribed on the tablets, like the first inscription” (Deuteronomy 10:4)? Rather, this is what the Holy One blessed be He said to him: ‘Write the Torah, Prophets, and Writings, as they shall be in writing, but the halakhot, midrashim, aggadot, and Talmud, will be oral.’

When Moses knew this, he began saying: “It is good for me that I was afflicted” (Psalms 119:71); “The Torah of Your mouth is better for me [than thousands of gold and silver pieces]” (Psalms 119:72).