hypersign-protocol / hid-node

A permissionless blockchain network to manage digital identity and access rights
https://hypersign.id
Apache License 2.0
223 stars 23 forks source link

Demo based on paying tx fee for other #98

Closed Vishwas1 closed 2 years ago

arnabghose997 commented 2 years ago

Workflow of authz and feegrant module

We will be looking at how an Identity Provider will perform the DID Creation Transaction on behalf of its User

Let's assume the following roles who have their wallets created on Hypersign Identity Network:

  1. IdP (Identity Provider whose role will be of a Granter)
  2. User (Grantee, on whose behalf the transaction will be performed)

Steps:

  1. IdP provides the necessary authorization to User by using the authz module:
hid-noded tx authz grant <User> generic --from <IdP> --msg-type "/hypersignprotocol.hidnode.ssi.MsgCreateDID"
  1. IdP then provides FeeAllowance to User, where it can specify the fee spend limit
hid-noded tx feegrant grant <IdP> <User> --spend-limit 1000uhid
  1. Generate the transaction which states that the IdP will be creating the DID
hid-noded tx ssi create-did '{
"context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/v1",
"https://schema.org"
],
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52",
"controller": ["did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52"],
"alsoKnownAs": ["did:hs:1f49341a-de30993e6c52"],
"verificationMethod": [
{
"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4",
"type": "Ed25519VerificationKey2020",
"controller": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52",
"publicKeyMultibase": "z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4"
}
],
"service": [{
"id":"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#vcs",
"type": "LinkedDomains",
"serviceEndpoint": "https://example.com/vc"
},
{
"id":"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#file",
"type": "LinkedDomains",
"serviceEndpoint": "https://example.in/somefile"
}
],
"authentication": [
"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4"
]
}' did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4 --ver-key <private-key> --generate-only > tx.json
  1. Broadcast the DID transaction to the Blockchain. This will be performed by the User and IdP will act as the fee account
hid-noded tx authz exec tx.json --from <User> --fee-account <IdP>