This project implements the following:
This project defines an extension on the did:ethr
method to support creation and retrieval of resources which are verifiably controlled by the given did:ethr
DID (DID Linked Resources).
DID Linked Resources can be used for many applications, however this project demonstrates how these resources can be used in an Anoncreds use case. This includes a full-flow Issuer/Holder/Verifier demo (with revocation support).
The demo within the Rust crate walks thru the following:
- Creating DID Resources for a did:ethr, and testing auth when the did:ethr controller changes
- Creating anoncred artifacts (schema, cred def, revocation registry def) and writing them to the registry
- Receiving and storing a credential which uses these anoncreds artifacts (i.e. demonstrating how they are read from the registry)
- Creating and verifying proof presentations of credentials which use these anoncreds artifacts
- Make revocation registry entries to revoke and un-revoke credentials
- Creating and verifying proof presentations with NRPs, including scanning the registry to find appropriate revocation status list entries to use for NRPs.
To setup and run the demo:
- create your
.env
file in the root of this project. Using.env.example
as an example. npm install
- within
smart-contracts
: use hardhat to run a local ledger in a seperate terminal:npx hardhat node
- within
smart-contracts
: use hardhat to deploy theEthrDIDLinkedResourcesRegistry
&EthereumDIDRegistry
contract to the local ledger:npx hardhat run --network localhost scripts/deploy.ts
- Lookup value
Contract address
in the output. You need to provide in the next step as env variable.
- Lookup value
- Update the output contract addresses with the contract addresses in your
.env
file - within
did_ethr_anoncreds_demo
: run the demo!:cargo run
As discussed in the did:ethr DID Linked Resource documentation, the DID Linked Resource resolver can be ran in "The Graph" mode. Running in this manner allows the resolver to retrieve resources more effectively, since it now relies on dedicated indexers.
Within the subgraph directory is a subgraph project which can be used to index the EthrDIDLinkedResourcesRegistry
smart contract.
When the subgraph is deployed, this demo can be ran in an alternative mode to utilize "The Graph" indexing.
- complete steps 1-5 of above
- clone the graph-node repo
- run the graph-node via docker compose (
cd docker && docker compose up
) - within the
example-subgraph
:- If your contract address for
EthrDIDLinkedResourcesRegistry
is different to the default, update the address in the subgraph.yaml - codegen
npm run codegen
- create the local subgraph:
npm run create-local
- deploy the local subgraph:
npm run deploy-local
- If your contract address for
- within the
did_ethr_anoncreds_demo
: run the demo with the graph feature enabled!:cargo run --features thegraph
- Anoncreds method registry: https://hyperledger.github.io/anoncreds-methods-registry/
did:cheqd
DID Linked Resources: https://docs.cheqd.io/identity/credential-service/did-linked-resources