I am unable to figure the getwork api
Isnt it supposed to be 2. The above is a really large number in big endian.


It's a small number in big endian. Think about it; big digits at the end.


  Now the previuos hash block


I don't know why Bitcoin does this, but block hashes are stored in normal order internally, then byte-reversed before displaying them. 

&gt;&gt;&gt; s="e965bfc2111c7a63a12b5c95ff9b5cc44f2d32ad9e52d9a04301000000000000"
&gt;&gt;&gt; import binascii
&gt;&gt;&gt; s=binascii.unhexlify(s)
&gt;&gt;&gt; s=s[::-1]
&gt;&gt;&gt; s=binascii.hexlify(s)
&gt;&gt;&gt; s


'0000000000000143a0d9529ead322d4fc45c9bff955c2ba1637a1c11c2bf65e9'


  Time:
  a77ead51


Use big endian. I got 1370324647 using this tool, then converted to 04 Jun 2013 with this tool.