The Emigrants and the Helpers began digging the trench around Madinah, carrying the dirt on their backs and chanting, "We are the ones who pledged allegiance to Muhammad upon Islam, for as long as we live, forever."The Prophet ﷺ would respond to them, saying, "O Allah, there is no good except the good of the Hereafter, so bless the Helpers and the Emigrants."
جعل المهاجرون والأنصار يحفرون الخندق حول المدينة، وينقلون التراب على متونهم ويقولون: نحن الذين بايعوا محمدا على الإسلام ما بقينا أبدا والنبي ﷺ يجيبهم ويقول: اللهم أنه لا خير إلا خير الآخرة فبارك في الأنصار والمهاجره.
Bukhari narrated it in the book of jihad and campaigns (2835) from Abu Muamar, he said, Abdul-Warith told us, he said, Abdul-Aziz told us, from Anas, and he related it.The core of Anas's hadith is found in the Sahihayn, as mentioned before, but Muslim did not mention this chain, nor his statement, "So He blessed the Ansar and the Muhajireen."