On the trench, carrying earth on their backs
He saw what they were doing and said it out loud.
اللَّهُمَّ إِنَّهُ لاَ خَيْرَ إِلاَّ خَيْرُ الآخِرَهْ، فَبَارِكْ فِي الأَنْصَارِ وَالْمُهَاجِرَهْ
Allāhumma innahu lā khayra illā khayru-l-ākhirah, fa-bārik fi-l-anṣāri wa-l-muhājirah.
“O Allah, there is no good except the good of the Hereafter, so bless the Anṣār and the Muhājirūn.”
The full narration
Narrated Anas:Al-Muhajirun (i.e. the Emigrants) and the Ansar were digging the trench around Medina and were carrying the earth on their backs while saying, "We are those who have given the pledge of allegiance to Muhammad for Islam as long as we live." The Prophet (ﷺ) said in reply to their saying, "O Allah! There is no goodness except the goodness of the Hereafter; so please grant Your Blessing to the Ansar and the Emigrants." The people used to bring a handful of barley, and a meal used to be prepared thereof by cooking it with a cooking material (i.e. oil, fat and butter having a change in color and smell) and it used to be presented to the people (i.e. workers) who were hungry, and it used to stick to their throats and had a nasty smell
Source
Ṣaḥīḥ al-Bukhārī · 4100
- Agreed upon as authentic (al-Bukhārī / Muslim)