Unmanned aerial vehicle (UAV) is recognized as one of the best sensing tools for gathering data in the industrial Internet of things sector. Besides, the flying ad hoc network (FANET) with multiple drones shows significant advantages in complicated task performing of large area. However, as an important part of communication security, key management for FANET currently depends heavily on the base station or infrastructures, which may easily become the attack target or increase the communication overheads of drones. Therefore, we propose a blockchain-based distributed key management scheme for heterogeneous FANET in this article, based on which drones can autonomously distribute cluster keys, update their public/private key pairs, migrate between clusters, and revoke malicious UAVs in a secure way. Security analysis and performance evaluation prove that our scheme can resist against a variety of external and internal attacks, and guarantee lightweight energy consumption for ordinary drones in the network.