The roots of Hamas are in the Muslim Brotherhood out of Egypt, not the Iranian revolution. Secondly, Hamas managed to cobble together a better government in Gaza than the PLO/PA was able to cobble together there (not to mention what the PLO/PA was not able to cobble together in the West Bank), which is why Hamas won the Palestinian National Elections in 2007. They won across Palestine, because the PLO/PA was seen as corrupt, and because the Palestinians know themselves to be the victims of a illegal, brutal and brutally illegal occupation. Their situation did not get better with the Oslo Accords (PA/PLO), but worsened.
The first step in the Oslo Accords was Israel’s cessation of military occupation of Gaza. That is to say withdrawal of the troops. Then there was to be further negotiations between the PA/PLO and Israel. Those fell through, because Israel’s annexation of Jerusalem is illegal, but Israel wanted to retain Jerusalem.
Israel did not withdraw its military from Gaza until 2005 (it never really did), and by then the IDF had torn up Rafah to create a militarized border between Gaza and Egypt, and Gaza had been settled by 9,000 settlers on illegal settlements protected by the IDF. Those settlers had to be withdrawn. As soon as Israel withdrew it put all sorts of restrictions on Gaza and the Palestinians there and prevented anyone from going in or out.
In 2006, Hamas decided to, and was encouraged to by the US, run for election. When Hamas won, Israel and the US immediately put Gaza under total siege. That lasted until 2010, when Israel loosened it do a small degree. Hamas is independent of Iran. That is plain to see. Iran supports Hamas’ goal of restoring Palestine to the borders that it was before the Nakba, that is to say one state. This is why Israel and the US claim that Hamas (and Hezbollah, which also formed before the Iranian revolution during Israel’s invasion of Lebanon) is an Iranian proxy. However, it is simply a question of Iran supporting the Palestinian resistance, and in particular, Hamas’ view of Palestinian resistance and what that all means.