Skip to content

Proof of Concept implementation of did:ethr DID Linked Resources and an Anoncreds method

License

Notifications You must be signed in to change notification settings

gmulhearn/anoncreds-on-ethereum

Repository files navigation

did:ethr Linked Resources + did:ethr Anoncreds Method + Demo

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).

Demo

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.

Run

To setup and run the demo:

  1. create your .env file in the root of this project. Using .env.example as an example.
  2. npm install
  3. within smart-contracts: use hardhat to run a local ledger in a seperate terminal: npx hardhat node
  4. within smart-contracts: use hardhat to deploy the EthrDIDLinkedResourcesRegistry & 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.
  5. Update the output contract addresses with the contract addresses in your .env file
  6. within did_ethr_anoncreds_demo: run the demo!: cargo run

Demo with The Graph

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.

Local Graph Setup and Demo

  1. complete steps 1-5 of above
  2. clone the graph-node repo
  3. run the graph-node via docker compose (cd docker && docker compose up)
  4. within the example-subgraph:
    1. If your contract address for EthrDIDLinkedResourcesRegistry is different to the default, update the address in the subgraph.yaml
    2. codegen npm run codegen
    3. create the local subgraph: npm run create-local
    4. deploy the local subgraph: npm run deploy-local
  5. within the did_ethr_anoncreds_demo: run the demo with the graph feature enabled!: cargo run --features thegraph

Related

About

Proof of Concept implementation of did:ethr DID Linked Resources and an Anoncreds method

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published