{"id":1940,"date":"2018-06-13T02:39:35","date_gmt":"2018-06-13T02:39:35","guid":{"rendered":"http:\/\/www.talkcrypto.org\/blog\/?p=1940"},"modified":"2018-07-06T21:42:41","modified_gmt":"2018-07-06T21:42:41","slug":"hashgraph-hello-world","status":"publish","type":"post","link":"https:\/\/www.talkcrypto.org\/blog\/2018\/06\/13\/hashgraph-hello-world\/","title":{"rendered":"Hashgraph Hello World"},"content":{"rendered":"<p>If you&#8217;ve heard about Hashgraph and wondering how to get started, here is a little guide based off the docs provided in the SDK. Running the demo is easy but preparing your system can take a little bit of time. (Just like cooking!)<\/p>\n<p>A good place to start is\u00a0<a href=\"https:\/\/www.hederahashgraph.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.hederahashgraph.com\/<\/a>\u00a0where you can read a bit about it but there is a section for developers which points you to\u00a0<a href=\"https:\/\/dev.hashgraph.com\/\" target=\"_blank\" rel=\"noopener\">https:\/\/dev.hashgraph.com\/<\/a>\u00a0which is where the good stuff is.<\/p>\n<p>There is a &#8220;How do I get started?&#8221; section which is where you &#8230; start. The instructions are at:\u00a0<a href=\"https:\/\/dev.hashgraph.com\/docs\/installation\/\" target=\"_blank\" rel=\"noopener\">https:\/\/dev.hashgraph.com\/docs\/installation\/<\/a><\/p>\n<h2>Pre flight check list<\/h2>\n<h3>Step 1: JDK 8<\/h3>\n<p>You need at least JDK 8 otherwise you&#8217;ll get an error like this:<\/p>\n<pre class=\"p1\"><span class=\"s1\">&gt; cloudnthings$ java -jar swirlds.jar <\/span>\r\n<span class=\"s1\">&gt; Exception in thread \"main\" java.lang.UnsupportedClassVersionError: com\/swirlds\/platform\/Browser :\r\n Unsupported major.minor version 52.0<\/span><\/pre>\n<p>If you are on a Mac, you want to run:<\/p>\n<pre>&gt; java -version\r\n<span class=\"s1\">java version \"1.8.0_171\"<\/span>\r\n<span class=\"s1\">Java(TM) SE Runtime Environment (build 1.8.0_171-b11)<\/span>\r\n<span class=\"s1\">Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)<\/span><\/pre>\n<p>and make sure you get a response like above. Otherwise go to <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk8-downloads-2133151.html\" target=\"_blank\" rel=\"noopener\">Oracle<\/a>\u00a0and download the Java SE Development Kit.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-1941 \" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-1.43.25-PM.png\" alt=\"\" width=\"782\" height=\"426\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-1.43.25-PM.png 1104w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-1.43.25-PM-300x164.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-1.43.25-PM-768x419.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-1.43.25-PM-1024x558.png 1024w\" sizes=\"(max-width: 782px) 100vw, 782px\" \/><\/p>\n<p>Go through the installation process and you should see a folder called\u00a0jdk1.8.0_171.jdk at \/Library\/Java\/JavaVirtualMachines\/<\/p>\n<p>Run the java -version command again to verify.<\/p>\n<h3>Step 2: JCE Unlimited Policy for Java 8<\/h3>\n<p>Next download\u00a0Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 8 from <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jce8-download-2133166.html\" target=\"_blank\" rel=\"noopener\">here<\/a>\u00a0and paste it to\u00a0\/Library\/Java\/JavaVirtualMachines\/jdk1.8.0_161.jdk\/Contents\/Home\/jre\/lib\/security\/policy\/unlimited. Otherwise you&#8217;ll get this error.<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-1943 size-large\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-11.00.09-AM-1024x388.png\" alt=\"\" width=\"940\" height=\"356\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-11.00.09-AM-1024x388.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-11.00.09-AM-300x114.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-11.00.09-AM-768x291.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-11.00.09-AM.png 1652w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/p>\n<p>Note: When I tried to do a clean install of Java and repeat the process from scratch I found that I didn&#8217;t get this error which is a little strange.\u00a0I found the 2 files were already at: \/Library\/Java\/JavaVirtualMachines\/jdk1.8.0_161.jdk\/Contents\/Home\/jre\/lib\/security\/policy\/unlimited<\/p>\n<h3>Step 3: Download the SDK<\/h3>\n<p>Go to\u00a0<a href=\"https:\/\/www.swirlds.com\/download\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.swirlds.com\/download\/<\/a>\u00a0and download the SDK, extract it and then navigate to the sdk folder and run the following command in step 4 in a terminal.<\/p>\n<h3>Step 4: Run this command<\/h3>\n<pre>&gt; java -jar swirlds.jar<\/pre>\n<p>This is what you should see:<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-1944 size-full\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-2.36.24-PM.png\" alt=\"\" width=\"1849\" height=\"1037\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-2.36.24-PM.png 1849w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-2.36.24-PM-300x168.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-2.36.24-PM-768x431.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-14-at-2.36.24-PM-1024x574.png 1024w\" sizes=\"(max-width: 1849px) 100vw, 1849px\" \/><\/p>\n<p>Congrats! You have your first Hashgraph application up and running. This is called the &#8220;Stats Demo&#8221; and is the default demo that runs when the\u00a0\u00a0&gt; java -jar swirlds.jar command is run or if the swirlds.jar file is double clicked.<\/p>\n<p>It displays basic statistics such as:<\/p>\n<ul>\n<li>number of corrupted events received per second<\/li>\n<li>average number of bytes per second transfered during a sync<\/li>\n<li>number of bytes in the transactions received per second (from unique<\/li>\n<li>events created by self and others)<\/li>\n<li>number of bytes in each transactions<\/li>\n<li>number of events per second created by this node<\/li>\n<li>number of times a TLS connections was created<\/li>\n<li>percentage of events received that are already known<\/li>\n<\/ul>\n<p>This is neat but let&#8217;s get the &#8220;Hello World&#8221; or in this case &#8220;Hello Swirlds&#8221; app going.<\/p>\n<h3>Step 5: Hello Swirlds<\/h3>\n<p>Quit the Stats Demo application with command+q or ctrl+c in terminal and open up config.txt<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1953\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-15-at-8.59.53-AM-217x300.png\" alt=\"\" width=\"217\" height=\"300\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-15-at-8.59.53-AM-217x300.png 217w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-15-at-8.59.53-AM.png 392w\" sizes=\"(max-width: 217px) 100vw, 217px\" \/><\/p>\n<p>Uncomment by removing the &#8220;#&#8221; from line 8 &#8220;app, HelloSwirldDemo.jar&#8221; and re-comment out by typing # in front of line 10 &#8220;#app, StatsDemo.jar&#8221;. Save the file and then re-run the application and you should get this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1954 size-large\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-15-at-9.01.11-AM-1024x150.png\" alt=\"\" width=\"940\" height=\"138\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-15-at-9.01.11-AM-1024x150.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-15-at-9.01.11-AM-300x44.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/Screen-Shot-2018-06-15-at-9.01.11-AM-768x113.png 768w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/p>\n<p>You&#8217;ll see I&#8217;ve been a bit crafty and changed the name Alice to Seandotau. This was just another simple change in the config.txt file.<\/p>\n<h3>Summary<\/h3>\n<p>If you had Java 8 and the\u00a0Java Cryptography Extension already, this demo would have taken only about 5 minutes to spin up. It&#8217;s a neat way to see something in action for yourself in a few simple steps. Keep experimenting, and remember, learning is doing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;ve heard about Hashgraph and wondering how to get<\/p>\n","protected":false},"author":1,"featured_media":1945,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-1940","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dlt"],"featured_image_urls":{"full":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds.jpg",171,300,false],"thumbnail":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds-150x150.jpg",150,150,true],"medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds-171x300.jpg",171,300,true],"medium_large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds.jpg",171,300,false],"large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds.jpg",171,300,false],"1536x1536":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds.jpg",171,300,false],"2048x2048":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds.jpg",171,300,false],"chromenews-featured":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds.jpg",171,300,false],"chromenews-large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds.jpg",171,300,false],"chromenews-medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/06\/swirlds.jpg",171,300,false]},"author_info":{"info":["seandotau"]},"category_info":"<a href=\"https:\/\/www.talkcrypto.org\/blog\/category\/dlt\/\" rel=\"category tag\">DLT<\/a>","tag_info":"DLT","comment_count":"1","_links":{"self":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/1940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/comments?post=1940"}],"version-history":[{"count":10,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/1940\/revisions"}],"predecessor-version":[{"id":1993,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/1940\/revisions\/1993"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media\/1945"}],"wp:attachment":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media?parent=1940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/categories?post=1940"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/tags?post=1940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}