Home

Awesome

Indy-VDR (Verifiable Data Registry)

<img src="https://raw.githubusercontent.com/hyperledger/indy-node/master/collateral/logos/indy-logo.png" width="50%" height="auto">

Unit Tests Python Package

Introduction

This library is derived from Hyperledger Indy SDK for the more limited use case of connecting to an Indy Node blockchain ledger. It is written in Rust and currently includes a Python wrapper and a standalone proxy server.

This library is still in development and there are currently no standard release packages.

Features

Indy-VDR can be used to connect to one or more Indy Node ledger pools given sets of genesis transactions. Methods are provided to construct ledger requests and send them to the validators, collecting the results and ensuring that there is a consensus between the nodes.

Building from Source

First, you must have Rust installed. For development, we recommend VS Code with the RLS plugin.

The library and proxy server can be built by running cargo build in the root directory. To build only the library, use cargo build --lib. You can add --release to produce smaller, faster binaries but with less information available for debugging purposes.

This should compile and place the shared library and indy-vdr-proxy executable in the target/debug subdirectory. The library will be named as libindy_vdr.so on Linux, libindy_vdr.dll on Windows, and libindy_vdr.dylib on Mac OS.

Wrappers

The Python wrapper is located in wrappers/python/indy_vdr. In order for the wrapper to locate the shared library, the latter may be placed in a system shared library directory like /usr/local/lib. Otherwise, the location of the shared library must be added to the appropriate environment variable for your platform: PATH for Windows, LD_LIBRARY_PATH for Linux or DYLD_LIBRARY_PATH for Mac OS.

At a later stage it should be possible to install a precompiled 'wheel' package for your platform using pip install indy_vdr, but at the moment it is necessary to build the library from source.

Proxy Server

The indy-vdr-proxy executable can be used to provide a simple REST API for interacting with one or more Indy ledgers. Command line options can be inspected by running indy-vdr-proxy --help.

To start the proxy server for a single ledger use the following command:

indy-vdr-proxy -p <PORT> (-g <OPTIONAL_PATH_TO_GENESIS_FILE>)

To start the proxy server with the standard configuration of indy ledgers use the following command: indy-vdr-proxy -p <PORT> -- --multiple-ledgers This will get the ledger configuration from https://github.com/IDunion/indy-did-networks

A custom ledger configuration can be provided either by specifying a Github repo or a local folder:

indy-vdr-proxy -p <PORT> -g <GITHUB_URL or PATH_TO_FOLDER> -- --multiple-ledgers

The structure needs to be as follows <NAMESPACE>/OPTIONAL<SUB_NAMESPACE>/pool_transactions_genesis.json, e.g. /sovrin/staging/pool_transactions_genesis.json

Responses can be formatted in either HTML or JSON formats. HTML formatting is selected when the text/html content type is requested according to the Accept header (as sent by web browsers) or the request query string is set to ?html. JSON formatting is selected otherwise, and may be explicitly selected by using the query string ?raw. For most ledger requests, JSON responses include information regarding which nodes were contacted is returned in the X-Requests header.

Sending prepared requests to the ledger is performed by delivering a POST request to the {LEDGER}/submit endpoint, where the body of the request is the JSON-formatted payload. Additional endpoints are provided as shortcuts for ledger read transactions:

If the proxy server is used with a single ledger, the {LEDGER} part of the path must be omitted.

DID:Indy Resolver

Indy VDR contains a DID Resolver to resolve DIDs and dereference DID Urls to ledger objects from configured ledgers according to the did:indy specification.

GET /1.0/identifiers/{DID or DID_URL}

Connecting to a Ledger

Whether using the library or the proxy server, you will need a genesis.txn file containing the set of pool genesis transactions. You can run a local pool in Docker using VON-Network or follow the Indy-SDK instructions.

However the library is used, the RUST_LOG environment variable may be set in order to adjust the volume of logging messages produced. Acceptable values are error, warn, info, debug, and trace. The RUST_BACKTRACE environment variable may also be set to full for extended output in the case of fatal errors.

How to Contribute