implementation of complete PoW