Skip to content

Commit

Permalink
Update MIP-0001.
Browse files Browse the repository at this point in the history
As #1 called for, this updates 
the Recipient Form with a memo field, as well as the difficulty 
specifications.
  • Loading branch information
kayabaNerve committed Mar 25, 2020
1 parent 7fd1a02 commit 8b2e128
Showing 1 changed file with 14 additions and 31 deletions.
45 changes: 14 additions & 31 deletions MIP-0001.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Status: Draft

### Abstract

This proposal details a decentralized fund in order to fund Meros's development ad infinitum. Every six months, a vote is held in order to determine who should receive the fund. Voters assign a score of 1 to 100 for potential recipients they believe deserve funding. The voter's assigned scores must total 100. The recipient's actual score is the weighted median of their assigned scores, where the weight is the amount of MR behind each assigned score. The recipients' scores are then normalized to be out of 100. This normalized score represents the percentage of the fund the recipient will receive. The fund's payout is equivalent to 5% of the last period's average Block reward, and every 1008 Blocks (every week) a lump sum is paid out.
This proposal details a decentralized fund in order to fund Meros's development ad infinitum. Every six months, a vote is held in order to determine who should receive the fund. Voters assign a score of 1 to 100 for potential recipients they believe deserve funding. The voter's assigned scores must total 100. The recipient's actual score is the weighted median of their assigned scores, where the weight is the amount of MR behind each assigned score. The recipients' scores are then normalized to be out of 100. This normalized score represents the percentage of the fund the recipient will receive. The fund's payout is equivalent to 5% of the average Block reward, including rewards which were never paid out due to a lack of Verifications, since the previous voting period ended (exclusive) to when the current voting period starts (exclusive). A lump sum is paid out every 1008 Blocks (every week).

### Motivation

Expand Down Expand Up @@ -54,39 +54,33 @@ The normalized score represents what percent of the fund that recipient receives

Every Form has the following fields:

- hash: A hash used for the signature and difficulty.
- period: Voting period this Form is designated for.
- signature: Ed25519 Signature.
- signature: Ed25519 Signature created by signing the hash.
- proof: Work that proves this isn't spam.

##### Recipient

Recipient Forms are used to declare a key as an eligible recipient for this voting period, and have the following additional field:
Recipient Forms are used to declare a key as an eligible recipient for this voting period, and have the following additional fields:

- key: Ed25519 key.
- maximum: Maximum percentage which can be received.
- memo: A memo, up to 256 bytes long, which is enforced a single byte provided for the length in the serialization.

If the maximum is set to 0, there is no maximum. The maximum must be less than 99.
If the maximum is set to 0, there is no maximum. The maximum must be less than, or equal to, 99.

Recipient Forms use a prefix of "\xFE" in the contents Merkle. Its signature is formed by signing `"\xFE" + period + key + maximum`, where `period` takes up 2 bytes, `key` takes up 32 bytes, and `maximum` takes up 1 byte.
Recipient Forms use a prefix of "\xFE" in the contents Merkle. Their hashes are defined as `Blake2b-256("\xFE" + period + key + maximum + memo)`, where `period` takes up 2 bytes, `key` takes up 32 bytes, `maximum` takes up 1 byte, and `memo` is of a variable length.

The proof is only valid if:

```
max = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
difficulty = max - (max / 10000)
Argon2d(
iterations = 1,
memory = 8,
parallelism = 1,
data = hash of the block which started the voting period || signature,
salt = proof left padded to be 8 bytes long
) > difficulty
factor = (104 + memo.length) / 104
spam(hash, proof, 10000 * factor)
```

When a Recipient Form is archived on the Blockchain, the recipient number is incremented and then assigned to the newly eligible recipient.

`Recipient` has a message length of 104 bytes; the 2-byte period number, the 32-byte Ed25519 key, the 64-byte Ed25519 signature, and the 4-byte proof.
`Recipient` has a variable message length; the 2-byte period number, the 32-byte Ed25519 key, 1-byte maximum, the 1-byte memo length (where the length is the byte's value plus one), the variable-length memo, the 64-byte Ed25519 signature, and the 4-byte proof.

##### Vote

Expand All @@ -97,29 +91,18 @@ Vote Forms are used to vote for who should actually receive the Fund for until t

The sum of all votes must equal 100. All votes must be less than or equal to the recipient's maximum. If a vote was for recipient 0, the vote is for no one to receive those funds. Whatever percent of the funds recipient 0 wins will not be minted.

Vote Forms use a prefix of "\xFD" in the contents Merkle. Its signature is formed by signing `"\xFD" + period + keys.length + key[0] + ... + key[n] + votes.length + votes[0] + ... + votes[n]`, where `period` takes up 2 bytes, `keys.length` takes up 1 byte, every key takes up 32 bytes, `votes.length` takes up 1 byte, and every vote takes up 5 bytes (the 4-byte recipient number and 1-byte score). If multiple keys were specified, the same MuSig process as used for Sends is used.
Vote Forms use a prefix of "\xFE" in the contents Merkle. Their hashes are defined as `Blake2b-256("\xFD" + period + keys.length + key[0] + ... + key[n] + votes.length + votes[0] + ... + votes[n])`, where `period` takes up 2 bytes, `keys.length` takes up 1 byte, every key takes up 32 bytes, `votes.length` takes up 1 byte, and every vote takes up 5 bytes (the 4-byte recipient number and 1-byte score). If multiple keys were specified, the same MuSig process as used for Sends is used to create the signature.

The proof is only valid if:

```
max = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
base = max - (max / 60)
size = (104 + (32 * amount of keys) + (5 * amount of votes)) / 104
difficulty = max - ((max - base) / size)
Argon2d(
iterations = 1,
memory = 8,
parallelism = 1,
data = hash of the block which started the voting period || signature,
salt = proof left padded to be 8 bytes long
) > difficulty
factor = (73 + (32 * amount of keys) + (5 * amount of votes)) / 110
spam(hash, proof, 60 * factor)
```

Vote Forms which use a key which already has a Vote Form for the same period archived cannot be archived.

`Vote` has a variable message length; the 2-byte period number, the 2-byte amount of Ed25519 keys, the Ed25519 keys (each 32-bytes), 2-byte amount of votes, the votes (each a 4-byte recipient ID and a 1-byte score), the 64-byte Ed25519 signature, and the 4-byte proof.
`Vote` has a variable message length; the 2-byte period number, the 1-byte amount of Ed25519 keys, the Ed25519 keys (each 32-bytes), 2-byte amount of votes, the votes (each a 4-byte recipient ID and a 1-byte score), the 64-byte Ed25519 signature, and the 4-byte proof.

### Compatibility

Expand Down

0 comments on commit 8b2e128

Please sign in to comment.