In this paper, the blockchain technology is utilized to build the first incentive mechanism of nodes as per data storage for wireless sensor networks (WSNs). In our system, the nodes storing the data are rewarded with digital money. The more the data stored by the node, the more the reward it achieves. Moreover, two blockchains are constructed. One is utilized to store data of each node and ... [Show full abstract] another is to control the access of data. In addition, our proposal adopts the provable data possession to replace the proof of work (PoW) in original bitcoins to carry out the mining and storage of new data blocks, which greatly reduces the computing power comparing to the PoW mechanism. Furthermore, the preserving hash functions are used to compare the stored data and the new data block. The new data can be stored in the node which is closest to the existing data, and only the different subblocks are stored. Thus, it can greatly save the storage space of network nodes.