ixofoundation / ixo-protocol

Protocol specifications for the Internet of Impact
1 stars 3 forks source link

Update Entity Doc to the IID Specification #2

Open ig-shaun opened 3 years ago

ig-shaun commented 3 years ago

Following the work we have been leading on the Interchain Identifier Specification, we are ready to update the ixo Entity Document data model so this complies with the IID and DID-Core standards. This is particularly important as users start creating entities on the Impact Hub public network, to comply with data protection and privacy regulations.

{
    "@context":["https://www.w3.org/ns/did/v1","https://w3.org/iid/specification/v1"],
    "id": "did:ixo:abc123",
    "verificationMethod": 
    [
    {
     "id": "#keys-1",
     "type": "Ed25519VerificationKey2020",
     "controller": "did:example:abc123",
     "publicKeyMultibase":"" // this is the pubkey associated with the entity creator's DID
      }
      ],
    "assertionMethod":[
     {
    "id": "#keys-2",
    "type": "Ed25519VerificationKey2020",
    "controller": "did:example:abc123",
    "publicKeyMultibase":"" // this is the pubkey associated with the entity creator's DID
     }
     ],
    "authentication": "#keys-1",
    "capabilityDelegation" : "#keys-1",
    "capabilityInvocation" : "#keys-1",
    "keyAgreement":[
         {
        "id": "#keys-2",
        "type": "rsa",
        "controller": "did:example:abc123",
        "publicKeyMultibase":""
         }],
    "service": [
    {
        "type":"editTokenProperties",
        "name":"Date Range",
        "id":"https://github.com/ixofoundation/ixo-blockchain/blob/master/x/tokens/spec/03_messages.md#msgUpdateIidDocument", // replace with simpleAPI link
        "endpoint":"/msgUpdateIIDdocument",
        "authentication":"#keys-2"
    },
    {
        "type":"cellNode", // an instance of the ixo decentralised data store
        "name":"Cell Node",
        "id":"#cellnode-1", 
        "endpoint":"https://cellnode.ixo.worl/node1,
        "authentication":"#keys-1"
    },
    {
        "type":"ipfsGateway",
        "name":"Nifty Download",
        "id":"https://nifty.download#nifty", 
        "endpoint":"https://cellnode.ixo.worl/node1,
        "authentication":"#keys-1"
    }
    ],
    "linkedResource":[
    {
    "type":"page",
    "id":"cid83udb28", // the content identifier of the file that can be retrieved from the cellnode using the cellnode service
    "rel":"subjectDescription",
    "resourceFormat":"json-ld",
    "endpoint":"#cellnode-1/public",
    "encrypted":"False",
    },
    {
    "type":"settings",
    "id":"cid83udb28",
    "resourceFormat":"json-ld",
    "endpoint":"#cellnode-1/public",
    "encrypted":"False",
    "verificationMethod":"#keys-2"
    },
    {
    "type":"credential",
    "id":"cid83udb28",
    "resourceFormat":"json-ld",
    "displayName":"Meter Log",
    "displayDescription":"This is a log of all meter readings",
    "displayIcon":"energycredential.png",
    "endpoint":"https://nifty.download",
    "proof":{
    "type":"multihash",
    "value":"cid83udb28",
    "encrypted":"False"
    }
    },
    {
    "type":"credential",
    "resourceFormat":"json-ld",
    "id":"cid83udb28",
    "endpoint":"https://cellnode.ixo.world/node3",
    "encrypted":"False"
    },
    {
    "type":"document",
    "id":"cid83udb28",
    "resourceFormat":"pdf",
    "endpoint":"#nifty",
    "encrypted":"False",
    },
    {
    "type":"accordedright",
    "id":"wf43f4vgeg33#agreement-1",
    "resourceFormat":"pdf",
    "displayName":"Reseller Agreement",
    "displayDescription":"The right to resell energy generated",
    "endpoint":"#nifty",
    "encrypted":"False"
    }
    ],
    "accordedright":[
    {
      "Type":"legalContract",
      "id":"#agreement-1"
    }
    ]
    }

Customisations in ixo

In the ixo projects module, we refer to the IID document as an Entity Document.

This includes additional header metadata and blockchain transaction hash (as a type of Proof). These can be thought of as a wrapper for the IID Document.

Entity Document metadata Properties include:

{
 "entitySchemaVersion": "1.0.0",
 "startDate": "2020-09-17T00:00:00.000Z",
 "endDate": "2020-10-23T00:00:00.000Z",
 "status": "Live",
 "stage": "Planning",
 "relayerNode": "did:ixo:Rmb6Rd1CU6k74FM2xzy6Do",
 "version": {
  "versionNumber": "1.0.5",
  "effectiveDate": "2020-09-15T00:00:00.000Z",
  "notes": "Some version notes"
}

Projects module is a legacy name, as now this module manages all entity types, including Cells (which can be used for any form of organisation including Team, DAO, Company, ...), Templates, Assets, Investments, Oracles, and of course Projects

ig-shaun commented 3 years ago

For entities of type assets (generally NFTs), to enable chain execution of the token's properties and services, we would place the token class and related token information in-line within the entity document linkedResource property, as per the following example:

{
   "linkedResource":[
      {
         "tokens":{
            "@context":"https://w3.org/tokens/specification/v1",
            "token":[
               {
                  "type":"class",
                  "id":"did:ixo:tokens#rec2020",
                  "name":"Renewable Energy Certificates 2020",
                  "mutable":"false"
               },
               {
                  "type":"collection",
                  "id":"did:ixo:tokens#rec2020/did:ixo:tokens#JanuaryREC2020",
                  "name":"RECs created in January 2020",
                  "mutable":"false"
               },
               {
                  "type":"denom",
                  "id":"did:ixo:tokens#REC2020",
                  "name":"REC2020",
                  "mutable":"false"
               },
               {
                  "type":"supply",
                  "id":"",
                  "supply":{
                     "supplyMin":0,
                     "supplyMax":1000
                  },
                  "decimals":0,
                  "mutable":"false"
               },
               {
                  "type":"behaviours",
                  "behaviour":[
                     {
                        "type":"mintable",
                        "id":"...#",
                        "controlMessageName":"msgMintNFT",
                        "endpoint":"#",
                        "mutable":"false",
                        "caveats":""
                     }
                  ]
               }
ig-shaun commented 3 years ago

The linkedResource settings document has the structure:

{
"@context":"https://w3.org/ixo/entity/settings/v1"
"type:"entitySettings",
"id":"",
"@type": "Project",
 "name": "Some Title",
 "description": "Some Short Description",
 "image": {
    "id":"sbujb0xg0dgkeljwtnc",
    "name":"",
    "imageDescription": "Some Image Description"
          },
 "logo": {
    "id":"123",
    "name":""},
"brand": "Brand Identity Name",
"location": "AR",
"sdgs": ["5", "7"],
"terms": [
  {
  "type": "OnceOffFee",
  "id":"",
  "paymentTemplateId": "did:ixo:CYCc2xaJKrp8Yt947Nc6jd4"
 },
 "privacy": 
   {
  "pageView": "Private",
  "entityView": "Visible",
  "parentCapability": "",
 "creator": {
   "id": "did:ixo:CYCc2xaJKrp8Yt947Nc6jd1",
  "displayName": "Creator Display Name",
  "location": "AD",
  "email": "name@email.com",
  "website": "https://website.com",
  "mission": "Some mission",
  "credentialId": "did:ixo:CYCc2xaJKrp8Yt947Nc6jd2",
  "logo": 
{
"id":"123",
"name":""},
 "owner": {
  "displayName": "Owner Display Name",
  "location": "AQ",
  "email": "name@email.com",
  "website": "https://website.com",
  "mission": "Tagline description",
  "logo": {
"id":"123",
"name":""
 },
 "ddoTags": [
  {
   "category": "Project Type",
   "tags": ["Index", "Accreditation", "Accountability", "Insurance Bond"]
  }
 ],
 "displayCredentials": {
  "@context": "https://www.w3.org/2018/credentials/v1",
  "items": [
   { "type":"",
      "id":"",
     "credential": "somecredential1", 
     "badge": "https://badge.com" },
  ]
 },
"entityClaims": {
  "@context": "https://schema.ixo.world/entity_claims:3r08webu2eou",
  "items": [
   {
    "type":"outcome"
    "id": "did:ixo:DrweDe4r34ddowkkmd",
    "visibility": "Private",
    "title": "Claim Title",
    "description": "Claim Description 1",
    "targetMin": 23,
    "targetMax": 45,
    "goal": "Goal description",
    "startDate": "2020-09-25T00:00:00.000Z",
    "endDate": "2020-10-22T00:00:00.000Z",
    "agents": [
     { "role": "PO", 
     "parentCapability": "", 
     "autoApprove": true }
    ],
    "claimEvaluation": [
     {
      "@context": "https://schema.indicators.org",
      "id": "URIlinktoResource",
      "methodology": "methodology description",
      "attributes": ["attr1", "attr2"]
     }
    ],
    "claimApproval": [
     {
      "@context": "https://schema.serviceprovider.org/approval_criteria",
      "id": "URIlinktoResource",
      "criteria": [
       { "condition": "condition1", "attribute": "criteria1" },
       { "condition": "condition2", "attribute": "criteria2" }
      ]
     }
    ],
    "claimEnrichment": [
     {
     "type":"",
 "id": "ttps://schema.valueadd.com/",
      "resources": [
       { 
"type":"",
"id":"",
"resource": "resource description" }
      ]
     }
    ]
   },
 "linkedEntities": [
  { "type": "investment", "id": "did:ixo:CYCc2xaJKrp8Yt947Nc6jdqq" },
  { "type": "oracle", "id": "did:ixo:CYCc2xaJKrp8Yt947Nc6jdtt" }
 ],
 "fees": {
  "@context": "https://schema.ixo.world/fees/ipfs3r08webu2eou",
  "type:"fees",
  "id":"",
  "items": [{ "type": "RentalFee", "id": "did:sov:CYCc2xaJKrp8Yt947Nc6jdff" }]
 },
 "stake": {
  "@context": "https://schema.ixo.world/staking/ipfs3r08webu2eou",
  "type":"stake",
  "items": [
   {
    "type": "PerformanceGuarantee",
    "id": "did:ixo:CYCc2xaJKrp8Yt947Nc6jdvv",
    "denom": "IXO",
    "stakeAddress": "abcccsdfsdfdsfdsfsdf",
    "minStake": 12,
    "slashCondition": "FailedDispute",
    "slashFactor": 45,
    "slashAmount": 66,
    "unbondPeriod": 23
   }
  ]
 },
 "funding": {
  "@context": "https://schema.ixo.world/funding/ipfs3r08webu2eou",
"type":"funding",
"id":"",
  "items": [
   { "type": "Alphabond", "id": "did:ixo:CYCc2xaJKrp8Yt947Nc6jdzzzz" }
  ]
 },
"data": [{
   "type": "PersonalDataPod",
   "id": "did:ixo:CYCc2xaJKrp8Yt947Nc6jdbgfd",
   "serviceEndpoint": "https://hub.me.com",
   "properties": "regex or other string"
  }
 ]