Inspiration

At VeriDID, we are a startup specializing in custom verifiable credential management system development. We were inspired to use NEAR out of two concerns that we have. The first is that the existing blockchain used for AnonCreds verifiable credentials (Indy-Plenum) is slow, complicated, and is lacking maintainers and developers to keep up with the issues. Our second is that we want to be able to use our existing expertise in Javascript and Typescript to build smart contracts. We have Solidity experience, but we do not write contracts regularly and feel that staying in Javascript is a safer way to write secure contracts.

The use case came from an analysis of using Hyperledger Fabric for the mutual fund industry in Canada. The project did not go through as Fabric was deemed to complicated and expensive to run and it does not easily support business to consumer use cases.

What it does

The system uses verifiable credentials to send fund reports to dealer and regulators. The dealers can then share a proof of the report to their customer and the regulators can do the same for their auditors. The verifiable credentials are generated using a project called credo-ts that provides us with AnonCreds standard verifiable credentials and DIDComm communication for handling the credential issuing protocols. For this project we have swapped out the Indy-Plenum blockchain for NEAR with NEAR smart contracts. Indy-Plenum does not support smart contracts and uses some wrapper code on the nodes to handle the access controls. This is not ideal.

The process for sending the reports takes 6 steps. Only steps 6 and 7 are required after sending the first report.

  1. Instantiate a credential agent
  2. Connect the agent to another agent using an Out-Of-Band invitation
  3. Register a Decentralized Identifier for the report issuer using the NEAR Verifiable Data Registry (VDR) built with NEAR smart contracts.
  4. Register a credential schema for the report on the VDR
  5. Register a credential definition for the issuer's instance of the schema on the VDR
  6. Issue a verifiable credential to the connected agent
  7. The credential recipient can share the report with another agent using a proof presentation

How we built it

We built the NEAR smart contracts based on your documentation and examples. We based the behaviour on how AnonCreds credentials expect to interact with a blockchain. We used the credo-ts project to handle the cryptography involved in generating the credentials and for the DIDComm communication protocols for peer-to-peer agent communication. We used Nest.js for our servers and Next.js for web interfaces.

Challenges we ran into

Our prior experience with solidity and Javascript and your examples helped us in writing the smart contracts. However, we still found it tricky to get our heads wrapped around how NEAR contract work. We also found that writing the VDR, getting the agents working, and the web interfaces we a lot for the timeframe we set for ourselves.

Accomplishments that we're proud of

Even though this is our first set of contracts, the contracts perform their functions way faster than the Hyperledger Indy equivalents. We feel that this gives us leeway to add even more features.

What we learned

We learned a lot about NEAR smart contracts and the variety of node options that are available to developing a solution like our use case.

What's next for Decentralized Verifiable Investment Fund Reporting

We would like to build a more robust VDR on NEAR and provide modular libraries for other organizations to interact with it. We would like to contribute those modules to the credo-ts, veramo, and ACA-Py projects. That would allow other developers to use NEAR and to make sure that credential issued on NEAR will be verifiable across many verification projects.

Built With

Share this project:

Updates