Add Mining Lib

Handle mining thread.