From 12203d27528ad3afe199e0924148284c0bc7b854 Mon Sep 17 00:00:00 2001 From: Fred Chen Date: Mon, 25 Apr 2022 13:10:48 +0800 Subject: [PATCH] CU-2tyd7tq - Add the README to show how to generate SERVICE_DID and NODE_CREDENTIAL . --- config/README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 config/README.md diff --git a/config/README.md b/config/README.md new file mode 100644 index 00000000..85de5f85 --- /dev/null +++ b/config/README.md @@ -0,0 +1,82 @@ +Elastos Hive Node Configuration +=============================== + +To generate .env file for running the hive node manually, please check the file .env.sample. + +[didutils](https://github.com/elastos/Elastos.DID.Java.SDK/releases) tool can be used to generate some items, such as NODE_CREDENTIAL, etc. + +## SERVICE_DID + +Every hive node has a service DID which represents the hive node instance. SERVICE_DID is base58 string and its content comes from the data exported by `didutils`. Here is the example: + +```shell +$ ./didutils sh +Network: mainnet + +# create a new did locally which is used to generate the service DID +didshell $ id create userDid2 +Mnemonic: student world target pride pipe spare submit hour genuine enjoy brief ***** +Please write down your mnemonics safely!!! +Passphrase(enter for empty): +Password: +Confirm password: +Wallet 0x81bb9e89d73a72bd54397866bbe55c648e7**** created. +Identity userDid2:ee8c5edff928cf49d68e82f0d16d**** created. +DID did:elastos:ioyEoaqfLK8TYvNF4DtnR36Zc8u8p3**** created. +Switched to the identity: userDid2 + +# create the service DID +didshell $ did createappdid io.trinity-tech.example 619 +Password: +DID did:elastos:ipUGBPuAgEx6Le99f4TyDfNZtXVT2N**** created. + +DID document: +{ + # here is the content of the DID content. + # ...... +} + +# export the content of the service DID. +didshell $ did export -o ~/ipUGBPuAgEx6Le99f4TyDfNZtXVT2**** did:elastos:ipUGBPuAgEx6Le99f4TyDfNZtXVT2N**** +Export password: +Confirm export password: + +# please use the content of file ~/ipUGBPuAgEx6Le99f4TyDfNZtXVT2**** as service DID. +``` + +## NODE_CREDENTIAL + +NODE_CREDENTIAL is also base58 string which contains the credential issued by the owner DID and also generated by `didutils`. Here is the example: + +```shell +# ./didutils sh +Network: mainnet +Identity: userDid2, DID: did:elastos:ioyEoaqfLK8TYvNF4DtnR36Zc8u8p3**** + +# create the credential from current DID. +didshell $ vc issue did:elastos:ipUGBPuAgEx6Le99f4TyDfNZtXVT2N**** +Types(comma separated URI list): https://ns.elastos.org/credentials/hive/nodeowner/v1#HiveNodeOwnerCredential +Subject(JSON format): +Validation period(h/d/m/y): 3y +Credential did:elastos:ipUGBPuAgEx6Le99f4TyDfNZtXVT2NKXPR#B7fLV2XXjYkvpardVmXuep created. + +Credential: +# this is the expected credential content. +{ + "@context" : [ "https://www.w3.org/2018/credentials/v1", "https://ns.elastos.org/credentials/v1", "https://ns.elastos.org/credentials/hive/nodeowner/v1" ], + "id" : "did:elastos:ipUGBPuAgEx6Le99f4TyDfNZtXVT2N****#B7fLV2XXjYkvpardVmXuep", + "type" : [ "HiveNodeOwnerCredential", "VerifiableCredential" ], + "issuer" : "did:elastos:ioyEoaqfLK8TYvNF4DtnR36Zc8u8p3****", + "issuanceDate" : "2022-04-18T06:36:33Z", + "expirationDate" : "2025-04-18T06:36:33Z", + "credentialSubject" : { + "id" : "did:elastos:ipUGBPuAgEx6Le99f4TyDfNZtXVT2N****" + }, + "proof" : { + "type" : "ECDSAsecp256r1", + "created" : "2022-04-18T06:36:33Z", + "verificationMethod" : "did:elastos:ioyEoaqfLK8TYvNF4DtnR36Zc8u8p3****#primary", + "signature" : "7wGQIRnYFaKR-cQZSMBOoaMdI2luMOLu_PgzSDGePoZ3L-XaRYiNttCZtQkERo7-0_DGEivVik-ctTCEQo****" + } +} +```