Implement stake kernel mining as a separate function