# Peer-to-Peer Data Sharing

## Background

Centralized platforms like YouTube, Instagram, TikTok, and Patreon have been central to the Creator Economy, enabling creators to monetize their content through ads, sponsorships, and fan support. However, these platforms come with significant drawbacks, such as dependency on the platform, revenue-sharing models, and limited ownership of content.

On the flip side, existing Web3 creator platforms struggle to provide true censorship resistance and data value sharing due to the lack of data confidentiality on transparent blockchains. This issue discourages creators from sharing valuable content with paying customers, as sensitive data on the blockchain is exposed.

One solution is to create a peer-to-peer data-sharing application on the blockchain that ensures confidentiality through cryptographic measures. In this case, the data-sharing process would be fully executed via smart contracts, ensuring transaction atomicity. To maintain confidentiality, the data is encrypted and stored on decentralized storage, with access granted to paying customers only after FHE (Fully Homomorphic Encryption) computation on the encrypted data.

## Multi-key FHE Solution

The general workflow of peer-to-peer data sharing, integrated with BAVO's zkFHE network, can address this issue. A key aspect is that the data provider should not use their own encryption key, as this would involve them in the sharing process and create unnecessary dependencies. Likewise, outsourcing encryption to a single third party using their public key compromises data confidentiality. Instead, a more secure approach is to have the data provider encrypt the data using multiple public keys from a designated group, thereby reducing the need for trust. This is where Multi-key FHE comes into play.

![alt text](https://docs.padolabs.org/assets/images/usecase-datasharing-80f35d5488b5698fc4731a21e5c84743.png)

\


## Encrypt Data

Imagine a dApp offering peer-to-peer data-sharing features for its users. The data provider interacts with the dApp to obtain a set of public keys from the zkFHE network, which are then used to encrypt the data. A hybrid encryption approach is recommended: the data is encrypted with a symmetric encryption key (K), and the shares of K are encrypted with multiple public keys using zkFHE algorithms.

The encrypted data is then stored on a storage system, which could be a decentralized storage blockchain or even a centralized service.

## Share Encrypted Data

A data consumer uses the dApp to send crypto assets to the contract, along with their public key for decrypting the shared data. The dApp contract assigns the computation task to the network, using the consumer's public key to ensure that only they can decrypt the result.

After the FHE computation is completed, the result is a new ciphertext, now encrypted with the consumer's public key. The consumer receives this result and decrypts it locally, allowing them to recover the original data in plain text.
