  The convergence of mobile edge computing (MEC) and blockchain is transforming
the current computing services in mobile networks, by offering task offloading
solutions with security enhancement empowered by blockchain mining.
Nevertheless, these important enabling technologies have been studied
separately in most existing works. This article proposes a novel cooperative
task offloading and block mining (TOBM) scheme for a blockchain-based MEC
system where each edge device not only handles data tasks but also deals with
block mining for improving the system utility. To address the latency issues
caused by the blockchain operation in MEC, we develop a new Proof-of-Reputation
consensus mechanism based on a lightweight block verification strategy. A
multi-objective function is then formulated to maximize the system utility of
the blockchain-based MEC system, by jointly optimizing offloading decision,
channel selection, transmit power allocation, and computational resource
allocation. We propose a novel distributed deep reinforcement learning-based
approach by using a multi-agent deep deterministic policy gradient algorithm.
We then develop a game-theoretic solution to model the offloading and mining
competition among edge devices as a potential game, and prove the existence of
a pure Nash equilibrium. Simulation results demonstrate the significant system
utility improvements of our proposed scheme over baseline approaches.
