The influx of massive IoT devices can aggravate the shortage of spectrum resources, while the contradiction that a large number of licensed spectrum resources are underused. The key to resolve this issue is to adopt spectrum sharing. However, some licensed users (LUs) are reluctant to share their idle spectrum due to selfishness and concerning about location privacy leakage, which will seriously restrict the effective implementation of spectrum sharing in IoT Networks. In view of this, a Casper model (GB-Casper) for coding optimization is designed by combining the Geohash encoding prefix and binary encoding suffix with k anonymous region location encoding method. This model employs the minimum area of anonymous region (A\-\min\) required by LUs to control the length of Geohash code, and utilizes the binary code to divide k anonymous region in a fine-grained way. Through the string comparison operation, it can determine whether the generated k anonymous region contains k-1 users, so as to reduce the binary number of encoding bits to gradually expand the scan region, and thus achieving the k anonymous region satisfying the protection of location privacy to replace the authorized users’ real location. The spectrum contribution degree is introduced, which is quantified into the game model together with the level of location privacy protection to form an incentive scheme for IoT spectrum sharing against location privacy leakage. Simulation results show that the proposed scheme can quickly construct k anonymous region and effectively motivate LUs to actively participate in spectrum sharing while preventing location privacy leakage.