Skip to content

[WIP]: more work on profile and more... #603

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
13e3afb
manage registry collections
smohan-dw Feb 4, 2025
b13ab29
collection updates and pallet registry
smohan-dw Feb 6, 2025
ad28843
profile: Core Library
vatsa287 Apr 3, 2025
ab9366a
profile: Types and dependencies
vatsa287 Apr 3, 2025
dd4ea3c
runtimes::weave: Add pallet-profile into weave
vatsa287 Apr 3, 2025
7771f2a
profile: Add has_profile method
vatsa287 Apr 8, 2025
efd5827
Integrate profile into registry
vatsa287 Apr 9, 2025
4554953
runtime updates to include entry
vatsa287 Apr 10, 2025
9ef506c
registry updates
vatsa287 Apr 10, 2025
ee995ce
Integrate pallet-entry to profile and registry
vatsa287 Apr 10, 2025
07979b6
registry: Fix has_permission (#605)
vatsa287 Apr 10, 2025
96ab451
registry: Add blob to registry create (#606)
vatsa287 Apr 10, 2025
503457c
registry: Add registry hash update method (#607)
vatsa287 Apr 10, 2025
07421de
entry: Add extra checks on ownership
vatsa287 Apr 10, 2025
200e57b
registry: Add Permissions::ADMIN check as default part of verification
vatsa287 Apr 10, 2025
a9992c8
registry: Fix delegate bug during creator update (#609)
vatsa287 Apr 11, 2025
738a432
collection: Integrate collection with profile (#610)
vatsa287 Apr 12, 2025
c0e1b61
collection: Fix bug of has_permission (#611)
vatsa287 Apr 13, 2025
e73857f
Increase endowment balances across all specs (#612)
vatsa287 Apr 13, 2025
57ff59e
remove error file (#615)
vatsa287 Apr 15, 2025
b303a77
docs/: add some details of the features
amarts Apr 16, 2025
7f166a7
entry: Update method docs & use existing-owner profile-id (#616)
vatsa287 Apr 17, 2025
aad0b28
registry: Update method docs (#617)
vatsa287 Apr 17, 2025
dbc18da
entry: Add Hash to Identifier Lookup (#618)
vatsa287 Apr 18, 2025
642c25e
registry: Split registry creation for native and cyra (#620)
vatsa287 Apr 18, 2025
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
89 changes: 88 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ members = [
"node/inspect",
"node/testing",
"pallets/asset",
"pallets/collection",
"pallets/chain-space",
"pallets/namespace",
"pallets/did",
"pallets/did-name",
"pallets/identity",
"pallets/namespace",
"pallets/network-membership",
"pallets/network-score",
"pallets/node-authorization",
"pallets/offences",
"pallets/registry",
"pallets/runtime-upgrade",
"pallets/session-benchmarking",
"pallets/statement",
Expand Down Expand Up @@ -52,7 +54,8 @@ members = [
"test-utils/runtime/client",
"test-utils/runtime/transaction-pool",
"test-utils/service",

"pallets/profile",
"pallets/entry",
]
default-members = ["node/cli"]

Expand Down Expand Up @@ -880,13 +883,16 @@ cord-test-runtime-transaction-pool = { path = "test-utils/runtime/transaction-po
cord-cli-test-utils = { path = "test-utils/cli", default-features = false }
cord-utilities = { path = "utilities", default-features = false }
pallet-council-membership = { path = 'pallets/membership/', default-features = false }
pallet-collection = { path = 'pallets/collection/', default-features = false }
pallet-config = { path = 'pallets/config/', default-features = false }
pallet-did = { path = 'pallets/did', default-features = false }
pallet-did-name = { path = 'pallets/did-name', default-features = false }
pallet-schema = { path = 'pallets/schema', default-features = false }
pallet-chain-space = { path = 'pallets/chain-space', default-features = false }
pallet-cord-statement = { path = 'pallets/statement', default-features = false }
pallet-network-membership = { path = 'pallets/network-membership', default-features = false }
pallet-registry = { path = 'pallets/registry/', default-features = false }
pallet-entry = { path = 'pallets/entry', default-features = false }
pallet-runtime-upgrade = { path = 'pallets/runtime-upgrade', default-features = false }
pallet-cord-identity = { path = 'pallets/identity', default-features = false }
pallet-cord-offences = { path = 'pallets/offences', default-features = false }
Expand All @@ -901,7 +907,7 @@ pallet-entries = { path = "pallets/entries", default-features = false }
pallet-schema-accounts = { path = "pallets/schema-accounts", default-features = false }
pallet-meta-tx = { path = "pallets/meta-tx", default-features = false }
pallet-namespace = { path = 'pallets/namespace', default-features = false }

pallet-profile = { path = "pallets/profile", default-features = false }

[profile.release]
panic = 'unwind'
Expand Down
74 changes: 74 additions & 0 deletions docs/cord-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# CORD Features

In this document, we are trying to give elaborate understanding of what each of pallet signifies, and how it would keep proofs in them. Idea is to make sure everyone, mainly developers understand how to make sense of the 'Token' and understand how it would be linked to all the other tokens, and their relations.

![image](https://hackmd.io/_uploads/SktR5aoaJg.png)


### Identifier

The identifier in CORD chain looks like below:

`2L1sasM85CBtLkxFjB1ADWc9erKr4xFuALh87vkMEJbQfVVwM5zGTdGTPV`

The spec of the Identifier is available at [Spec Repository](https://github.com/dhiway/specs/blob/main/01-Identifier.md)

Identifier provides query methods to keep track of all updates to identifier (which has to be updated by every pallet dealing with the identifier). Also note that every identifier by itself can have a state (Active/Revoked).


### profile

This is a pallet which depends on [Identifier](#identifier) to create the profile-identifier. This pallet is mainly designed to handle key rotations and public key management for any identity in CORD chain.

The historic key tracking is offloaded to services which can be built by indexers of chain's blocks.

In this pallet, we allow account to create key-value pairs (like any other profiles). The pallet is not checking for the value, and the applications using profile should take care of DPDP / GDPR like laws.

This pallet doesn't 'recommend' (ie, enforce) the PII data check right now. Plan is, in future if there is a need, this pallet can be changed to take only hash as value for any key, and that hash should be resolved by attached storage.

### registry

This pallet handles 2 things. One is to create a identifier which would be used to group certain proofs, and second is handling the delegations. Using this pallet, we can setup a small subset of chain, which will accept the proofs only from the accounts which are added as the delegates, thus making updating any existing proofs possible only from valid proof, and not any anonymous account which has some UNITs/WAYs to pay for chain transaction. This key feature enables the trust in registries, as the process of management of delegates itself is recorded on the ledger. Note that this pallet depends on [profile](#profile) pallet to manage the delegates, and on [identifier](#identifier) feature for identifier creation and updation.

Before creating a registry, the profile should be created by the account.

### entry

This pallet can by synonyms with record, or statement (ie, a previous pallet used for 'proof'). This depends on profile and registry pallet to work. To call any extrinsic (or method/function) related to entry pallet, the account should have created profile, and a registry.

An entry can be created for a single digest, or for a blob (where no data check doesn't happen), or a storage id (ie, nodeid+content-id combination). Any of these calls will be creating the identifier. Once Identifier is created, we can attach some more 'key-value' data to identifier thus applications can be built with more data points to verify the proofs.

Note that any entry can also be revoked by the relevant account, and thus the chain reflects the latest state of the entry.

### collection

A 'collection' as the name suggests, is a collection of 'identifiers'. A collection also has an identifier, thus its can manage its state/status, also be watched by applications. The real-world example of collection is a playlist, where one keeps multiple entries which are not created by them, but associates them based on their own tags, groups etc. Similarly, each collection here can be an array of identifiers which will be grouped together by one of the profile.

This enables a country to provide set of 'registry-identifiers' as the registry to consider for all validations, or a user to use proof of all credentials used as part of a verifiable presentation. Again, the usecases of how best to use colleciton is left to applications. One thing we have considered is not to check for existance of this identifier in the same chain, because a collection can have identifiers from multiple chains.


## Other highlights, and future developments

### rating

This can be a separate pallet, which doesn't create any new identifier, but can keep track of rating of any identifier? Questions asked are:

* Can every identifier have rating a common place like status (active/revoke) ?
* This can enable rating for a profile, a registry or an entry.

### contracts

Smart Contracts are key factor in blockchain adoption. In this scenario, the applications can trust the 'binary' confidence that they are executing the logic which is seen by everyone, and the underlaying code has not changed behind the scene. It is good enough for trust in multiple domains.

Today Ethereum's smart contract is considered as widely adopted, hence CORD also would support the EVM friendly Smart Contracts. Thus, a user can use the same infrastructure they are using for trust infrastructure for their application's smart contracts too.

This space will be evolved over time, and we will keep updating the docs on this.

### witness

When we consider data trust, in the real-world, there is a concept of 'witness' while registering a document, in legal domain etc. Thus, we can develop a simple pallet, which doesn't create a new identifier, but adds profile identifier which has done the`witness()` call.

## How to understand which is good for me?

Think, document and discuss with us. We are happy how your application can benefit from this Data Tokenization enabling pallets / features.

5 changes: 3 additions & 2 deletions node/cli/src/chain_spec/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ pub type CordChainSpec = sc_service::GenericChainSpec<Extensions>;

// pub const BRAID_ENDOWMENT: Balance = 10_000_000 * BRAID_UNITS;
// pub const LOOOM_ENDOWMENT: Balance = 10_000_000 * LOOM_UNITS;
pub const ENDOWMENT: Balance = 10_000_000 * UNITS;
const STASH: u128 = 100_000 * UNITS;

const ENDOWMENT: u128 = 500_000_000_000 * UNITS;
const STASH: u128 = 100_000_000 * UNITS;

fn braid_session_keys(
babe: BabeId,
Expand Down
76 changes: 76 additions & 0 deletions pallets/collection/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[package]
name = 'pallet-collection'
description = 'Manage Collection of Registries.'
version.workspace = true
authors.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true

[lints]
workspace = true

[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']

[dev-dependencies]
sp-core = { features = ["std"], workspace = true }
sp-keystore = { features = ["std"], workspace = true }
cord-utilities = { features = ["mock"], workspace = true }

[dependencies]
codec = { features = ["derive"], workspace = true }
scale-info = { features = ["derive"], workspace = true }
bitflags = { workspace = true }

# Internal dependencies
cord-primitives = { workspace = true }
cord-utilities = { workspace = true }
cord-uri = { workspace = true }
pallet-profile = { workspace = true }

# Substrate dependencies
frame-benchmarking = { optional = true, workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }
sp-core = { optional = true, workspace = true }
sp-io = { optional = true, workspace = true }
sp-keystore = { optional = true, workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }


[features]
default = ['std']
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"cord-utilities/runtime-benchmarks",
"pallet-profile/runtime-benchmarks",
]
std = [
"codec/std",
"cord-uri/std",
"frame-benchmarking/std",
"frame-support/std",
"frame-system/std",
"cord-primitives/std",
"cord-utilities/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-keystore/std",
"sp-runtime/std",
"sp-std/std",
"pallet-profile/std",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"cord-utilities/try-runtime",
"sp-runtime/try-runtime",
"pallet-profile/try-runtime",
]
Loading
Loading