It's impossible. First due pseudoanonymous nature of Bitcoin, second due the impossibility of accurately establishing the economic nature of transactions (trading, sending, outputs integration, etc.).
I think it's better for the government to take the tax when fiat money withdrawing through exchange, maybe even when buying goods (taking into account the amount of fiat money entered into the system).
exactly that they are doing - they are applying the tax when the bitcoin is exchanged to fiat. It is called a capital gains tax. So why are you saying it is impossible in your first paragraph, if they are effectively doing it and you yourself admit it?
As I understand the topic starter talks about crypto-to-crypto transactions. Not crypto-to-fiat.
I have been thinking of this for long and the reason being that a lot of bitcoin transaction is going online everyday in many countries and i think government can generate IGR from this if possible. I am not a programmer and i have a little knowledge about bitcoin technologies but i just want to know if it is possible.