# A Security-Oriented Data-Sharing Scheme Based on Blockchain
## 3 A Security-Oriented Data-Sharing Scheme Based on Blockchain
### Formal Model
#### 3.2.1 A Storage Architecture That Separates Data from the Proof of Ownership  
The direct embedding of extensive shared data into the blockchain presents significant storage challenges for network nodes and clients, increasing operational expenses. The inherent immutability of blockchain technology leads to an ongoing accumulation of data, which diminishes the efficiency of storage and retrieval processes. To counter these challenges, the proposed framework employs an innovative storage architecture that segregates shared data from its ownership proof. This strategy entails storing data off-chain while managing ownership proofs separately. By separating these elements, the framework not only enhances data security but also significantly decreases storage requirements and associated costs, thereby improving overall system performance. The innovative architecture is visually outlined in Figure 2.  
This paper introduces a blockchain framework utilizing a consortium chain. This model, distinct from public and private chains, confines function access to consortium members, resulting in a semi-public ledger. It streamlines transaction confirmation, lowers administrative costs, and bolsters data security via controlled access. New users are authenticated through the allocation of a public-private key pair, ensuring a structured registration process. Data are stored on the InterPlanetary File System (IPFS), leveraging distributed data segmentation to enhance transfer rates and optimize network resource use. Furthermore, IPFS incorporates hash-based deduplication to reduce storage overhead. Figure 1: System architecture. After the data owner \(u_{i}\) packages and uploads the shared data \(d_{i}^{m}\) to IPFS, IPFS returns the hash value of the shared data, as shown in Algorithm 1. First, the public key is read and converted to byte form and then to string form, as shown in lines 1-4 of Algorithm 1. Next, as shown in lines 5-8 of Algorithm 1, the shared key for encrypting and decrypting the file is generated using the Elliptic Curve Key Exchange (ECDHE) algorithm, and the file is uploaded to the specified address. The IPFS address CID of the file is returned, then the CID is encrypted, and the ciphertext hash value is obtained using Base64 encoding. After setting up the blockchain, the file-related information (file address, file name, file ID, token ID, etc.) is stored in the blockchain as outlined in Algorithm 1, lines 9-16. Finally, as shown in line 17 of Algorithm 1, return the corresponding CID of the shared data \(d_{i}^{m}\) on IPFS, the block number stored in the blockchain, and the shared key. This CID will be used as an identifier for location addressing on IPFS, and it is verified to determine whether the data \(d_{i}^{m}\) has been changed. Additionally, IPFS removes redundant files with the same hash value by comparing them, thereby efficiently utilizing storage space. In this study, we utilize the hash value of shared data to create an NFT, which serves as a verifiable proof of ownership. Securely contained within smart contracts on the blockchain, NFTs act as reliable custodians, enabling the authentication and circulation of unique assets. The NFTs used in this research, based on the ERC721 standard [31], are uniquely identifiable, indivisible, and possess distinct attributes, thus providing a robust framework for verifying ownership. When a data owner \(u_{i}\) uploads shared data \(d_{i}^{m}\) to a data-sharing platform, the encrypted hash value of the data storage address for that user is uploaded and minted into an NFT asset warrant, providing proof of ownership of the data owner \(u_{i}\). This strategy implements a bifurcated storage approach, storing shared data files on distributed nodes and maintaining ownership proofs on the blockchain. This approach  
Figure 2: Storage architecture that separates shared data from the proof of ownership. enhances the security and efficiency of data sharing while significantly reducing storage requirements and associated costs.