First find out the legality of the action, then do

Sa’d al-Shasri said in “Al-kawa’id al-muta’allika bil-muslim gayr al-mujtahid” (“Rules related to a Muslim who is not a mujtahid”), 13 :

It has been established among scholars that a person has a duty to find out the religious statute (hukm) of any act before committing it, so that he does not commit a forbidden one. And even a unanimous opinion is passed on the prohibition for a person of that action, the statute (hukm) of which he does not know .
Kashshaf al-kyna ‘, 3/135,“ Matalib uli an-nuha ”, 3/3,“ Khashiya ar-ravd al-murbi ”, 4/325.

And it is transmitted from the ruler of the believers’ Umar Ibn al-Khattab that he forbade those who do not know the legal provisions of the sale and purchase from trading in the market and said: “No one trades in our market, except for the one who has studied religious regulations [in questions trade] “.
At-Tirmidhi, 2/357 (hadith is good, rare).