# Blockchain and Smart Contracts for Digital Copyright Protection
## 6 Security Analysis
#### Analysis  
The security of the protocol is tied to the execution of two smart contracts, namely \(sm_{s}\) and \(sm_{p}\) (see Table 2 and Figure 1).  
\(sm_{s}\) receives tokens referring to the content to purchase (\(X_{d}\)), the current transaction (\(T_{X}\)), and the buyer's identity (\(B_{id}\)) from two distinct sources: \(\mathcal{B}\) and \(\mathcal{CP}\). As reported in Section 5.1, only if the received tokens coincide and were not used in previous purchase transactions, \(sm_{s}\) continues execution. As a result, the \(SBlock\) is created. It securely encapsulates all the tokens needed to protect the content to purchase, such as the one-time encryption keys and the watermark to be embedded into the content.  
After the watermark insertion, the tokens included in \(SBlock\) must be confirmed by \(\mathcal{B}\) and \(\mathcal{CP}\) in messages \(m_{7}\) and \(m_{8}\) to activate \(sm_{s}\). Only if the received tokens coincide, \(sm_{p}\) securely encapsulates the tokens in \(PBlock\) and definitively publishes this block in \(\mathcal{BC}\), thus validating the purchase transaction. In other words, the publication of \(PBlock\) in \(\mathcal{BC}\) guarantees that \(\mathcal{B}\) and \(\mathcal{CP}\) have both confirmed the tokens published in the block and that such tokens unambiguously identify the purchase transaction.  
Suppose that \(\mathcal{B}\) is corrupt. \(\mathcal{B}\) provides only the single token \(B_{id}\), which is assumed to be valid since the problems of false identity are out of the scope of this paper. The other tokens managed by \(\mathcal{B}\) are only received and re-sent. They are created by the other entities involved in the protocol, namely \(\mathcal{CP}\) and \(\mathcal{BC}\). Therefore, if \(\mathcal{B}\) tries to alter the received tokens, the smart contracts can disclose the attempt since \(\mathcal{CP}\) and \(\mathcal{BC}\) are in a position to disclaim the altered tokens. As a consequence, smart contracts can abort the purchase transaction without releasing any content, according to what is reported in Section 6.  
Suppose that \(\mathcal{CP}\) is corrupt. Unlike \(\mathcal{B},\mathcal{CP}\) plays a more relevant role in the purchase transaction since it generates two tokens, namely \(X_{d}\) and \(T_{X}\), and takes charge of embedding the watermark into the content to protect. Therefore, \(\mathcal{CP}\) can behave maliciously. However, based on what is reported above, two main constraints are imposed by the protocol due to the smart contracts:  
1. \(\mathcal{CP}\) cannot reuse tokens employed in previous transactions;
2. \(\mathcal{CP}\) cannot alter or change the watermark generated by \(sm_{s}\) by reusing, for example, watermarks employed in previous transactions.  
In the former case, the reuse of tokens is disclosed by \(sm_{s}\), which carries out a specific check.  
In the latter case, the content \(X\) ends up being protected by a watermark different from that encapsulated in \(PBlock\) and published in \(\mathcal{BC}\). Therefore, the protected content \(\bar{X}\) cannot be correctly tied to any buyer, thus preventing anybody from being adjudicated as a traitor. As reported in Section 6, the malicious behavior of \(\mathcal{CP}\) just turns against itself.  
The smart contracts \(sm_{s}\) and \(sm_{p}\) can secure the protocol without resorting to a TTP. This condition is mainly due to several specific characteristics of the smart contracts. Firstly, they can autonomously execute preset and unchangeable actions when given events are triggered under specific conditions. Therefore, their behavior cannot be modified. Furthermore, they can carry out specific checks on the tokens exchanged among the entities involved in the protocol by exploiting the public ledger implemented by \(\mathcal{BC}\). Finally, they can use the secret block \(SBlock\) and the public block \(PBlock\) to prevent \(\mathcal{B}\) and \(\mathcal{CP}\) from maliciously altering or reusing tokens.