Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
105 changes: 102 additions & 3 deletions AMS-0001/AMS-0001.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ Json data MUST comply with following json schema:
"community"
]
},
"e": {
"$id": "#/properties/encryptionAddress",
"type": "string",
"minLength": 1,
"maxLength": 50,
"title": "Encryption address",
"description": "The encryption address for encyption purposes according to Extension 3 of the specifications.",
"default": "",
"examples": [
"56N75BOUSBSJALOWRQMJ7BU5JZHTEQCJP2PXHUCUXVOQJ4FPIKISV3UQB4"
]
},
"o": {
"$id": "#/properties/o",
"type": "object",
Expand Down Expand Up @@ -203,11 +215,11 @@ avote-question/v1:j{"t":"Best project","q":"Decide which project is the best\nA

### Cast vote

Question is the message stored on the blockchain.
Vote cast is the message stored on the blockchain.

The blockchain message MUST be self signed message, with amount 703 of basic tokens with specific note structure described below.

Question starts with ```avote-vote/v1/{ShortQuestionId}:j``` according to ARC-0002, following the json data.
Vote cast starts with ```avote-vote/v1/{ShortQuestionId}:j``` according to ARC-0002, following the json data.

ShortQuestionId is the tx id of the message with the question for which this vote is answer. ShortQuestionId must be upper case substring from zero with length of 10 characters.

Expand Down Expand Up @@ -485,6 +497,14 @@ Json data MUST comply with following json schema:
"CRID3AHJGGVE75UTDO5GI7PXM6PUD6WXB7BTAD3IPWFTMUXUKHDA"
]
},
"e": {
"$id": "#/properties/encryption-private-key",
"type": "string",
"title": "Mnemonic of the encyption account for public voting validation",
"examples": [
{"fuel flock song credit cloud collect security danger knife fluid analyst roast short pizza more kingdom copy judge leave resist sock change wheel able story"}
],
},
"r": {
"$id": "#/properties/r",
"type": "object",
Expand Down Expand Up @@ -558,5 +578,84 @@ Json data MUST comply with following json schema:

Example:
```
avote-vote/v1/CRID3AHJGG:j{"q":"CRID3AHJGGVE75UTDO5GI7PXM6PUD6WXB7BTAD3IPWFTMUXUKHDA","a":{"A":35,"B":73,"C":20}}
avote-result/v1/CRID3AHJGG:j{"q":"CRID3AHJGGVE75UTDO5GI7PXM6PUD6WXB7BTAD3IPWFTMUXUKHDA","r":{"sbr":{"A":3500.1,"B":7300.1,"C":2000.1},"qbr":{"A":3000.1,"B":7000.1,"C":2000.1},"ssar":{"A":50.1,"B":30.1,"C":40.1},"qsar":{"A":50.1,"B":30.1,"C":40.1},"stlr":{"A":5.1,"B":2.1,"C":1.1},"qtlr":{"A":5.1,"B":2.1,"C":1.1}}}
```


### Extension 3 - Encrypted voting

Purpose of the encrypted voting is to hide voter cast while the voting session is in progress.

Questioner for each question generates new Ed25519 mnemonic and stores it securly. Public key of this encryption account is called Question public key. If encryption of the messages is allowed, he publish encryption account address in the question message.

Curve25519XSalsa20Poly1305 is used to encrypt data. Voter encrypts the data in form of https://scholtz.github.io/AMS/AMS-0001/avote-vote.json and produces the json with the https://scholtz.github.io/AMS/AMS-0001/avote-vote-enc.json schema.

Encrypted vote cast is the message stored on the blockchain.

The blockchain message MUST be self signed message, with amount 703 of basic tokens with specific note structure described below.

Encrypted vote cast starts with ```avote-vote-enc/v1/{ShortQuestionId}:j``` according to ARC-0002, following the json data.

Questioner MAY publish his encryption keys to specific auditing account using ARC-0015 starndard. The content of the message is the mnemonic of the encryption account.

Questioner MAY publish the mnemonic of the encrypting account to the restult message. The questioner SHOULD publish the policy on weather he plans to publish the private encryption key on his website or in the question.


Json data MUST comply with following json schema:

```
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://scholtz.github.io/AMS/AMS-0001/avote-vote-enc.json",
"type": "object",
"title": "Vote cast schema",
"description": "Knowledge based pure democracy answer JSON document in encrypted form.",
"default": {},
"examples": [
{"nonce":"ftGVJfrKJg+PPNCMbKPdLMN3OKNNnHDk","otPK":"w955HlFMM4e9dD1OQv31k4npHhs/w4QWc5Q1tcjxFkM=","cT":"O+M+3Y78RdxnMD6mJfNrfi8eT7dKmAFxJCq4z8Zb/lob+7tWptW1hPQWe60lmT64YLNdMSrPd9N0Wszr6AQFar5jbekHmM/YME/FEf4FjpYBLOwXK54MNy+8LOORNp1f"}
],
"required": [
"nonce",
"otPK",
"cT"
],
"properties": {
"nonce": {
"$id": "#/properties/nonce",
"type": "string",
"title": "Nonce",
"description": "Base64 data of random number. Byte length: nacl.box.nonceLength. const nonce = nacl.randomBytes(nacl.box.nonceLength);",
"examples": [
"ftGVJfrKJg+PPNCMbKPdLMN3OKNNnHDk"
],
"additionalProperties": false
},
"otPK": {
"$id": "#/properties/otPK",
"type": "string",
"title": "Encryption public key",
"description": "Public key of randomly generated key pair when encoding the message. const otKeyPair = nacl.box.keyPair();",
"examples": [
"w955HlFMM4e9dD1OQv31k4npHhs/w4QWc5Q1tcjxFkM="
],
"additionalProperties": false
},
"cT": {
"$id": "#/properties/cT",
"type": "string",
"title": "Cipher text",
"description": "Public key of randomly generated key pair when encoding the message. const cipherText = nacl.box(Buffer.from(encMsg),nonce,rcptPubKey,otKeyPair.secretKey)",
"examples": [
"O+M+3Y78RdxnMD6mJfNrfi8eT7dKmAFxJCq4z8Zb/lob+7tWptW1hPQWe60lmT64YLNdMSrPd9N0Wszr6AQFar5jbekHmM/YME/FEf4FjpYBLOwXK54MNy+8LOORNp1f"
],
"additionalProperties": false
}
},
"additionalProperties": false
}
```

Example:
```
avote-vote-enc/v1/XIP4Y7NMP2:j{"nonce":"ftGVJfrKJg+PPNCMbKPdLMN3OKNNnHDk","otPK":"w955HlFMM4e9dD1OQv31k4npHhs/w4QWc5Q1tcjxFkM=","cT":"O+M+3Y78RdxnMD6mJfNrfi8eT7dKmAFxJCq4z8Zb/lob+7tWptW1hPQWe60lmT64YLNdMSrPd9N0Wszr6AQFar5jbekHmM/YME/FEf4FjpYBLOwXK54MNy+8LOORNp1f"}
```
49 changes: 49 additions & 0 deletions AMS-0001/avote-vote-enc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://scholtz.github.io/AMS/AMS-0001/avote-vote-enc.json",
"type": "object",
"title": "Vote cast schema",
"description": "Knowledge based pure democracy answer JSON document in encrypted form.",
"default": {},
"examples": [
{"nonce":"ftGVJfrKJg+PPNCMbKPdLMN3OKNNnHDk","otPK":"w955HlFMM4e9dD1OQv31k4npHhs/w4QWc5Q1tcjxFkM=","cT":"O+M+3Y78RdxnMD6mJfNrfi8eT7dKmAFxJCq4z8Zb/lob+7tWptW1hPQWe60lmT64YLNdMSrPd9N0Wszr6AQFar5jbekHmM/YME/FEf4FjpYBLOwXK54MNy+8LOORNp1f"}
],
"required": [
"nonce",
"otPK",
"cT"
],
"properties": {
"nonce": {
"$id": "#/properties/nonce",
"type": "string",
"title": "Nonce",
"description": "Base64 data of random number. Byte length: nacl.box.nonceLength. const nonce = nacl.randomBytes(nacl.box.nonceLength);",
"examples": [
"ftGVJfrKJg+PPNCMbKPdLMN3OKNNnHDk"
],
"additionalProperties": false
},
"otPK": {
"$id": "#/properties/otPK",
"type": "string",
"title": "Encryption public key",
"description": "Public key of randomly generated key pair when encoding the message. const otKeyPair = nacl.box.keyPair();",
"examples": [
"w955HlFMM4e9dD1OQv31k4npHhs/w4QWc5Q1tcjxFkM="
],
"additionalProperties": false
},
"cT": {
"$id": "#/properties/cT",
"type": "string",
"title": "Cipher text",
"description": "Public key of randomly generated key pair when encoding the message. const cipherText = nacl.box(Buffer.from(encMsg),nonce,rcptPubKey,otKeyPair.secretKey)",
"examples": [
"O+M+3Y78RdxnMD6mJfNrfi8eT7dKmAFxJCq4z8Zb/lob+7tWptW1hPQWe60lmT64YLNdMSrPd9N0Wszr6AQFar5jbekHmM/YME/FEf4FjpYBLOwXK54MNy+8LOORNp1f"
],
"additionalProperties": false
}
},
"additionalProperties": false
}