Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: v0.0.3 #84

Merged
merged 16 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 48 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# hid-node
**hid-node** is a blockchain built using Cosmos SDK and Tendermint and created with [Starport](https://starport.com).
# Hypersign Identity Network
The Hypersign Identity Network is a permissionless blockchain network to manage digital identity and access rights. It aims to empower humans to gain control of their data and access on the internet by providing scalable, interoperable and secure verifiable data registry (VDR) to implement use cases on Self Sovereign Identity (SSI) principles. The Hypersign Identity Network is built using Cosmos-SDK and is fully compatible with W3C DID specification.

## Prerequisite

Following are the prerequisites that needs to be installed:

- golang (Installation Guide: https://go.dev/doc/install)
- golang (Installation Guide: https://go.dev/doc/install) (version: 1.17.2)
- starport (Installation Guide: https://docs.starport.network/guide/install.html)

## Get started
Expand All @@ -17,7 +17,7 @@ $ git clone https://github.com/hypersign-protocol/hid-node.git
$ cd hid-node
```

Run the following command to build the binary file and start the `hid-node` blockchain:
Run the following command to build the binary file and start the blockchain:
```
starport chain serve
```
Expand All @@ -28,24 +28,6 @@ The binary `hid-noded` will be generated in `$GO_PATH/bin` directory. To explore

To stop the blockchain, navigate to the terminal window where the blockchain is running, and hit `Ctrl+C`.

## Module Creation

Once we have scaffolded the chain using `starport`, a default module is always created if we scaffolded the chain without the `--no-module` flag. In our case, it will be `x/hidnode`. We can delete this module and its dependent files and folders, since it's not necessary.

Creating the module `did` is as follows:

```
$ starport scaffold module did
```

Now, to scaffold any structures such as `messages`, `types`, `list` etc., following needs to run:

```
$ starport scaffold message createDID did didDocString createdAt --module did
```
Notice the `--module` flag. This is required to specify the module for which we are scaffolding the structure


## Register DID

```sh
Expand All @@ -72,7 +54,9 @@ hid-noded tx ssi create-did '{
```
Note: While performing a CLI transaction, it is required to pass chain-id as `--chain-id hidnode` , as the default chain id set is `hid-node` which will cause the transaction to fail.

## Update DID
## Operations

### Update DID

After the DIDDoc is created from running the above command, making changes to it happens through the following CLI command:

Expand All @@ -97,10 +81,41 @@ hid-noded tx ssi update-did '{
"authentication": [
"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf"
]
}' did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf --ver-key oVtY1xceDZQjkfwlbCEC2vgeADcxpgd27vtYasBhcM/JLR6PnPoD9jvjSJrMsMJwS7faPy5OlFCdj/kgLVZMEg== --from alice --chain-id hidnode
}' <version-id> did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#zEYJrMxWigf9boyeJMTRN4Ern8DJMoCXaLK77pzQmxVjf --ver-key oVtY1xceDZQjkfwlbCEC2vgeADcxpgd27vtYasBhcM/JLR6PnPoD9jvjSJrMsMJwS7faPy5OlFCdj/kgLVZMEg== --from alice --chain-id hidnode
```

The second param `<version-id>` should be the version-id of the latest DID Doc.

The `context` field of the DIDDoc is now updated with a new entry: `"https://some.domain"`

### Deactivate DID

Run the following to deactivate the DID Document:

```sh
hid-noded tx ssi deactivate-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"
}
],
"authentication": [
"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4"
]
}' <version-id> did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4 --ver-key bZBUkLGChnJujYHUZ4L8PECoN2Odv6adWGXc1qVWCRVqtEx0o/FmtFZnd5pT3laR518P58TRUGY5q5KSrToSmQ== --from alice --chain-id hidnode --yes
```

## Resolve DID

There are two ways to resolve DID:
Expand All @@ -110,9 +125,17 @@ There are two ways to resolve DID:


**API**:

1. Retrieve a did Document by providing a Did ID:
```sh
curl -X GET "http://localhost:1318/hypersign-protocol/hidnode/ssi/did/queryDidDocById/did%3Ahs%3A0f49341a-20ef-43d1-bc93-de30993e6c51%3A" -H "accept: application/json"
curl -X GET "http://localhost:1318/hypersign-protocol/hidnode/ssi/did/did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52:" -H "accept: application/json"
```

2. Retrieve the count and list of did Documents:
```sh
curl -X GET "http://localhost:1318/hypersign-protocol/hidnode/ssi/did" -H "accept: application/json"
```

Note: The above curl command was taken from the Swagger UI of Blockchain API, where the `did` input parameter was entered along with an extra semicolon appended, because gRPC server has issues parsing the regular DID string.

**CLI**:
Expand Down
Loading