A peer-to-peer content distribution and downloading method based on blockchain

Through a blockchain-based peer-to-peer content distribution method, using smart contracts and security protocols, the single point problem, fairness and confidentiality issues in the peer-to-peer content distribution network are solved, and efficient and fair content distribution and low-cost storage computing are achieved, which is suitable for decentralized application scenarios.

CN119892846BActive Publication Date: 2025-09-26SOUTHWEST JIAOTONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510050646.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-13
Publication Date
2025-09-26
Estimated Expiration
2045-01-13

AI Technical Summary

Technical Problem

Existing peer-to-peer content distribution networks have single point problems, insufficient fairness, content leakage risks and high storage and computing costs, which lead to network crashes and resource waste.

Method used

A blockchain-based peer-to-peer content distribution method is adopted. Through smart contracts and security protocols, blockchain is used as a decentralized trusted third party to coordinate the content exchange process, ensure the fairness, confidentiality and efficiency of content distributors, and adopt a verifiable fair distribution protocol and efficient key derivation method to optimize storage and computing consumption on the blockchain.

Benefits of technology

It achieves fairness and confidentiality in the content distribution process, reduces storage and computing costs, improves network robustness and resource utilization efficiency, and is suitable for decentralized application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119892846B_ABST
    Figure CN119892846B_ABST
Patent Text Reader

Abstract

This invention provides a blockchain-based peer-to-peer content distribution and downloading method, comprising three phases: preparation, download and transmission, and decryption. This method utilizes this blockchain-based peer-to-peer content distribution and downloading method to optimize on-chain storage and computing power while ensuring content confidentiality during distribution. This approach is practical and provides technical and design insights for the implementation of blockchain in a wide range of decentralized applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a peer-to-peer content distribution and downloading method based on blockchain. Background Art

[0002] With the rapid growth of online interactive activities on the Internet, the demand for efficient content transmission is particularly urgent. In 2022, video traffic has accounted for 82% of Internet traffic. At the same time, according to the "Digital China Development Report (2020)", my country's mobile Internet access traffic has increased from 4.19 billion GB at the end of 2015 to 165.6 billion GB in 2020. This growing large data transmission requires the support of content distribution networks. In traditional centralized content distribution networks, the edge cache servers for content transmission are deployed by centralized content distributors. Its shortcomings are: (1) Centralized content distribution services have single point problems and are easily targeted by network attacks; (2) Users need to purchase pre-set bandwidth in advance to handle peak requests, and many idle service resources are wasted. These consumptions will be shared by users, resulting in higher prices. To solve this problem, distributed peer-to-peer content distribution network technology has become a promising alternative. It can use the distributed network built by ordinary nodes and idle bandwidth to provide content distribution services. The peer-to-peer content distribution model is as follows: Figure 1 As shown in Figure 1, it mainly includes three roles: content provider, content distributor and content consumer. Figure 1 As shown, the relationship between the three roles is as follows: the content provider provides content, pays a fee to the content distributor for content distribution, and receives payment from the content consumer for purchasing the content; the content distributor sends content to the content consumer on behalf of the content provider and receives payment from the content provider; and the content consumer receives the content and pays the content provider. In this content distribution process, ensuring efficient distribution and ensuring that all participants receive the results they deserve is crucial. However, typical attacks (for example, content distributors may collude with content consumers to obtain payment from content providers without actually delivering the content; content providers may collude with content consumers to prevent distributors from receiving their due payments) can potentially prevent some participants from receiving the results they deserve. These participants may then leave the peer-to-peer network, ultimately leading to the collapse of the entire peer-to-peer content distribution network. To this end, this patent incorporates blockchain as a decentralized, trusted third party to coordinate the entire peer-to-peer content distribution process. Based on smart contracts and security protocol design, it ensures the security and efficiency of the peer-to-peer content distribution and download process.

[0003] Existing peer-to-peer content downloading methods are divided into the following categories:

[0004] (1) General peer-to-peer information exchange methods. Various peer-to-peer information exchange methods, including the popular BitTorrent protocol, have the well-known disadvantage of failing to strictly guarantee fairness, which may lead to a serious imbalance between participants' input and output, and ultimately cause them to leave the content distribution network.

[0005] (2) Fair exchange protocols. A large number of fair exchange methods have been studied to achieve strict fairness guarantees. However, in the context of peer-to-peer content distribution, the traditional definition of fairness is not sufficient to guarantee the fairness of content distribution.

[0006] (3) Other related decentralized content distribution solutions. This type of method has the problem of failing to meet content confidentiality requirements, that is, the content may be leaked to attackers during the distribution process. In addition, directly using existing methods will result in excessively high storage and computing costs on the blockchain, making it impractical. Summary of the Invention

[0007] The purpose of the present invention is to provide a peer-to-peer content distribution and downloading method based on blockchain, which guarantees completeness (any honest participant in the peer-to-peer content distribution network can get what they deserve. Specifically, the content distributor will receive a reward corresponding to the consumed bandwidth, the content consumer will obtain the correct content and pay the fee, and the content provider will provide the correct content and receive a corresponding reward), confidentiality (the content will not leak private information to attackers during transmission), robustness (using blockchain as a decentralized trusted third party to coordinate the content exchange process and resist attacks such as single point problems) and efficiency (the message load sent to the blockchain is small, achieving low storage and computing consumption on the blockchain; at the same time, the communication rounds are optimal and only related to the number of content blocks n, without the need for additional steps).

[0008] To achieve the above objectives, the present invention provides a peer-to-peer content distribution and downloading method based on blockchain, which includes three stages: preparation stage, download transmission stage, and decryption stage;

[0009] Preparation phase: The content provider deploys the smart contract. After the contract is successfully deployed, the content distributor sends a message to the blockchain to join the distribution. The content provider selects one of the participating distributors. The content distributor receives the pair sequence of the content block sent by the content provider, verifies its signature, saves it locally after verification, and then sends a confirmation to the blockchain to indicate that the content is ready for distribution. The pair sequence includes multiple "pairs", each of which includes the ciphertext of the content block and its ciphertext signature.

[0010] Download and transmission phase: The content consumer sends a download request to the blockchain. After seeing the download request, the content distributor executes a verifiably fair distribution agreement with the content consumer. The content distributor then submits a "receipt" to the blockchain smart contract, thereby obtaining the content distribution fee paid by the blockchain to the content distributor.

[0011] Decryption phase: The content provider sends the encrypted decryption key array to the blockchain. The content consumer obtains the decryption key from the blockchain and decrypts the content. The content consumer then sends a confirmation to the blockchain. After receiving the confirmation, the blockchain will automatically pay the content provider the fee for providing the content immediately or after a period of time if no confirmation is received.

[0012] Preferably, the preparation stage includes the following steps:

[0013] The content provider deploys a smart contract, where the contract parameters include the provider's public key pk_P, the unique identifier of the content H_m, the number of content blocks n, the confirmation time T_cf, the fee B_p that the provider will pay to the distributor for each content block distributed, and the fee B_c that the provider will charge to the content consumer for each content block distributed;

[0014] After the contract is successfully deployed, the content distributor joins the distribution by sending a message to the blockchain. The message includes the distributor's public key pk_D.

[0015] The content provider selects one of the participating distributors and then performs the following operations: randomly generates a master key mk. Based on the hash value H_mk of the master key and the number of content blocks n, it calls the key tree generation algorithm KTGen to obtain the key tree KT. The content provider stores mk and KT locally. It then uses the n leaf nodes of KT as the secret key to encrypt each content block. It then signs each encrypted content block to obtain a sequence of content block pairs, which it then sends to the selected content distributor.

[0016] The content distributor receives the sequence of content blocks sent by the content provider, verifies its signature, saves it locally after passing, and then sends a confirmation to the blockchain to indicate that the content is ready for distribution.

[0017] Preferably, the download transmission stage includes the following steps:

[0018] The content consumer sends a download request to the blockchain. The parameters included in the message are the content consumer's public key pk_C and the initial download content block subscript ζ. By default, ζ = 1, indicating that the download starts from the first content block.

[0019] The content distributor and content consumer execute a verifiable fair distribution protocol to transmit content. At the end, the content consumer obtains a pair sequence of content blocks, and the content distributor receives a "receipt" for the distributed content blocks.

[0020] The content distributor submits the latest "receipt" to the blockchain, and the smart contract verifies the receipt. If it passes, it automatically calculates the number of content blocks ctr distributed based on the subscript of the content block in the "receipt" and the subscript ζ of the initially downloaded content block, and then automatically sends the corresponding fee ctr*B_p to the content distributor.

[0021] Preferably, the decryption stage includes the following steps:

[0022] The content provider calls the secret key element revealing algorithm RevealKeys based on the number of content blocks n, the initial content block subscript ζ, the number of distributed content blocks ctr calculated on the chain, and the master key hash value H_mk. It generates the secret key element array RKArray that needs to be revealed, then encrypts it using the asymmetric public key pk_C and sends the ciphertext to the chain.

[0023] The content consumer obtains the encrypted key element array RKArray from the chain, and can preliminarily verify whether ctr decryption keys can be recovered. After that, it uses the private key corresponding to pk_C to decrypt, thereby obtaining the key element array, calling the recovery key algorithm RecoverKeys, obtaining the key for decrypting ctr content blocks, and then decrypting the encrypted content blocks to obtain the plaintext of the content blocks. A confirmation is sent to the smart contract, and the smart contract sends the corresponding fee ctr*B_c to the content provider, and the download process is completed.

[0024] Preferably, a verifiable fair distribution protocol specifically includes:

[0025] For a sequence of n pairs, after receiving each content block ciphertext and content block ciphertext signature pair from the sender, the receiver verifies the ciphertext digital signature and sends back a "receipt" containing the content consumer's signature to confirm the sender's bandwidth contribution. After verifying the legitimacy of the "receipt", the sender continues to send the next content block. Either party may terminate the transmission process.

[0026] By dividing the content into equal-sized chunks and numbering them, the sender always uses the latest receipt to calculate how many chunks have been transferred in total and prove their total bandwidth contribution to any validator.

[0027] Preferably, the key tree generation algorithm KTGen obtains a key tree KT, inputs the number of content blocks n, the hash value H_mk of the randomly selected master key mk, and outputs a key tree with n leaf nodes. The structure is specifically as follows:

[0028] Initialize an array KT of length 2n-1. The first value of KT is H_mk. If n is 1, stop the calculation; otherwise, from 0 to n-2, calculate the left child node KT[2i+1] of the node as H(KT[i]||0), and the right child node KT[2i+2] as H(KT[i]||1), and then return the entire secret key tree KT.

[0029] Preferably, the secret key element revealing algorithm RevealKeys takes as input the number of content blocks n, the starting content block subscript ζ, the number of secret keys to be revealed ctr, and the master key hash value H_mk, and outputs an array RKArray for storing the decryption key to be sent to the blockchain for recovering the decryption key. The specific construction is:

[0030] Execute the key tree generation algorithm KTGen to obtain the key tree KT, calculate the subscript start = n + ζ - 2 of the starting content block in the key tree, and if only one content block needs to be decrypted, that is, ctr is 1, then add (start, KT[start]) to the result array RKArray and return it;

[0031] If ctr is 2, the parity of start is further determined. If it is odd, ((start-1) / 2, KT[(start-1) / 2]) is added to the result array RKArray. If it is even, both nodes must be leaf nodes. (start, KT[start]) and (start+1, KT[start+1]) are added to the result array RKArray and returned.

[0032] If the number of content blocks that need to be decrypted ctr is greater than 2, the top nodes of these ctr elements in the key tree KT from the leaf node to the root node are calculated iteratively, and then these nodes are added to RKArray and returned.

[0033] Preferably, the recovery key algorithm RecoverKeys inputs the number of content blocks n, the number of content blocks to be decrypted ctr, and the array RKArray returned by the key element disclosure algorithm, and outputs an array KeyArray of length ctr for storing the key for decrypting the content blocks. The specific structure is:

[0034] For each element in the array RKArray, the key recovery algorithm KTGen is executed to recover its leaf node in the key tree KT, and the value of the leaf node is added to the result array KeyArray and returned.

[0035] Therefore, the present invention adopts the above-mentioned peer-to-peer content distribution and downloading method based on blockchain, and the technical effects are as follows:

[0036] (1) The present invention provides a peer-to-peer content distribution and downloading method based on blockchain. Compared with the traditional centralized content distribution network, the present invention has the advantages of solving the single point problem, eliminating the need to purchase excess bandwidth in advance to handle peak requests, and fully utilizing node bandwidth, which plays an important role in the rapid transmission of content on the Internet.

[0037] (2) The present invention provides a verifiable fair distribution mechanism that can accurately quantify the bandwidth contribution of distributors in a peer-to-peer content distribution network. The fairness of content distributors can be guaranteed, that is, the content distributor will only lose the bandwidth required to send one content block at most. At the same time, the communication rounds in the distribution process are optimized and highly efficient.

[0038] (3) The present invention provides an efficient key derivation method for optimizing storage consumption on the blockchain in a peer-to-peer content distribution network. It can achieve optimized on-chain storage and computing consumption while ensuring content confidentiality during content distribution. Therefore, it is practical and provides technical and design ideas for the implementation of blockchain in a wide range of decentralized application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 for system roles and their relationships;

[0040] Figure 2 A flowchart of a peer-to-peer content distribution and downloading method based on blockchain;

[0041] Figure 3 A verifiably fair distribution protocol;

[0042] Figure 4 It is an example of the key derivation method;

[0043] Figure 5 The total on-chain gas consumption of each participant in the method process;

[0044] Figure 6 Gas consumption on the chain when transmitting different content block sizes;

[0045] Figure 7 The on-chain gas consumption when the number of elements revealed on the chain is different. DETAILED DESCRIPTION

[0046] The technical solution of the present invention is further described below with reference to the accompanying drawings and embodiments.

[0047] Unless otherwise defined, technical or scientific terms used in the present invention shall have the same meaning as commonly understood by one of ordinary skill in the art to which the present invention belongs.

[0048] Example 1

[0049] like Figure 2 As shown, the present invention provides a peer-to-peer content distribution and downloading method based on blockchain, including a preparation stage, a download transmission stage, and a decryption stage;

[0050] Preparation phase: The content provider deploys the smart contract. After the contract is successfully deployed, the content distributor sends a message to the blockchain to join the distribution. The content provider selects one of the participating distributors. The content distributor receives the sequence of content blocks sent by the content provider, verifies its signature, saves it locally after passing the verification, and then sends a confirmation to the blockchain to indicate that the content distribution is ready. The specific steps include:

[0051] The content provider deploys a smart contract, where the contract parameters include the provider's public key pk_P, the unique identifier of the content H_m, the number of content blocks n, the confirmation time T_cf, the fee B_p that the provider will pay to the distributor for each content block distributed, and the fee B_c that the provider will charge to the content consumer for each content block distributed;

[0052] After the contract is successfully deployed, the content distributor joins the distribution by sending a message to the blockchain. The message includes the distributor's public key pk_D.

[0053] The content provider selects one of the participating distributors and then performs the following operations: randomly generates a master key mk. Based on the hash value H_mk of the master key and the number of content blocks n, it calls the key tree generation algorithm KTGen to obtain the key tree KT. The content provider stores mk and KT locally. It then uses the n leaf nodes of KT as the secret key to encrypt each content block. It then signs each encrypted content block to obtain a sequence of content block pairs, which it then sends to the selected content distributor.

[0054] The content distributor receives the sequence of content blocks sent by the content provider, verifies its signature, saves it locally after passing, and then sends a confirmation to the blockchain to indicate that the content is ready for distribution.

[0055] Download and transmission phase: The content consumer sends a download request to the blockchain. After seeing the download request, the content distributor executes a verifiable fair distribution agreement with the content consumer. The content distributor then submits the "receipt" proof to the blockchain smart contract, thereby obtaining the content distribution fee paid by the blockchain to the content distributor. The process includes the following steps:

[0056] The content consumer sends a download request to the blockchain. The parameters included in the message are the content consumer's public key pk_C and the initial download content block subscript ζ. By default, ζ = 1, indicating that the download starts from the first content block.

[0057] The content distributor and content consumer execute a verifiably fair distribution protocol to transmit content. At the end, the content consumer obtains a sequence of (content block ciphertext, content block ciphertext signature) pairs of the content block, while the content distributor receives a "receipt" for the distributed content block.

[0058] The content distributor submits the latest "receipt" to the blockchain, and the smart contract verifies the receipt. If it passes, it automatically calculates the number of content blocks ctr distributed based on the subscript of the content block in the "receipt" and the subscript ζ of the initially downloaded content block, and then automatically sends the corresponding fee ctr*B_p to the content distributor.

[0059] Decryption phase: The content provider sends the encrypted decryption key array to the blockchain. The content consumer obtains the decryption key from the blockchain and decrypts the content. The content consumer then sends a confirmation to the blockchain. Upon receiving the confirmation, the blockchain will automatically pay the content provider the fee immediately or after a period of time if no confirmation is received. The process includes the following steps:

[0060] The content provider calls the secret key element revealing algorithm RevealKeys based on the number of content blocks n, the initial content block subscript ζ, the number of distributed content blocks ctr calculated on the chain, and the master key hash value H_mk. It generates the secret key element array RKArray that needs to be revealed, then encrypts it using the asymmetric public key pk_C and sends the ciphertext to the chain.

[0061] The content consumer obtains the encrypted key element array RKArray from the chain, and can preliminarily verify whether ctr decryption keys can be recovered. After that, it uses the private key corresponding to pk_C to decrypt, thereby obtaining the key element array, calling the recovery key algorithm RecoverKeys, obtaining the key for decrypting ctr content blocks, and then decrypting the encrypted content blocks to obtain the plaintext of the content blocks. A confirmation is sent to the smart contract, and the smart contract sends the corresponding fee ctr*B_c to the content provider, and the download process is completed.

[0062] (1) Verifiable Fair Development Protocol

[0063] In order to ensure fairness to content distributors, it is necessary to quantify the contribution of content distribution. Therefore, a verifiable fair distribution protocol is designed to ensure the quantification of the distributor's bandwidth contribution. The process of this protocol is as follows: Figure 2As shown in the figure, the core idea is: for a sequence of n (content block ciphertext, ciphertext digital signature) pairs, the receiver (i.e., content consumer) verifies the ciphertext digital signature after receiving each pair from the sender (i.e., content distributor). If the verification is successful, the receiver sends back a "receipt" signed by the content distributor to confirm the sender's bandwidth contribution. After verifying the legitimacy of the "receipt," the sender continues to send the next content block. Either party may terminate the transmission process. Considering that the content is divided and numbered according to the same size, the sender can always use the latest receipt to calculate the total number of blocks transmitted and prove its total bandwidth contribution to any verifier.

[0064] (2) Efficient key derivation method

[0065] When a portion of a block is sent to a consumer, the consumer can decrypt and obtain the block using the content provider's decryption key. However, directly transmitting the decryption keys for n content blocks results in a linear storage cost on the chain. To optimize storage consumption on the blockchain, an efficient key derivation method is proposed, which mainly includes three algorithms:

[0066] The key tree generation algorithm KTGen obtains a key tree KT, inputs the number of content blocks n, and the hash value H_mk of the randomly selected master key mk, and outputs a key tree with n leaf nodes. The specific construction is:

[0067] Initialize an array KT of length 2n-1. The first value of KT is H_mk. If n is 1, stop the calculation; otherwise, from 0 to n-2, calculate the left child node KT[2i+1] of the node as H(KT[i]||0), and the right child node KT[2i+2] as H(KT[i]||1), and then return the entire secret key tree KT.

[0068] The secret key element revealing algorithm RevealKeys takes as input the number of content blocks n, the starting content block subscript ζ, the number of secret keys to be revealed ctr, and the master key hash value H_mk. It outputs an array RKArray for storing the decryption key to be sent to the blockchain for recovery. The specific construction is:

[0069] Execute the key tree generation algorithm KTGen to obtain the key tree KT, calculate the subscript start = n + ζ - 2 of the starting content block in the key tree, and if only one content block needs to be decrypted, that is, ctr is 1, then add (start, KT[start]) to the result array RKArray and return it;

[0070] If ctr is 2, the parity of start is further determined. If it is odd, ((start-1) / 2, KT[(start-1) / 2]) is added to the result array RKArray. If it is even, both nodes must be leaf nodes. (start, KT[start]) and (start+1, KT[start+1]) are added to the result array RKArray and returned.

[0071] If the number of content blocks that need to be decrypted ctr is greater than 2, the top nodes of these ctr elements in the key tree KT from the leaf node to the root node are calculated iteratively, and then these nodes are added to RKArray and returned.

[0072] The recovery key algorithm RecoverKeys takes as input the number of content blocks n, the number of content blocks to be decrypted ctr, and the array RKArray returned by the key element disclosure algorithm. It outputs an array KeyArray of length ctr, which is used to store the secret key for decrypting the content blocks. The specific structure is:

[0073] For each element in the array RKArray, the key recovery algorithm KTGen is executed to recover its leaf node in the key tree KT, and the value of the leaf node is added to the result array KeyArray and returned.

[0074] Figure 3 The process of efficient key derivation is illustrated by an example, where: the number of content blocks n = 8, the number of content blocks to be decrypted ctr is 4 (left) and 6 (right), and the subscript ζ of the starting content block is 1 (left) and 2 (right).

[0075] The above method was implemented on-chain based on Solidity, the programming language for Ethereum smart contracts. Python was used to implement the interaction program between each participant and the chain. It was tested on the Ethereum test network. The experimental results are as follows:

[0076] like Figure 5 As shown in the figure, the on-chain Gas consumption of different participants (i.e., content providers, content distributors, and content consumers) during the entire method process is shown. It can be seen that the on-chain Gas consumption of each participant is relatively low.

[0077] like Figure 6 The figure below illustrates on-chain gas consumption when transmitting different content block sizes. Assuming all participants are honest, on-chain gas consumption primarily involves verifying the "receipt" submitted by the content distributor on-chain. In this scenario, regardless of the size of the off-chain content block, on-chain gas consumption remains constant and relatively low.

[0078] like Figure 7The figure below shows the on-chain gas consumption when sending decryption key arrays of different sizes to the blockchain. As the number of elements increases, the on-chain gas consumption also increases due to storage requirements, but the overall number of elements on the chain is at most O(log(n)), where n is the total number of content blocks.

[0079] Therefore, the present invention adopts the above-mentioned blockchain-based peer-to-peer content distribution and downloading method to achieve optimized on-chain storage and computing consumption while ensuring content confidentiality during content distribution. This is practical and provides technical and design ideas for the implementation of blockchain in a wide range of decentralized application scenarios.

[0080] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solutions of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. A peer-to-peer content distribution and downloading method based on blockchain, characterized in that: It includes three stages: preparation stage, download and transmission stage, and decryption stage; Preparation phase: The content provider deploys the smart contract. After the contract is successfully deployed, the content distributor sends a message to the blockchain to join the distribution. The content provider selects one of the participating distributors. The content distributor receives the pair sequence of the content block sent by the content provider, verifies its signature, saves it locally, and then sends a confirmation to the blockchain to indicate that the content is ready for distribution. The pair sequence includes multiple "pairs", each of which includes the ciphertext of the content block and its ciphertext signature. Download and transmission phase: The content consumer sends a download request to the blockchain. After seeing the download request, the content distributor executes a verifiably fair distribution agreement with the content consumer. The content distributor then submits a "receipt" to the blockchain smart contract, thereby obtaining the content distribution fee paid by the blockchain to the content distributor. Decryption phase: The content provider sends the encrypted decryption key array to the blockchain. The content consumer obtains the decryption key from the blockchain and decrypts the content. The content consumer then sends a confirmation to the blockchain. After receiving the confirmation, the blockchain will automatically pay the content provider the fee for providing the content immediately or after a period of time if no confirmation is received. The decryption phase consists of the following steps: The content provider calls the secret key element revealing algorithm RevealKeys based on the number of content blocks n, the initial content block subscript ζ, the number of distributed content blocks ctr calculated on the chain, and the master key hash value H_mk. It generates the secret key element array RKArray that needs to be revealed, then encrypts it using the asymmetric public key pk_C and sends the ciphertext to the chain. The content consumer obtains the encrypted key element array RKArray from the chain, and can preliminarily verify whether ctr decryption keys can be recovered. After that, it uses the private key corresponding to pk_C to decrypt, thereby obtaining the key element array, calling the recovery key algorithm RecoverKeys, and obtaining the key for decrypting ctr content blocks. Then, the encrypted content block is decrypted to obtain the content block plaintext, and a confirmation is sent to the smart contract. The smart contract will pay the corresponding fee ctr B_c is sent to the content provider and the download process is completed; The secret key element revealing algorithm RevealKeys, input content block number n, starting content block subscript ζ, the number of secret keys to be revealed ctr, the master key hash value , output an array RKArray for storing the decryption key to be sent to the blockchain for recovery. The specific construction is: Execute the key tree generation algorithm KTGen to obtain the key tree KT, calculate the subscript start = n + ζ - 2 of the starting content block in the key tree, and if only one content block needs to be decrypted, that is, ctr is 1, then add (start, KT[start]) to the result array RKArray and return it; If ctr is 2, the parity of start is further determined. If it is odd, ((start-1) / 2, KT[(start-1) / 2]) is added to the result array RKArray. If it is even, both nodes must be leaf nodes. (start, KT[start]) and (start+1, KT[start+1]) are added to the result array RKArray and returned. If the number of content blocks that need to be decrypted ctr is greater than 2, the top nodes of these ctr elements in the key tree KT from the leaf node to the root node are calculated iteratively, and then these nodes are added to RKArray and returned.

2. A peer-to-peer content distribution and downloading method based on blockchain according to claim 1, characterized in that: The preparation phase includes the following steps: The content provider deploys a smart contract, where the contract parameters include the provider's public key pk_P, the unique identifier of the content H_m, the number of content blocks n, the confirmation time T_cf, the fee B_p that the provider will pay to the distributor for each content block distributed, and the fee B_c that the provider will charge to the content consumer for each content block distributed; After the contract is successfully deployed, the content distributor joins the distribution by sending a message to the blockchain. The message includes the distributor's public key pk_D. The content provider selects one of the participating distributors and then performs the following operations: randomly generates a master key mk. Based on the hash value H_mk of the master key and the number of content blocks n, it calls the key tree generation algorithm KTGen to obtain the key tree KT. The content provider stores mk and KT locally. It then uses the n leaf nodes of KT as the secret key to encrypt each content block. It then signs each encrypted content block to obtain a sequence of content block pairs, which it then sends to the selected content distributor. The content distributor receives the sequence of content blocks sent by the content provider, verifies its signature, saves it locally after passing, and then sends a confirmation to the blockchain to indicate that the content is ready for distribution.

3. A peer-to-peer content distribution and downloading method based on blockchain according to claim 1, characterized in that: The download transfer phase includes the following steps: The content consumer sends a download request to the blockchain. The parameters included in the message are the content consumer's public key pk_C and the initial download content block index ζ. By default, ζ=1, indicating that the download starts from the first content block. The content distributor and content consumer execute a verifiable fair distribution protocol to transmit content. At the end, the content consumer obtains a paired sequence of content blocks, and the content distributor receives a "receipt" for the distributed content blocks. The content distributor submits the latest "receipt" to the blockchain, and the smart contract verifies the receipt. If it passes, it will be processed based on the subscript of the content block in the "receipt" and the subscript of the content block initially downloaded. ζ , automatically calculate the number of content blocks to be distributed ctr, and then the corresponding cost ctr B_p is automatically sent to the content distributor.

4. A peer-to-peer content distribution and downloading method based on blockchain according to claim 3, characterized in that: Verifiable fair distribution protocol, including: For a pair sequence, after receiving each content block ciphertext and content block ciphertext signature pair from the sender, the receiver verifies the ciphertext digital signature and sends back a "receipt" containing the content consumer's signature to confirm the sender's bandwidth contribution. After verifying the legitimacy of the "receipt", the sender continues to send the next content block. Either party may terminate the transmission process. By dividing the content into equal-sized chunks and numbering them, the sender always uses the latest receipt to calculate how many chunks have been transferred in total and prove their total bandwidth contribution to any validator.

5. A peer-to-peer content distribution and downloading method based on blockchain according to claim 1, characterized in that: The key tree generation algorithm KTGen obtains the key tree KT, inputs the number of content blocks n, and the hash value of the randomly selected master key mk , output a secret key tree, the secret key tree has n leaf nodes, the specific structure is: Initialize an array KT of length 2n-1, the first value of KT is If n is 1, stop the calculation; otherwise, calculate the left child node KT[2i+1] of the node from 0 to n-2. , and the right child node is KT[2i+2] , and then returns the entire key tree KT.

6. A peer-to-peer content distribution and downloading method based on blockchain according to claim 1, characterized in that: The recovery key algorithm RecoverKeys takes as input the number of content blocks n, the number of content blocks to be decrypted ctr, and the array RKArray returned by the key element disclosure algorithm. It outputs an array KeyArray of length ctr, which is used to store the secret key for decrypting the content blocks. The specific structure is: For each element in the array RKArray, the key recovery algorithm KTGen is executed to recover its leaf node in the key tree KT, and the value of the leaf node is added to the result array KeyArray and returned.

Citation Information

Patent Citations

  • Method and system for distribution of digital content in peer-to-peer network

    CN107770115A

  • A cloud data security sharing method based on a block chain

    CN109559124A