Online social networks (OSNs) are becoming more and more prevalent in people's life, but they face the problem of privacy leakage due to the centralized data management mechanism. The emergence of distributed OSNs (DOSNs) can solve this privacy issue, yet they bring inefficiencies in providing the main functionalities, such as access control and data availability. In this article, in view of the above-mentioned challenges encountered in OSNs and DOSNs, we exploit the emerging blockchain technique to design a new DOSN framework that integrates the advantages of both traditional centralized OSNs and DOSNs. By combining smart contracts, we use the blockchain as a trusted server to provide central control services. Meanwhile, we separate the storage services so that users have complete control over their data. In the experiment, we use real-world data sets to verify the effectiveness of the proposed framework.