Monday, August 13, 2018

Starting the Hyperledger Indy test pool reachable on your WIFI network






Hyperledger Indy's README.md explains how to start the @Sovrin test pool on localhost using docker and in a docker network.


Doing it this way the pool is not reachable from clients that are not on your local machine.
Building a mobile app then has the problem that the phone can't talk to the test pool because neither localhost nor the private docker network are reachable.

Starting the test pool on a specific IP address

Dockerfile ci/indy-pool.dockerfile supports an optional pool_ip param that allows changing the IP address of the pool nodes in the generated pool configuration.

You can start the pool with e.g. the IP address of your development machine's WIFI interface so that mobile apps in the same network can reach the pool.

# replace 192.168.179.90 with your wifi IP address
docker build --build-arg pool_ip=192.168.179.90 -f ci/indy-pool.dockerfile -t indy_pool .
docker run -itd -p 192.168.179.90:9701-9708:9701-9708 indy_pool
 
To connect to the pool the IP addresses in /var/lib/indy/sandbox/pool_transactions_genesis (in docker) and the pool configuration you use in your mobile app must match.

Here is some Java code that creates a pool configuration. Be sure to put your IP address in there when you open the pool connection.

-------

Please contribute to Indy. Even if your company does not allow you to publish code please consider helping by improving the documentation.
Please sign-off your commits. git commit -s -m 'my first commit' README.md

Monday, August 06, 2018

Building an Android App with Sovrin





Thanks to the hard work of Mohammad Abdul Sami Sovrin enthusiasts now have support building libindy for Android in the master branch of our repo.


You can now build the libindy libraries for Android by just running a script. Yeah!
If you want to spare that building process you can download the libraries from Evernym. Thanks!

Now what? You have a libindy.so for arm, arm64 and x86, but how do you use it?

I have created an Android Studio sample application DroidLibIndy that you might use as a starting point (if you don't like reading blog posts).

Still reading? Here is a list of quirks you need in your flashy new Indy-App.

  1. First you have to put the libindy library into the correct jni folder e.g.:
    app/src/main/jniLibs/arm64-v8a
    This other way to do this did not work for me.
  2. Source code and Target compatibility have to be Java 1.8
    Otherwise CompletableFuture and other stuff do not compile
  3. You need a network security policy because libindy secures its communication using zeromq and Android only accepts HTTPS as a secure protocol.
  4. You might need a lint.xml to get JNA linked.
  5. Copy libindy's Java wrapper code to your project using the path org/hyperledger/indy/sdk.
    cp -r ~pathto/indy-sdk/wrappers/java/src/main/java/org/ pathtoyourapp/app/src/main/java/
    I did not try the maven route here.
  6. In your app's onCreate method set the environment variable 'EXTERNAL_STORAGE'
  7. Of course you need to have all the dependencies configured in your build system.
As always: PRs are welcome! Please contribute to libindy. It's easy.

Have fun exploring Hyperledger Indy on Android!