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

CIP-0036 | Change reward address field for Fund 10 #373

14 changes: 9 additions & 5 deletions CIP-0036/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ We therefore need a registration transaction that serves three purposes:

1. Registers a "voting key" to be included in the sidechain and/or delegates to existing "voting key"s
2. Associates mainnet ADA to this voting key(s)
3. Declares an address to receive Catalyst rewards
3. Declares a payment address to receive Catalyst rewards


Note: This schema does not attempt to differentiate delegations from direct registrations, as the two options have exactly the same format. It also does not distinguish between delegations that are made as "private" arrangements (proxy votes)
Expand All @@ -43,7 +43,7 @@ A registration transaction is a regular Cardano transaction with a specific tran
Notably, there should be five entries inside the metadata map:
- A non-empty array of delegations, as described below;
- A stake address for the network that this transaction is submitted to (to point to the Ada that is being delegated);
- A Shelley address discriminated for the same network this transaction is submitted to to receive rewards.
- A Shelley payment address (see [CIP-0019](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0019)) discriminated for the same network this transaction is submitted to, to receive rewards.
- A nonce that identifies that most recent delegation
- A non-negative integer that indicates the purpose of the vote. This is an optional field to allow for compatibility with CIP-15. For now, we define 0 as the value to use for Catalyst, and leave others for future use. A new registration should not invalidate a previous one with a different voting purpose value.

Expand Down Expand Up @@ -121,7 +121,7 @@ Voting registration example:
1: [["0xa6a3c0447aeb9cc54cf6422ba32b294e5e1c3ef6d782f2acff4a70694c4d1663", 1], ["0x00588e8e1d18cba576a4d35758069fe94e53f638b6faf7c07b8abd2bc5c5cdee", 3]],
// stake_pub - CBOR byte array
2: "0xad4b948699193634a39dd56f779a2951a24779ad52aa7916f6912b8ec4702cee",
// reward_address - CBOR byte array
// payment_address - CBOR byte array
3: "0x00588e8e1d18cba576a4d35758069fe94e53f638b6faf7c07b8abd2bc5c5cdee47b60edc7772855324c85033c638364214cbfc6627889f81c4",
// nonce
4: 5479467
Expand All @@ -130,7 +130,7 @@ Voting registration example:
}
```
The entries under keys 1, 2, 3, 4 and 5 represent the Catalyst delegation array,
the staking credential on the Cardano network, the address to receive rewards,
the staking credential on the Cardano network, the payment address to receive rewards,
a nonce, and a voting purpose, respectively. A registration with these metadata will be
considered valid if the following conditions hold:

Expand All @@ -139,7 +139,7 @@ considered valid if the following conditions hold:
The advised way to construct a nonce is to use the current slot number.
This is a simple way to keep the nonce increasing without having to access
the previous transaction data.
- The reward address is a Shelley address discriminated for the same network
- The payment address is a Shelley payment address discriminated for the same network
this transaction is submitted to.
- The delegation array is not empty
- The weights in the delegation array are not all zero
Expand Down Expand Up @@ -259,6 +259,10 @@ Fund 8:
- added the `voting_purpose` field to limit the scope of the delegations.
- rename the `staking_pub_key` field to `stake_credential` and `registration_signature` to `registration_witness` to allow for future credentials additions.

Fund 10:
- Replaced the `reward_address` field with `payment_address` field, keeping it at index 3. Stipulating that `payment_address` must be a Shelley payment address, otherwise voting reward payments will not be received.
- **Note:** up to Catalyst's Fund 9, voting rewards were paid via MIR transfer to a stake address provided within the `reward_address` field. From Fund 10 onwards, a regular payment address must be provided in the `payment_address` field to receive voting rewards. This allows Catalyst to avoid MIR transfers and instead pay voting rewards via regular transactions.

Fund 11:
- added the `deregistration` metadata format.

Expand Down
4 changes: 2 additions & 2 deletions CIP-0036/schema.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ registration_cbor = {
}

$voting_pub_key /= bytes .size 32
$reward_address /= bytes
$payment_address /= bytes
$nonce /= uint
$weight /= uint .size 4
$voting_purpose /= uint
Expand All @@ -27,7 +27,7 @@ $ed25519_signature /= bytes .size 64
key_registration = {
1 : [+delegation] / legacy_key_registration,
2 : $stake_credential,
3 : $reward_address,
3 : $payment_address,
4 : $nonce,
? 5 : $voting_purpose .default 0
}
Expand Down
144 changes: 85 additions & 59 deletions CIP-0036/test-vector.md
Original file line number Diff line number Diff line change
@@ -1,110 +1,136 @@
# Test vector for CIP36
# Test Vector for CIP-0036

### Inputs
## Keys

Payment **public** key hex
**Note:** Not all keys are required for certificate recreation.

Payment **private** signing key Hex:
```
614fdfe13d403bee2014570b190d81851f17d8daca0b6dd1ce33014403191003
```

Payment **public** verification Hex:
```
7a24dd8e692cec94b612c2ec81f508aada96557c2052a447b9d197b006fa7d2a
```

Staking **private** signing key Hex:
```
852fa5d17df3efdfdcd6dac53ec9fe5593f3c0bd7cadb3c2af76c7e15dfa8a5c
```

Staking **public** verification key Hex:
```
3273a5316e4de228863bd7cf8dac90d57149e1a595f3dd131073b84e35546676
e3cd2404c84de65f96918f18d5b445bcb933a7cda18eeded7945dd191e432369
```

Staking **private** key hex
CIP-36 Vote **public** verification key Hex:
```
f5beaeff7932a4164d270afde7716067582412e8977e67986cd9b456fc082e3a
0036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a0
```

Catalyst **private** key hex
CIP-36 Vote **extended private** signing key Hex:
```
4820f7ce221e177c8eae2b2ee5c1f1581a0d88ca5c14329d8f2389e77a465655c27662621bfb99cb9445bf8114cc2a630afd2dd53bc88c08c5f2aed8e9c7cb89
Ryun1 marked this conversation as resolved.
Show resolved Hide resolved
```

### Intermediate steps
## Addresses
- This example uses Pre-Production testnet (testnet-magic 1).

Reward address generated from staking key
Payment Address:
```
bech32
stake_test1uzhr5zn6akj2affzua8ylcm8t872spuf5cf6tzjrvnmwemcehgcjm
bech32: "addr_test1qprhw4s70k0vzyhvxp6h97hvrtlkrlcvlmtgmaxdtjz87xrjkctk27ypuv9dzlzxusqse89naweygpjn5dxnygvus05sdq9h07"

hex-encoded
e0ae3a0a7aeda4aea522e74e4fe36759fca80789a613a58a4364f6ecef
hex-encoded: "004777561e7d9ec112ec307572faec1aff61ff0cfed68df4cd5c847f1872b617657881e30ad17c46e4010c9cb3ebb2440653a34d32219c83e9"
````

Staking Address:
```
bech32: "stake_test1upetv9m90zq7xzk303rwgqgvnje7hvjyqef6xnfjyxwg86gzpmj80"

hex-encoded: "e072b617657881e30ad17c46e4010c9cb3ebb2440653a34d32219c83e9"
```

Data to sign (human readable format)
## Certificate Example

- Assigning all voting power to a single voting key.

### Human Readable Format

Legacy version (full delegation to one key only):
Legacy CIP-15 version:
```javascript
61284: {
1: '0x0036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a0',
2: '0x86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e',
3: '0xe0ae3a0a7aeda4aea522e74e4fe36759fca80789a613a58a4364f6ecef',
4: 1234,
},
"61284": {
"1": "0x0036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a0",
"2": "0xe3cd2404c84de65f96918f18d5b445bcb933a7cda18eeded7945dd191e432369",
"3": "0xe072b617657881e30ad17c46e4010c9cb3ebb2440653a34d32219c83e9",
"4": 1234
}
```

New version:
CIP-36 version:
```javascript
61284: {
1: [['0xa6a3c0447aeb9cc54cf6422ba32b294e5e1c3ef6d782f2acff4a70694c4d1663', 1], ['0x00588e8e1d18cba576a4d35758069fe94e53f638b6faf7c07b8abd2bc5c5cdee', 3]],
2: '0x86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e',
3: '0xe0ae3a0a7aeda4aea522e74e4fe36759fca80789a613a58a4364f6ecef',
4: 1234,
5: 0
},
"61284": {
"1": [["0x0036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a0", 1]],
"2": "0xe3cd2404c84de65f96918f18d5b445bcb933a7cda18eeded7945dd191e432369",
"3": "0x004777561e7d9ec112ec307572faec1aff61ff0cfed68df4cd5c847f1872b617657881e30ad17c46e4010c9cb3ebb2440653a34d32219c83e9",
"4": 1234,
"5": 0
}
```

### CBOR Encoding

Metadata (CBOR encoding)

Legacy:
Legacy CIP-15 version:
```
a119ef64a40158200036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a002582086870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e03581de0ae3a0a7aeda4aea522e74e4fe36759fca80789a613a58a4364f6ecef041904d2
a119ef64a40158200036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a0025820e3cd2404c84de65f96918f18d5b445bcb933a7cda18eeded7945dd191e43236903581de072b617657881e30ad17c46e4010c9cb3ebb2440653a34d32219c83e9041904d2
```

New:
CIP-36 version:
```
a119ef64a50182825820a6a3c0447aeb9cc54cf6422ba32b294e5e1c3ef6d782f2acff4a70694c4d16630182582000588e8e1d18cba576a4d35758069fe94e53f638b6faf7c07b8abd2bc5c5cdee0302582086870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e03581de0ae3a0a7aeda4aea522e74e4fe36759fca80789a613a58a4364f6ecef041904d20500
a119ef64a501818258200036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a001025820e3cd2404c84de65f96918f18d5b445bcb933a7cda18eeded7945dd191e432369035839004777561e7d9ec112ec307572faec1aff61ff0cfed68df4cd5c847f1872b617657881e30ad17c46e4010c9cb3ebb2440653a34d32219c83e9041904d20500
```

Blake2b-256 hash of metadata
### Blake2b-256 Hash

Legacy:
Legacy CIP-15 version:
```
a3d63f26cd94002443bc24f24b0a150f2c7996cd3a3fd247248de396faea6a5f
9946e71b5f6c16150cf431910a0f7dbb8084a992577847802e60d32becb3d6be
```

New:
CIP-36 version:
```
5bc0681f173efd76e1989037a3694b8a7abea22053f5940cbb5cfcdf721007d7
3110fbad72589a80de7fc174310e92dac35bbfece1690c2dce53c2235a9776fa
```

### Output
## Metadata Example with Witness

Legacy:
Legacy CIP-15 version:
```javascript
{
61284: {
1: '0x0036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a0',
2: '0x86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e',
3: '0xe0ae3a0a7aeda4aea522e74e4fe36759fca80789a613a58a4364f6ecef',
4: 1234,
"61284": {
"1": "0x0036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a0",
"2": "0xe3cd2404c84de65f96918f18d5b445bcb933a7cda18eeded7945dd191e432369",
"3": "0xe072b617657881e30ad17c46e4010c9cb3ebb2440653a34d32219c83e9",
"4": 1234
},
61285: {
1: '0x6c2312cd49067ecf0920df7e067199c55b3faef4ec0bce1bd2cfb99793972478c45876af2bc271ac759c5ce40ace5a398b9fdb0e359f3c333fe856648804780e'
"61285": {
"1": "0xa9ec8735804c6c4c5c4a02e9589c65508ec7060063b2d7dbeba82d1cbfa1b8be6b457f95d4ead5e8b454b989624fa44e0b89a64d089fdc0a6a1268fef4876d0f"
}
}
```

New:
CIP-36 version:
Ryun1 marked this conversation as resolved.
Show resolved Hide resolved
```javascript
{
61284: {
1: [['0xa6a3c0447aeb9cc54cf6422ba32b294e5e1c3ef6d782f2acff4a70694c4d1663', 1], ['0x00588e8e1d18cba576a4d35758069fe94e53f638b6faf7c07b8abd2bc5c5cdee', 3]],
2: '0x86870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e',
3: '0xe0ae3a0a7aeda4aea522e74e4fe36759fca80789a613a58a4364f6ecef',
4: 1234,
5: 0
"61284": {
"1": [["0x0036ef3e1f0d3f5989e2d155ea54bdb2a72c4c456ccb959af4c94868f473f5a0", 1]],
"2": "0xe3cd2404c84de65f96918f18d5b445bcb933a7cda18eeded7945dd191e432369",
"3": "0x004777561e7d9ec112ec307572faec1aff61ff0cfed68df4cd5c847f1872b617657881e30ad17c46e4010c9cb3ebb2440653a34d32219c83e9",
"4": 1234,
"5": 0
},
61285: {
1: '0x3aaa2e6b43c0a96e880a7d70df84dffb2a1a17b19d7a99a6ed27b91d499b32027c43acfbf6dff097af7634b2ee38c8039af259b0b6a64316f02b4ffee28a0608'
"61285": {
"1": "0xcbb96ba1596fafc18eec84e306feea3067ba1c6ace95b11af820bcbd53837ef32bdcf28176749061e1f2a1300d4df98c80582722786e40cf330072d0b78a7408"
}
}
```
```