Skip to content

Commit

Permalink
CU-2tyd7tq - Add the README to show how to generate SERVICE_DID and N…
Browse files Browse the repository at this point in the history
…ODE_CREDENTIAL .
  • Loading branch information
fred-yu-2013 authored and stiartsly committed Apr 25, 2022
1 parent 124c1c1 commit 12203d2
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions config/README.md
Original file line number Diff line number Diff line change
@@ -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****"
}
}
```

0 comments on commit 12203d2

Please sign in to comment.