and I would like to dim it with a triac and moc3021.
A TRIAC latches-on until current goes to zero (i.e. the next zero-crossing). So, a TRIAC always needs zero-crossing detection.
It's possible to dim with transistors or MOSFETs, but they only conduct in one direction so you either need a pair of complementary transistors/MOSFETs, plus the "support circuitry", or you can rectify the AC (which will work with regular incandescent bulbs).
Because all examples which I see uses natural and hot wire over bridge rectifier to deduct zc. But in my case there is only 2 wires exist
It can be done, but it's not "easy".
BTW - Most manual dimmers (which use TRIACs) only require 2-wires and the [u]X-10 dimmer switch[/u] only requires 2-wires.
Probably the bigger problem is that you need to power your circuit (including your Arduino or whatever is driving the opto-isolator). That also "can be done" without a neutral but most home automation switches do need a neutral. If you were planning on running additional wires into the switch box, you could add a neutral while you're at it.
There are several engineering & construction challenges in making a remote-switch that fits into a switch box, doesn't require re-wiring, works locally or remotely, and looks good. And, you probably can't build it for the price of an X-10 switch.
So... I always recommend choosing one of the existing home automation protocols and then BUY the controlled switches or outlets, and then you can build your own controller if you want to build something yourself.