Rav Hamnuna said to one of the rabbis who was arranging aggadah before him: From where do we learn the matter that the Rabbis said, "The memory of the righteous is for a blessing" (Proverbs 10:7)? From the Torah, from where? As it is written, "And the LORD said: Shall I hide from Abraham what I am doing?" (Genesis 18:17) [the righteous Abraham is named with blessing]. And from where do we learn the matter, "but the name of the wicked shall rot" (Proverbs 10:7)? As it is written, "and he pitched his tent toward Sodom, and the men of Sodom were wicked and sinners" (Genesis 13:12-13).
Where Scripture Itself Shows the Righteous Are Blessed and the Wicked Rot
Yalkut Shimoni on Torah 70:4
אָמַר לֵיהּ, רַב הַמְנוּנָא לְהַהוּא מֵרַבָּנָן דְּהֲוָה מְסַדֵּר אֲגַדְתָּא קַמֵּיהּ, מִנָּא הָא מִילְתָּא דְּאָמְרוּ רַבָּנָן (משלי י, ז) "זֵכֶר צַדִּיק לִבְרָכָה" וְכוּ' מִדְּאוֹרַיְתָא מִנָּלָן, דִּכְתִיב, (בראשית יח, יז) "וַה' אָמַר הַמְּכַסֶּה אֲנִי מֵאַבְרָהָם" וְגוֹ' מִנָּא הָא מִילְתָּא (משלי י, ו) "וְשֵׁם רְשָׁעִים יִרְקָב" דִּכְתִיב, וַיֶאֱהַל עַד סְדוֹם וְאַנְשֵׁי סְדוֹם רָעִים וַחֲטָאִים.