# FaDe: A Blockchain-Based Fair Data Exchange Scheme for Big Data Sharing
## 4 Proposed Scheme
### Enhancement  
We usually assume that participants in protocols are trustworthy. If this assumption is avoided, that is, [PERSON] and [PERSON] may be malicious or misbehave, we need to enhance the proposed scheme, especially in the absence of any trusted third party. More analysis details are listed as follows:  
1. _Malicious Data Owner_: This can be defended against in the current version. For example, [PERSON] provides invalid data that [PERSON] does not want to buy to cheat [PERSON], after she obtains money from [PERSON]. In the _Randomly Choosing and Verifying_ stage, [PERSON] has to provide partial data that is selected by [PERSON] randomly, so [PERSON] can verify those data to determine whether he will continue. In the _Paying_ stage, if [PERSON] wants to attain money from the BTC address, she must provide the rest of the secret keys. 2. _Malicious Data Buyer_: This can be defended against in the current version but is still not perfect. For example, [PERSON] wants to obtain all data without payment. In the current version, [PERSON] can suspend transactions at any time without any penalty. Once the transaction is aborted, [PERSON] can obtain a small portion of keys, which is able to decrypt the corresponding part of data (the part of data which is read by [PERSON] for random inspection). However, with regard to [PERSON], the leakage of this part of the data does not affect the value of the overall data to be traded. 3. _Eavesdropper_: This can be defended against in the current version. In the paying stage, all data are public and can be accessible to anyone. Although an eavesdropper can obtain all of the remaining keys, as long as the security of the private channels between [PERSON] and [PERSON] that they used to communicate in the Data Preprocessing stage is guaranteed, the leakage of encryption keys will not cause data leakage relative to the entire system. 4. _Denial of Service_: Because anyone can initiate a deal with [PERSON] and can terminate the deal at any time during the transaction without any cost, multiple fake buyers are deployed by attackers to initiate transaction requests, with the purpose of consuming [PERSON]'s computing resources, which may cause a denial of service attack. It is an inherent risk since no centralized admission exists for regulating buyers' behaviors. In summary, the main drawback of the current version of fair payment protocol is that [PERSON] can terminate the transaction at any time without any cost. Therefore, we proposed an enhancement for the protocol, which has two advantages compared to the aforementioned protocol as follows:  
1. [PERSON] provides [PERSON] with a margin to justify that he is not a malicious attacker. 2. The single payment is changed to multiple payments, which allows [PERSON] to confirm whether the data provided by [PERSON] guarantee [PERSON]'s demand. The Improved Fair Payment Protocol contains five stages, which are _Guaranteeing_, _Data Preprocessing_, _Randomly Choosing and Verifying_, _Paying_, and _Data Confirming_. Stage I: Guaranteeing  
In this stage, [PERSON] needs to submit a TxGuarantee transaction that mainly makes bit coins be unspendable for a period of time. The specific processes are shown as follows:  
1. [PERSON] first generates a TxGuarantee transaction, which requires [PERSON]'s signatures for the corresponding redemption transaction script. A TxRedemp transaction is generated to redeem his money, in which the lock time of the transaction is set to \(T\), and his signature is added to the input script of the transaction. Finally, [PERSON] sends the TxRedemp transaction to [PERSON]. 2. When [PERSON] receives the TxRedemp transaction, she needs to verify [PERSON]'s signature first, and then confirms the lock time. If they are correct, [PERSON] adds her signature to the input script of TxRedemp transaction. Finally, [PERSON] sends the TxRedemp transaction to [PERSON]. 3. After [PERSON] receives the TxRedemp transaction, he checks the lock time and two signatures.