בחנוכה:בִּימֵי מַתִּתְיָֽהוּ בֶּן יוֹחָנָן כֹּהֵן גָּדוֹל חַשְׁמוֹנָאִי וּבָנָיו כְּשֶׁעָמְ֒דָה מַלְכוּת יָוָן הָרְ֒שָׁעָה עַל־עַמְּ֒ךָ יִשְׂרָאֵל לְהַשְׁכִּיחָם תּוֹרָתֶֽךָ וּלְהַעֲבִירָם מֵחֻקֵּי רְצוֹנֶֽךָ, וְאַתָּה בְּרַחֲמֶֽיךָ הָרַבִּים עָמַֽדְתָּ לָהֶם בְּעֵת צָרָתָם רַֽבְתָּ אֶת־רִיבָם דַּֽנְתָּ אֶת־דִּינָם נָקַֽמְתָּ אֶת־נִקְמָתָם מָסַֽרְתָּ גִבּוֹרִים בְּיַד חַלָּשִׁים וְרַבִּים בְּיַד מְעַטִּים וּטְמֵאִים בְּיַד טְהוֹרִים וּרְשָׁעִים בְּיַד צַדִּיקִים וְזֵדִים בְּיַד עוֹסְ֒קֵי תוֹרָתֶֽךָ...
On Chanukah: In the days of Matisyahu, son of Yochanan the High Priest, the Hasmonean and his sons, when the evil Greek kingdom rose up against Your people Israel to make them forget Your Torah and to turn them away from the statutes of Your will— You, in Your abundant mercy, stood by them in their time of distress, You defended their cause, You judged their grievances, You avenged them. You delivered the mighty into the hands of the weak, many into the hands of the few, defiled people into the hands of the undefiled, the wicked into the hands of the righteous, and insolent [sinners] into the hands of diligent students of Your Torah. etc...
מאי חנוכה? דתנו רבנן: בכ"ה בכסליו יומי דחנוכה תמניא אינון, דלא למספד הון ודלא להתענות בהון. שנכנסו יוונים להיכל וטמאו כל השמנים שבהיכל, וכשגברה מלכות בית חשמונאי ונצחום, בדקו ולא מצאו אלא פך אחד של שמן היה מונח בחותמו של כהן גדול, ולא היה בו אלא להדליק יום אחד, נעשה בו נס והדליקו ממנו שמונה ימים. לשנה אחרת קבעום ועשאום ימים טובים בהלל והודאה.
Bavli Shabbat 21b
What is Hannukah? For our rabbis taught, on the 25th of Kislev there are the days of Hannukah, they are 8, and one is not allowed to offer a eulogy or fast on them.
For the Greeks entered the Temple and they defiled all of the oil in the Temple, and when the Hasmoneans prevailed, they looked and didn't find anything but one flask of oil that was stamped with the High Priest's seal. And there was only enough to light for one day. And a miracle was made and they lit for 8 days. The next year they established these days as holidays, for the recitation of the Hallel and for Thanksgiving.
מַאי מְבָרֵךְ? — מְבָרֵךְ: ״אֲשֶׁר קִדְּשָׁנוּ בְּמִצְוֹתָיו וְצִוָּנוּ לְהַדְלִיק נֵר שֶׁל חֲנוּכָּה״. וְהֵיכָן צִוָּנוּ? רַב אַוְיָא אָמַר: מִ״לֹּא תָסוּר״. רַב נְחֶמְיָה אָמַר: ״שְׁאַל אָבִיךָ וְיַגֵּדְךָ זְקֵנֶיךָ וְיֹאמְרוּ לָךְ״.
And what blessing does one recite? He recites: Who has made us holy through His commandments and has commanded us to light the Hanukkah light. The Gemara asks: And where did He command us? The Gemara answers that Rav Avya said:from: “You shall not veer from the sentence which they shall declare unto you, to the right, nor to the left” (Deuteronomy 17:11). Rav Neḥemya said that the mitzva to heed the voice of the Elders of Israel is derived from the verse: “Ask your father, and he will declare unto you, your Elders, and they will tell you” (Deuteronomy 32:7).

אָמַר רַבָּה: נֵר חֲנוּכָּה מִצְוָה לְהַנִּיחָהּ בְּטֶפַח הַסָּמוּךְ לַפֶּתַח. וְהֵיכָא מַנַּח לֵיהּ?
Rabba said: It is a mitzva to place the Hanukkah lamp within the handbreadth adjacent to the entrance.
תָּא שְׁמַע, דְּאָמַר רָבָא: הָיָה תָּפוּשׂ נֵר חֲנוּכָּה וְעוֹמֵד — לֹא עָשָׂה וְלֹא כְלוּם. שְׁמַע מִינַּהּ: הַנָּחָה עוֹשָׂה מִצְוָה! הָתָם, הָרוֹאֶה אוֹמֵר לְצוֹרְכּוֹ הוּא דְּנָקֵיט לַהּ.
תָּא שְׁמַע, דְּאָמַר רָבָא: הִדְלִיקָהּ בִּפְנִים וְהוֹצִיאָהּ — לֹא עָשָׂה כְּלוּם. אִי אָמְרַתְּ בִּשְׁלָמָא הַדְלָקָה עוֹשָׂה מִצְוָה — הַדְלָקָה בִּמְקוֹמוֹ בָּעֵינַן, מִשּׁוּם הָכִי לֹא עָשָׂה כְּלוּם.
אֶלָּא אִי אָמְרַתְּ הַנָּחָה עוֹשָׂה מִצְוָה, אַמַּאי לֹא עָשָׂה וְלֹא כְלוּם? הָתָם נָמֵי: הָרוֹאֶה הוּא אוֹמֵר לְצוֹרְכּוֹ הוּא דְּאַדְלְקַהּ.
The Gemara suggests: Come and hear a solution to this dilemma from that which Rava said: One who was holding a burning Hanukkah lamp in his hand and standing, he did nothing in terms of fulfilling the mitzva. Conclude from this that placing accomplishes the mitzva. Until he sets the lamp down in its appropriate place, he did not fulfill the mitzva. The Gemara rejects this: There, they said that he did not fulfill his obligation for a different reason. One who sees it will say that he is not holding the lamp in order to fulfill the mitzva, but he is holding it for his own needs.
Come and hear another resolution for this dilemma from that which Rava said: One who lights the Hanukkah lamp inside the house and then takes it out did nothing in terms of fulfilling the mitzva. Granted, if you say that lighting accomplishes the mitzva it is understandable, as lighting in its place is required. That is why Rava ruled that he did nothing in terms of fulfilling the mitzva.
However, if you say that placing accomplishes the mitzva, why did Rava rule that he did nothing? Didn’t he set it down in its appropriate place? The Gemara answers: There too, even though he subsequently brought it outside, one who sees him lighting inside will say to himself that he is lighting the lamp for his own needs and not in fulfillment of the mitzva.
לצרכו - להשתמש וליכא היכר ניסא:
For his need: To use. So there is no recognition [that it is to commemorate] the miracle.