website logo
WebsiteGithubDiscordTwitterTelegram
⌘K
Get started
Welcome to peaq
Introduction to peaq
Our mission
Our vision
Learn
Networks overview
Economics
Tokens & Token Utility
Why Polkadot
Tech stack
Source code
Important links
Security Assessment Reports
Builders
Get started
Build
Integrate
Get inspired
Grants & Funding
Ecosystem and Community Initiatives
User Interfaces
peaq control
peaq App
Node operators
Run a node
Tokens & Earn
Agung tokens (Faucet)
Wallets
Docs powered by archbee 
20min

peaq ID (Machine Identity)

peaq DID Specifications

Introduction

Machines can locate one another, carry out transactions, verify assertions, preserve privacy, and uphold sovereignty thanks to the peaq DID standard. One of peaq’s DID fundamental value propositions is the standardization of machine interaction through a coalition of numerous industry leaders in a world of self-governing individuals - providing standardized interfaces for discovery that permit two participants to successfully engage in a transaction.

peaq DID Format

The method name peaq (in lowercase letters) and the following format must be used to identify the peaq DID method.

peaq-did = "did:peaq:" + id-string id-string  = 1* idcha idchar   = 1-9 / A-H / J-N / P-Z / a-k / m-z

Status of the Information

The initial version of the peaq DID, which includes requirements for successful onboarding and commercial operations connected to automobiles and vehicle charging stations, is constantly evolving.

This is a foundational draft that will be enhanced in later iterations to accommodate a wider range of use cases in an effort to make this DID standard more all-encompassing and durable, while taking the lessons learned into account. In later editions of this text, references to charging stations will be used more widely to refer to machines.

peaq DID Document Example

{ "id": "did:peaq:5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i, "controller": "did:peaq:5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i" "verificationMethod": [ { "id": "#pk1", "type": "Ed25519VerificationKey2020", "controller": "did:peaq:5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i", "publicKeyMultibase": "z5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i" }, { "id": "#pk2", "type":"Sr25519VerificationKey2020", "controller": "did:peaq:5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i", "publicKeyMultibase": "z5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i" } ], "signature" : { type: "Ed25519VerificationKey2020", issuer: "<did address of peaq>", hash: "<signature>" "service": [ { "id": "#payment", "type": "payment", "serviceEndpoint": "5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i" } { "id": "#p2p", "type": "p2p", "serviceEndpoint" : "/ipv4/w.x.y.z/tcp/port/p2p-circuit/p2p/QmPublicKey" } { "id": "#metadata", "type": "metadata", "model": "HJ890", "status": "ON" "serviceEndpoint" : "http://api.charging-station.com/metadata" } ], "authentication": [ "#pk1", "#pk2" ] }

In light of our use case for charging stations, the following are a few important lessons from the example given above.

  • Metadata regarding the machine/charging station can be retrieved from the service object with id and type set to metadata. The returned metadata is encoded using Protobuf and bears the following structure.

The address listed under "serviceEndpoint" that corresponds to the service of type "payment" and id "#payment" can be used to ask the charging station to begin the charging process and to obtain the multi-sign wallet address.

There should be a p2p service available that enables others to talk to this thing via libp2p networking. All subsequent conversations will be conducted through the channels set up using this service.

peaq Pallet DID

Introduction

The peaq DID standard enables machines to find one another, conduct transactions, validate assertions, protect privacy, and maintain sovereignty.

The peaq DID offers standardized interfaces for discovery that allow two participants to successfully engage in a transaction through a coalition of numerous industry experts in the area of self-governing individuals. This is one of our primary core values.

Notes

Please click here to jump directly to our GitHub repository

https://github.com/peaqnetwork/peaq-pallet-did

Installation

Import the pallet dependencies by adding below snippets to your runtime/src/Cargo.toml file

[dependencies.peaq-pallet-did] default-features = false git = 'https://github.com/peaqnetwork/peaq-pallet-did.git' version = '0.0.1' [features] default = ['std'] runtime-benchmarks = [  'peaq-pallet-did/runtime-benchmarks', ] std = [ 'peaq-pallet-did/std', ]

Implement peaq DID pallet on your runtime by adding below snippets to runtime/src/lib.rs file.

Add peaqDid parameter type to the runtime construct on your runtime/src/lib.rs file using below snippet.

Implement peaq DID pallet on your runtime

# --snip-- peaqDid: peaq_pallet_did::{Pallet, Call, Storage, Event<T>}, # --snip--

Usage

1. After installation, build your node 2. Run and connect your node to Polkadorjs App 3. Check for peaqDid under developer - Extrinsics tab.

Implementation:

For managing a DID, the current iteration of the DID pallet supports the following four extrinsics:

Add Attribute: Add the DID attribute that makes up the DID document.

  • Allow any attribute to be added.
  • No DID attribute validation.

Update Attribute: Update DID attribute already existing on the DID-document

  • Return Not Found Error if it doesn't exist.
  • Owner can only update their owned DID-documents.

Read Attribute:

  • Read DID attribute if it exists on the DID-document else return error.
  • Everyone can read DID-document.

Remove Attribute:

  • Delete DID attribute already existing on the DID-document.
  • Dispatch error if it doesn't exist.
  • Owner can only remove attributes they own.

The following sample schemas are based on active use cases being developed by peaq.

Consumer DID

{ "id": "did:pq:5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i", "service": [   { "id": "did:pq:5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i#payment", "type": "payment", "address": "5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i" } ] }

Provider DID

{ "id": "did:pq:3HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i", "service": [ { "id": "did:pq:3HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i#charging-station", "type": "service-offered", "serviceEndpoint": "http://device-url-out-of-peaq-network.some.domain.com/rest-schema" }, { "id": "did:pq:3HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i#metadata", "type": "metadata", "price": "10", "unit": "kWh" }, { "id": "did:pq:3HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i#payment", "type": "payment", "address": "5HRNr4pXH7PYKEmeW1jzJVxepXyg8w2Q3YpgRNHpH8foNr5i"  } ]

An Example of interacting with peaq DID Pallet

https://github.com/peaqnetwork/peaq-pallet-did



Did this page help you?
Yes
No
UP NEXT
peaq access (RBAC)
Docs powered by archbee 
Implement peaq DID pallet on your runtime