The introduction of satellite communications will play a key role in next generation communications. However, satellite systems are faced with the challenge of efficiently managing the satellite spectrum resource when supporting the communication needs of massive Internet-of-Things (IoT) devices, which is expected to growth explosively in scale of deployment. To address this issue, we propose a blockchain-based satellite spectrum resource optimization scheme. The scheme is based on a market-driven spectrum trading technique to maximize the benefit of the satellite systems, hence the utilization of the spectrum resource. In specific, the proposed spectrum trading protocol focuses on the heterogeneity of LEO satellite spectrum, which covers a huge band range with varying transmission qualities, by allowing a price differentiation between different spectrum ranges. As a result, different terrestrial IoT systems may select their preferred spectrum range, and price, according to their own application requirements and budgets. Furthermore, data integrity is needed to ensure the proper functioning of the spectrum trading process. In the proposed scheme, we adopt a blockchain mechanism for facilitating spectrum trading with enhanced security, with all essential transaction-related data to be stored in a blockchain, which is used as a distributed and immutable data store for all records of the trading activities. Due to the limited computing power of terrestrial IoT device terminals, the blockchain is based on a Delegated Proof