Hyperledger

From OasisSoftTech.com - Knowledge Base/Java/Springframework/Microservices/Cloud-AWS/AI
Jump to: navigation, search

LibIndy SDK

Initial Setups

VirtualBox

details --> Oracle VM VirtualBox Manager

Ubuntu Image for VM and LibIndy

Ubutu 16.04 for VirtualBox , iso : http://releases.ubuntu.com/16.04/ Help for installation on VirtualBox : https://medium.com/@tushar0618/install-ubuntu-16-04-lts-on-virtual-box-desktop-version-30dc6f1958d0


LibIndy SDK

Official LibIndy SDK: https://github.com/hyperledger/indy-sdk

If you are upgrading from a previous version of VCX and VerityUI, you must remove existing packages before proceeding.

	sudo apt remove verity-ui
	sudo apt remove libvcx
	sudo apt remove libindy

Your wallets will be obsoleted, and must be re-provisioned.

Files included in this directory:

	EVERNYM_Eval License_Agreement...       	: The fine print   
	libvcx_0.1.27328536-fb7b7b6_amd64.deb   	: Installation binaries for the VCX SDK
	python3-vcx-wrapper_0.1.27328536.tar.gz 	: python3 wrapper for the SDK
        node-vcx-wrapper_0.1.27328536-fb7b7b6_amd64.tgz : Node.js wrapper for the SDK
	verity-ui_0.1.433_all.deb	            	: Installation binaries for Verity UI, the web interface
        libsovtoken_0.9.6_amd64.deb	          	: Token binary dependency of VCX

VCX is intended to be installed on Ubuntu 16.04.

libindy must be installed first. To do this, follow these steps in your Ubuntu 16.04 system:

	sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68DB5E88
	sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial stable"
	sudo apt-get update
	sudo apt-get install -y libindy=1.6.8

Install the Sovrin token and VCX binaries next:

	sudo dpkg -i libsovtoken_0.9.6_amd64.deb
	sudo dpkg -i libvcx_0.1.27328536-fb7b7b6_amd64.deb 
	sudo apt-get install -f

Unpack the wrappers where you want them. For example, for python:

	tar xzf python3-vcx-wrapper_0.1.27328536.tar.gz

Set up the necessary environment variables. In the following example, the path should be modified to point to the location where the wrapper was unpacked. For Python:

	echo 'export PYTHONPATH=$HOME/python3-vcx-wrapper-0.1.27328536' >> .bashrc
	source .bashrc

This completes the installation of libvcx.

In order to connect to the Sovrin validator pool, your script will need access to a "genesis" file that contains information on a core group of validators. Assuming that you will be using the Sovrin Test Network, the genesis file can be downloading it as follows, and putting the result into a file:

	curl -f https://raw.githubusercontent.com/sovrin-foundation/sovrin/stable/sovrin/pool_transactions_sandbox_genesis

Scripts based on the libvcx SDK require a configuration file as an input. In addition, a pairwise connection must be made with the agency server that will be used to pass messages to other agencies or agent endpoints like this one. Finally, a Sovrin wallet must be setup with the public and private keys that will be used for communications and signing within the Sovrin community. All of these steps are accomplished by executing a single script: provision_agent_keys.py.

Since the parameters used with this command are still evolving, it is recommended to check them before use by running:

	/usr/share/libvcx/provision_agent_keys.py --help

As of this writing, an example of typical usage is:

	/usr/share/libvcx/provision_agent_keys.py --wallet-name acme \
	--enterprise-seed wuuw3iuchai3Bou0fae3voh3Iequeuwu "https://eas01.pps.evernym.com" 12345

where: acme is the name of the wallet on the local device that will be used with this script(s) wuuw3iuchai3Bou0fae3voh3Iequeuwu is a 32-character seed that will be used to generate the public and private keys, including DIDs and verification keys. https://eas01.pps.evernym.com is the agency server that the script will pass its communications through. Consider this static for now. 12345 is a key that is used to encrypt the local wallet.

The provision_agent_keys.py script will output text that should be put into a configuration file for your script to access. There are 3 fields that require manual editing. In addition, two fields will need to be used to place required TRUST ANCHOR credentials onto the ledger. For example:

	{
	  "agency_did": "UNM2cmvMVoWpk6r3pG5FAq",
	  "agency_endpoint": "https://eas01.pps.evernym.com",
	  "agency_verkey": "FvA7e4DuD2f9kYHq6B3n7hE7NQvmpgeFRrox3ELKv9vX",
	  "institution_verkey": "BXtC4eJVpctLccpp87AwnCygPFwzdE4ugHBxMeAFR6oE",
	  "genesis_path": <Change Me>,
	  "institution_did": "LKpJgj5zdXLwge3udVJXDD",
	  "institution_logo_url": <Change Me>,
	  "institution_name": <Change Me>,
	  "remote_to_sdk_did": "DKNMBCookW3j4gn4yiV1hG",
	  "remote_to_sdk_verkey": "7iMaooqA6naAE833WDZZTzVXutbkSYgfREAvsQcpEEaY",
	  "sdk_to_remote_did": "7vxamnCvA1zCSND1NWe9Ct",
 	  "sdk_to_remote_verkey": "4n5hJAFvU5DJsWkE4XgR16C2p1GwJJEAyCQqYjwER2Sc",
	  "wallet_key": "12345",
	  "wallet_name": "acme"
	}

Be sure to update the fields marked <Change Me>. Also make note of the institution_did and institution_verkey, since you will need to add this DID to the ledger in order to be able to write any transactions to the ledger from your script(s).

To write the DID and verkey to the ledger, use the following URL, or if this fails email the DID and verkey to

support@sovrin.org
	https://s3.us-east-2.amazonaws.com/evernym-cs/sovrin-STNnetwork/www/trust-anchor.html

Inline documentation on the objects and methods in the libvcx library are inline in the code of the python nodejs wrappers at vcx/api for python, or package/dist/api for nodejs.

If you need to suppress RUST logging to console:

	echo 'export RUST_LOG=off' >> .bashrc