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

On-chain stake pool operator to delegates communication #44

Merged
merged 11 commits into from
Jan 14, 2021
117 changes: 117 additions & 0 deletions CIP-0012/CIP-0012.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
CIP: 12
Title: On-chain stake pool operator to delegates communication
Authors: Marek Mahut <[email protected]>, Sebastien Guillemot <[email protected]>, Ján Hrnko <[email protected]>
Comments-URI: https://forum.cardano.org/t/on-chain-stake-pool-operator-to-delegates-communication/42229
Status: Draft
Type: Standards
Created: 2020-11-07
License: CC-BY-4.0
Requires: CIP10
---

## Abstract

Standard format for metadata used in an on-chain communication of stake pool owner towards their delegates.

## Terminology

We define two types of communication metadata, which are distinguished by transaction metadata label as defined in the [CIP10 Transaction metadata label registry](https://github.com/cardano-foundation/CIPs/blob/master/CIP10/README.md).

* *Message board communication* is a type of metadata that has been included in an on-chain transaction between two base addresses associated with a stake pool operator owner address. Given the onetime fee for this communication, we are considering this as a message board of a stake pool, as it also enables delegates to easier access historical metadata communication.

* *Direct delegate communication* is a type of metadata that has been included in an on-chain transaction between a stake pool owner account and a delegate's account. This type of communication is more expensive for the stake pool owner, preventing higher abuse and therefore enables wallets to implement notification granularity. It might be suitable for targeting specific delegates, such as messaging only new joined delegates, loyal delegates, high-amount delegates etc.

## Motivation

The lack of an on-chain communication standard between a stake pool owner and their delegates.

<!-- Link to CIP6 link once/if merged -->

Work in progress [CIP6](https://github.com/cardano-foundation/CIPs/pull/15) already defines an external feed of a stake pool within the extended metadata. However, there is need for a more verifiable on-chain communication standard that will also provide additional cost associated with such communication to prevent its abuse.

## Specification

As per [CIP10 Transaction metadata label registry](https://github.com/cardano-foundation/CIPs/blob/master/CIP10/README.md), we assign:

* *Message board communication* transaction metadata label `1990`,
* *Direct delegate communication* transaction metadata label `1991`.

## Metadata

Metadata are written in JSON format and maximum size of metadata around 16KB.

The root object property is a 3 bytes UTF-8 encoded string representing the ISO 639-3
language code of the content.

| key | Value | Rules |
| ---------------------- | -------------------------------------------- | ------------------------------------------ |
| `title` *(required)* | Title of the communication | 64 bytes UTF-8 encoded string |
| `content` *(required)* | Content of the communication | An array of 64 bytes UTF-8 encoded strings |
| | |
| `valid` *(optional)* | Slot number the communication becomes valid | Unsigned integer |
| `expires` *(optional)* | Slot number until the communication is valid | Unsigned integer |

### Metadata JSON schema

The [schema.json](./schema.json) file defines the metadata.

### Metadata example including the transaction metadata label

```
{
"1991": [ {
"lat": {
"title": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do",
"content": [
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ",
"eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut e",
"nim ad minim veniam, quis nostrud exercitation ullamco laboris n",
"isi ut aliquip ex ea commodo consequat. Duis aute irure dolor in",
" reprehenderit in voluptate velit esse cillum dolore eu fugiat n",
"ulla pariatur. Excepteur sint occaecat cupidatat non proident, s",
"unt in culpa qui officia deserunt mollit anim id est laborum."
],
"valid": 10661033,
"expire": 10669033
}
},
{
"eng": {
"title": "But I must explain to you how all this mistaken idea",
"content": [
"But I must explain to you how all this mistaken idea of denounci",
"ng of a pleasure and praising pain was born and I will give you ",
"a complete account of the system, and expound the actual teachin",
"gs of the great explorer of the truth, the master-builder of hum",
"an happiness. No one rejects, dislikes, or avoids pleasure itsel",
"f, because it is pleasure, but because those who do not know how",
" to pursue pleasure rationally encounter consequences."
],
"valid": 10661033,
"expire": 10669033
}
}
]
}
```

## Rationale

The format of the `content` field is required to be an array of 64 bytes chunks, as this is the maximum size of a JSON field in the Cardano ledger. Tools, such as wallets, are required to recompose the content of the message.

The current Cardano protocol parameter for maximum transaction size, that will hold the metadata, is around 16KB.

## Backwards compatibility

No backwards compatibility breaking changes are introduced.

## Reference implementation

We leave the decisions, such as what and how to display communication messages, up to downstream tools and wallets.

* For simple implementation reference, refer to [CIP12 communication tool examples](https://github.com/fivebinaries/cip-metadata-communication-example)

## Copyright

This CIP is licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode)
74 changes: 74 additions & 0 deletions CIP-0012/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0012/CIP-0012.md",
"type": "object",
"title": "CIP12",
"description": "Transaction metadata schema for CIP12",
"patternProperties": {
"^199{0,1}$": {
"type": "array",
"items": [ {
"type": "object",
"patternProperties": {
"^[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*$": {
"type": "object",
"required": [
"title",
"content"
],
"properties": {
"title": {
"$id": "#/properties/title",
"type": "string",
"title": "Title",
"description": "Title of the communication.",
"maxLength": 64,
"examples": [
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do"
]
},
"content": {
"$id": "#/properties/content",
"type": "array",
"title": "Content",
"description": "Content of the communication in chunks",
"items": [
{
"type": "string",
"maxLength": 64
}
],
"examples": [
[
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ",
"eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut e",
"nim ad minim veniam, quis nostrud exercitation ullamco laboris."
]
]
},
"valid": {
"$id": "#/properties/valid",
"type": "integer",
"title": "Validity",
"description": "Slot number when the communication becomes valid",
"examples": [
10669033
]
},
"expire": {
"$id": "#/properties/expire",
"type": "integer",
"title": "Expiration",
"description": "Slot number when the communication expires",
"examples": [
10669033
]
}
},
"additionalProperties": false
}
}
} ]
}
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The current process is described in details in [CIP1 - "CIP Process"](https://gi
| 8 | [Message Signing](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0008) | Draft |
| 10 | [Transaction Metadata Label Registry](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0010) | Draft |
| 11 | [Staking key chain for HD wallets](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0011) | Draft |
| 12 | [On-chain stake pool operator to delegates communication](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0012) | Draft |
| 1852 | [HD Wallets for Cardano](https://github.com/cardano-foundation/CIPs/tree/master/CIP-1852) | Draft |

:bulb: - For more details about Statuses, refer to [CIP1](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0001).
Expand Down