To enable secure and efficient dynamic spectrum sharing (DSS) with guaranteed revenue and quality of service (QoS) in future wireless communications, we present a consortium blockchain-based DSS framework, where the regulators supervise the whole process of DSS, and thus the revenue of each participant can be guaranteed. Each mobile network operator (MNO) on the chain can adaptively act as a spectrum provider or spectrum requestor based on their demand, and the spectrum resource allocation is recorded on the chain with a smart contract. The optimal spectrum pricing and buying strategies are solved based on a multi-leader multi-follower (MLMF) Stackelberg game model, and the equilibrium is solved with the proposed algorithm. We then build a prototype with Hyperledger Fabric consortium blockchain, and the average {latency is} evaluated. Simulations and prototype evaluations validate the feasibility of blockchain-based DSS and show that the average latency increase with the participants, which provides useful insights for real applications.