# Vouch Data Protocol
Status: Draft (Version 0.2)
## Abstract
Vouch Data Protocol provides guidance on how sybil resistence can be implemented on the permaweb.
## Motivation
To provide a decentralized approach to Sybil resistance.
What is Sybil resistence?
Sybil resistance refers to the ability of a network, system, or protocol to withstand or mitigate the effects of Sybil attacks. In a Sybil attack, an attacker subverts the network by creating a large number of pseudonymous identities to gain a disproportionately large influence. This type of attack is named after the book "Sybil," which discusses a case of multiple personality disorder, reflecting the creation of many fake identities by the attacker.
The Vouch Protocol allows any arweave wallet or ao process to `Vouch-For` another wallet address. The `Vouch-DAO` members can stake and vote their tokens in the confidence of the `Voucher` Wallet Address. The `Voucher` is a service that uses an identity method to vouch the wallet address.
> An example of a Voucher is a twitter service that vouches address when a wallet is associated with a twitter account.
## Specifications
In this protocol there are sets of Tags that drive functional triggers to the VouchDAO (ao) Process.
### Vouch-For
These sets of Tags are used by the Voucher to Vouch a Wallet Address.
| Tag Name | _Optional?_ | Tag Value |
|---|---|---|
| Vouch-For | False | {Wallet Address} |
| Data-Protocol | False | Vouch |
| Variant | False | 0.2 |
| Method | False | (eg. Twiter\|In-Person\|Recaptcha\|Discord\|KYC) |
| Identifier | True | (eg. Username\|Name\|Email\|...) |
| Confidence-Value | True | ({Amount}-{Currency}) eg. 100-USD |
| Expiration | True | Unix Timestamp |
| Country | True | Country Code |
This is an arweave data-item, that can be submitted to the VouchDAO Process using the `Target` property or via `Assign` feature.
### Get-Vouches
A permaweb application or ao process can send a `Get-Vouches` messsage to VouchDAO with a Wallet Address and in return recieve a message containing a JSON data-set.
| Tag Name | _Optional?_ | Tag Value |
|---|---|---|
| Action | False | Get-Vouches |
| ID | False | {Vouch Address or Sub Account ID} |
**Response**
Specification
```json
{
"type": "object",
"properties": {
"Vouches-For": {
"type": "string",
"description": "Address"
},
"Total-Value": {
"type": "string",
"description": "{Number}-{Currency/Token} example 100-USD"
},
"Values": {
"type": "array",
"description": "One or more values by currency",
"items": {
"type": "string",
"description": "{Number}-{Currency/Token}"
}
},
"{Method}-Value": {
"type": "number",
"description": "Value specifically focused on KYC"
},
"{Method}-Confidence": {
"type": "number",
"description": "Percentage Confidence from Staked Members 0.XX"
},
"/comment": "For every vouch method (Value, Confidence) MUST be provided",
"Vouchers": {
"type": "record",
"key": "{Voucher Address}",
"value": {
"type": "object",
"properties": {
"Method": {
"type": "string",
"description": "Method used to Vouch Address"
},
"Identifier": {
"type": "string",
"description": "username, handle, email",
"optional": true
},
"Value": {
"type": "string",
"description": "{Number}-{Currency/Token} example 100-USD"
},
"Country": {
"type": "string",
"description": "Country Code",
"optional": true
}
}
}
},
"Sub-IDs": {
"type": "array",
"items": {
"type": "string",
"description": "ao process ids that belong to this vouched wallet address"
}
}
}
}
```
### List-Vouchers
Lists all the Vouchers for the DAO, this ao Message Type provides a JSON list of Voucher Services that can be used by staking parties to set the confidence.
| Tag Name | _Optional?_ | Tag Value |
|---|---|---|
| Action | False | List-Vouchers |
**Response**
Specification
```json
{
"type": "record",
"key": "Voucher Address",
"value": {
"type": "object",
"properties": {
"Method": {
"type": "string",
"description": "(eg. Twiter\|In-Person\|Recaptcha\|Discord\|Kycer)"
},
"Confidence": {
"type": "number",
"description": "0.00 to 1.00 a percentage of confidence"
}
}
}
}
```
### Set-Confidence
Staked members of VouchDAO are allowed to `Set-Confidence` score between 0..1 for any `Voucher` wallet address. This Confidence score will help give the applications a clear signal to the strength of the Voucher.
| Tag Name | _Optional?_ | Tag Value |
|---|---|---|
| Action | False | Set-Confidence |
| ID | False | Voucher Wallet Address |
| Confidence | False | 0..1 |
> NOTE: This is an `ao` Message that is assigned to the VouchDAO Process
### Stake
As a VouchDAO Token holder you can `Stake` your tokens to be able to set confidence for `Vouch-For` services.
| Tag Name | _Optional?_ | Tag Value |
|---|---|---|
| Action | False | Stake |
| Quantity | False | {Tokens} |
| UnstakeDelay | False | {Height} |
### Unstake
As a VouchDAO Token holder you can `Unstake` your tokens.
| Tag Name | _Optional?_ | Tag Value |
|---|---|---|
| Action | False | Unstake |
| Quantity | False | {Tokens} |
### Add-ID
A Vouched Wallet Address MUST be able to add a Sub-ID using the `Add-ID` ao Message.
| Tag Name | _Optional?_ | Tag Value |
|---|---|---|
| Action | False | Add-ID |
| Sub-ID | False | {Process ID} |
### Business logic
The core business logic is to calculate the `Estimated-Value` for a given `Voucher`.
```
We take the dollar value provided by the Voucher for
the given `Vouch` address and multiply by the mean
confidence score provided by all staked members.
VoucherValue * (SUM(StakerConfidenceInVoucher) / {total number of stakers})
```
### Implementation Details
For this implementation, we will use AOS-SQLite.
Table Schema
## VoucherConfidence
| Column | Type | Description |
| ------- | ---- | ----- |
| ID | INT PRIMARY KEY | Primary Key |
| Voucher | TEXT | The wallet address of the voucher |
| Staker | TEXT | The wallet address of the staker |
| ConfidenceScore | INTEGER | 0 - 100 score for confidence |
## Vouched
| Column | Type | Description |
| ------- | ---- | ----- |
| ID | INT PRIMARY KEY | Primary Key |
| VouchFor | TEXT NOT NULL | Address being vouched |
| Voucher | TEXT NOT NULL | Voucher Address |
| Method | TEXT NOT NULL | Method for vouch |
| Identifier | TEXT | Optional Identifier |
| Country | TEXT | Optional Country |
| Updated | INTEGER | Unix Timestamp of last update |
| ConfidenceValue | TEXT | {Number}-{Currency} |
`UNIQUE(Vouch-For, Voucher)`
## Sub-IDs
| Column | Type | Description |
| ------- | ---- | ----- |
| ID. | INT PRIMARY KEY | Primary Key |
| SublID | TEXT | Address of sub account |
| VouchAddress | TEXT | Address of parent |
| Updated | INTEGER | Unix Timestamp of last update |