Permission Problem

You don't have permission to do that.

Want to deploy the Hashgraph SDK on your Raspberry Pi?

HashSlingingGrapherHashSlingingGrapher Posts: 2
edited October 2018 in Community Blog
This is a fun project that you can do very easily. If you're interested in running the Hashgraph SDK on a  Raspberry Pi - give this a shot!

This was originally posted on Talk Crypto - if you want to learn more, please check it out! 

If you have a Raspberry Pi lying around and fancy seeing if you can get the Hashgraph sdk running on it, here is how.

STEP 1: CHECK IF JAVA IS PRESENT AND IF IT IS 1.8+

If you are running Raspbian Stretch, it will have Java 8 already on it. Otherwise you’ll have to download it at  Oracle

The location of Java on the Pi is: /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt

STEP 2: GET THE SDK

Run:
> wget https://www.swirlds.com/downloads/Swirlds%20SDK%20-%20version%2018.05.23.zip
If you try running the sdk:

> jav -jar swirlds.jar

and get this error:

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

Make sure you have set JAVA_HOME correctly. To set it run:

> nano ~/.profile
and add this line at the bottom of the file:
export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt
Take care of arm32 if you copied the command from another website.

Test by running:
> echo $JAVA_HOME
> /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt

STEP 3: DOWNLOAD JCE

If you try and run it now, you’ll probably get this error:

***************************************************************************
* ERROR: Please install the Oracle JCE Unlimited Jurisdiction Policy files.
* They can be downloaded as a single .zip file from:
*     http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
* If that address doesn't work, then click on the DOWNLOAD button 
* next to the JCE Unlimited Strength link in the Additional Resources 
* section of this page:
*     http://www.oracle.com/technetwork/java/javase/downloads
* Then unzip the downloaded .zip file, and move the two .jar files into:
*      /home/pi/Downloads/sdk/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/security
* Please make sure they are legal in your country before installing.
***************************************************************************

Download Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 8 from here and paste it to /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre/lib/security.

Now it should work but you’ll get null pointer exception errors.

This is because the code is trying to execute console.out.println(“Hello Swirld from “ + myName); at line 68 and it can’t because there is no console. Go into the source file and comment this out with //. Do this for line 91 as well. 

Now it should work but you won’t see anything happening. If you run top, you should see Java consume 200% cpu but that is about it. The problem is that you’ve ssh’d into your Pi and there is no output console. To see some output, try step 4.

STEP 4: GETTING FUNKY

Go to sdk/source/HelloSwirldDemo/src and modify HelloSwirldDemoMain.java and add a system.out.println as shown below.

#console.out.println("Hello Swirld from " + myName);
System.out.println("Hello Swirld from " + myName);

STEP 5: INSTALLING MAVEN

Check if you have maven with:

[email protected]:~ $ mvn -v
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
Maven home: /opt/apache-maven-3.5.3
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.9.59-v7+", arch: "arm", family: "unix"

If you don’t get the above then download Maven first:
> wget http://www-us.apache.org/dist/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz
Extract to /opt:

> cd /opt
> sudo tar -xzvf /path/to/apache-maven-3.5.3-bin.tar.gz

Then you need to tell shell where to find maven. We’ll do this in the system profile settings so it is available to all users.

> sudoedit /etc/profile.d/maven.sh

and enter

export M2_HOME=/opt/apache-maven-3.2.5
export PATH=$PATH:$M2_HOME/bin

Source: https://xianic.net/2015/02/21/installing-maven-on-the-raspberry-pi/

STEP 6: COMPILING WITH MAVEN

Go back to the HelloSwirldDemo folder where there is a pom.xml file. Run:

mvn install

It can take anywhere between 20 seconds to 7 minutes….

Output

Here is a quick video sped up 20x:


https://www.youtube.com/watch?v=ly-wm3-GJFI&feature=youtu.be

Comments

  • George_ThielGeorge_Thiel Posts: 4
    edited October 2018
     Just an IDEA.  Or a request for some of you DAPP builders.  Some of us inverters would like to see an DAPP that wolud handle Self managed crypto IRA accounts.  Maybe the checkbook LLC type so as not to have to relinquish our personal Keys.  What you all think.  Is it doable?
Sign In or Register to comment.