Blockchain technology is increasingly being used in personal data protection. Inspired by the importance of data security, this paper proposes a personal data protection mechanism based on blockchain, combined with distributed hash tables and cryptography, to enhance users' control over the data generated using web applications. This mechanism limits enterprises' data collection and uses by users without their permission, and users have complete control over the data they generate when using the web services provided by the enterprise. It is up to the user to decide whether to share their data with other organizations. This paper designs this mechanism's system model and describes the three aspects in detail: data storage mechanism, data encryption mechanism, and data trading mechanism. Among them, the data storage mechanism restrains enterprises from privately collecting users' data, the encryption mechanism ensures that the users control the generated user data, and the data trading mechanism enables users to decide to which organizations to trade their data. Then, use the Stackelberg game to simulate the revenue sharing between users and service providers in data trading, as comparison to the current scheme, this one provides 31%, 561%, and 19% more income for the service provider when there are 1000 users. Finally, it designs and implements an application platform to reflect the practical significance of this research..