how does mining work step by step mining