# Innovative Application of Blockchain Technology for Digital Recipe Copyright Protection
## 3 Schematic Design
### System Design
#### 3.2.2 Blockchain Data Upload and Download
When an unauthorized use event occurs, [PERSON] can quickly retrieve all transaction records related to her in the side chain through the smart contract \"TransactionQueryContract\" using the recipe ID and her public key as input. This has important implications for copyright protection because the information on the side chain can be used as legally valid evidence to prove her ownership if there is any dispute. All transactions are timestamped with the involved parties' public keys, confirming that at a particular point in time, [PERSON]'s recipes were downloaded by a specific user. In addition, because these records are on the blockchain, they are immutable, which provides strong evidence for resolution of copyright disputes. The proposed solution ensures the integrity, authenticity, security, and availability of recipes while protecting the copyright of the creators. Data flow from one node to another in the network, each with specific tasks and functions. Through the collaborative work ofthese smart contracts and nodes, the blockchain network effectively protects the creators' copyrights and provides users with a convenient recipe download service. ```
0:\(Pub_{\text{alice}}\), \(Priv_{\text{alice}}\), \(recipe\), \(Meta_{\text{data}}\)
0: Transaction receipt or Null
1: [PERSON] creates a new recipe: \(recipe\), \(Meta_{\text{data}}\)
2: [PERSON] signs the recipe using her private key: \(Sig_{\text{alice}}\leftarrow\text{Sign}(Priv_{\text{alice}},recipe)\)
3: [PERSON] encrypts the recipe using her public key: \(Enc_{\text{recipe}}\leftarrow\text{Encrypt}(Pub_{\text{alice}},recipe)\)
4: Send \(Enc_{\text{recipe}}\), \(Sig_{\text{alice}}\), \(Meta_{\text{data}}\) to the main chain node
5:\(isDuplicate\leftarrow\text{CheckDuplicate}(Enc_{\text{recipe}})\)
6:if\(isDuplicate\) is False then
7: Store the recipe on IPFS: \(Hash_{\text{recipe}}\leftarrow\text{StoreOnIPFS}(Enc_{\text{recipe}})\)
8: Send \(Hash_{\text{recipe}}\), \(Publ_{\text{alice}}\), \(Sig_{\text{alice}}\), \(Meta_{\text{data}}\) to the main chain node
9: Store \(Hash_{\text{recipe}}\), \(Pub_{\text{alice}}\), \(Sig_{\text{alice}}\), \(Meta_{\text{data}}\) on the blockchain using DataStorageContract
10: Return transaction receipt
11:else
12:return Null
13:endif
```  
**Algorithm 1** RecipeUploadContract  
```
0:\(Pub_{\text{requester}}\), \(ID_{\text{recipe}}\), \(Cert_{\text{requester}}\)
0: Encrypted Recipe or Null
1: User sends request: \(req_{\text{reester}}\), \(ID_{\text{recipe}}\), \(Cert_{\text{requester}}\)
2:\(isVerified\leftarrow\text{VerifySignature}(Cert_{\text{requester}},Pub_{\text{ requester}})\)
3:if\(isVerified\) is True then
4:\(hasPermission\leftarrow\text{CheckPermission}(ID_{\text{recipe}},Pub_{\text{ requester}})\)
5:if\(hasPermission\) is True then
6:\(hash_{\text{recipe}}\leftarrow\text{RetrieveHash}(ID_{\text{recipe}})\)
7:\(Enc_{Pub_{\text{alice}}}(recipe)\leftarrow\text{RetrieveRecipe}(hash_{\text{recipe}})\)
8:\(rk_{\text{alice},\text{requester}}\leftarrow\text{GenerateReKey}(Pub_{\text{alice}},Pub_{\text{ requester}})\)
9:\(Enc_{Pub_{\text{requester}}}(recipe)\leftarrow\text{ReEncrypt}(Enc_{Pub_{ \text{alice}}}(recipe),rk_{\text{alice},\text{requester}})\)
10: Send \(Enc_{Pub_{\text{requester}}}(recipe)\) to \(req_{\text{reester}}\)
11: Store the transaction details in sidechain: \(ID_{\text{recipe}}\), \(Pub_{\text{alice}}\), \(Pub_{\text{requester}}\), timestamp
12:else
13:return Null
14:else
15:endif
```  
**Algorithm 2** RecipeDownloadContract  
Figure 2: System network architecture diagram.