Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add data provider consent spec for protocol devs #592

Merged
merged 6 commits into from
Jan 10, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .gitbook/3-protocol-devs/1-dep-specs/3-data-provider-consent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Data Provider Consent

- Status: Draft
- Crated: 2023-01-04
- Modified: 2023-01-04
- Authors
- Youngjoon Lee <yjlee@medibloc.org>
- Gyuguen Jang <gyuguen.jang@medibloc.org>
- Hansol Lee <hansol@medibloc.org>
- Myongsik Gong <myongsik_gong@medibloc.org>
- Inchul Song <icsong@medibloc.org>


## Synopsis

This document is about providing data through [DEP](../../1-users/3-data-exchange/0-about-dep.md).
Before providers provide their data to consumers, the data must be validated from oracle whether the data is the correct data specified in the deal.
Providers can send a request for validation to one of the oracles registered in panacea, and the oracle will validate the data using confidential computing without any exposure of the data.
0xHansLee marked this conversation as resolved.
Show resolved Hide resolved
For the data that has been validated, oracle will issue a certificate to the provider.
0xHansLee marked this conversation as resolved.
Show resolved Hide resolved
Providers can consent to provide their data by submitting the certificate to panacea, and will be rewarded by providing the data.
In all of these processes, the data is transmitted with encryption and stored off-chain.

### Motivation

Data should be provided by providers based on their data ownership, and the reward should be distributed in transparent and fair manner.
To do so, providers use digital signature as consent to provide the data.

### Definitions

- `Data Provider`, `Data Consumer`, and `Oracle` are defined in [User Flow](./1-user-flow.md)
- `Deal` is defined in [Data Deal](./2-data-deal.md)
- `Certificate`: a certificate that the data is validated to be provided to the deal, which is issued by oracle.

## Technical Specification

Before provider provides the data to deal, data should be validated by the oracle.
If the data is successfully validated to be provided, the provider will have a `Certificate` like below (more about [Data Validation](./4-data-validation.md)):

```proto
message Certificate {
UnsignedCertificate unsigned_certificate = 1;
bytes signature = 2;
}

message UnsignedCertificate {
string cid = 1;
string unique_id = 2;
string oracle_address = 3;
uint64 deal_id = 4;
string provider_address = 5;
string data_hash = 6;
}
```

Using the `Certificate`, provider can submit consent to provide the data.

```proto
message MsgSubmitConsent {
Consent consent = 1;
}

message Consent {
Certificate certificate = 1;
}
```

When this consent is submitted, blockchain will check:
- if the data is provided by the owner of the data
- if the data is validated by a registered and active oracle
- if the data is provided in duplicate

If all checks pass, rewards are distributed to the provider and oracle(more about [incentive](./6-incentives.md)).
0xHansLee marked this conversation as resolved.
Show resolved Hide resolved

## Backwards Compatibility

Not applicable.

## Forwards Compatibility

Not applicable.

## Example Implementations

Coming soon.

## Other Implementations

None at present.

## History

- 2023-01-04: Initial draft finished

## Copyright

All content herein is licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).