{"id":1789,"date":"2018-01-23T00:12:42","date_gmt":"2018-01-23T00:12:42","guid":{"rendered":"http:\/\/www.talkcrypto.org\/blog\/?p=1789"},"modified":"2018-02-06T01:11:03","modified_gmt":"2018-02-06T01:11:03","slug":"what-is-geth","status":"publish","type":"post","link":"https:\/\/www.talkcrypto.org\/blog\/2018\/01\/23\/what-is-geth\/","title":{"rendered":"What is Geth?"},"content":{"rendered":"<p>Understanding how to download and interact with the Ethereum blockchain is a crucial part for anyone learning Ethereum.<\/p>\n<p>There are several popular clients to work with the Ethereum blockchain. They are:<\/p>\n<ul>\n<li>eth &#8211; a client written in C++<\/li>\n<li>geth &#8211; a client written in Go<\/li>\n<li>pyethapp &#8211; a client written in python<\/li>\n<\/ul>\n<p>There&#8217;s also Haskell and Java. There is a more detailed description <a href=\"https:\/\/ethereum.stackexchange.com\/questions\/269\/what-exactly-is-an-ethereum-client-and-what-clients-are-there\" target=\"_blank\" rel=\"noopener\">here<\/a>.\u00a0Here we will focus on Geth.<\/p>\n<h4>What is Geth?<\/h4>\n<p><span class=\"_Tgc _s8w\">Geth is a multipurpose command line tool that runs a full Ethereum node implemented in Go. It offers three interfaces: the command line subcommands and options, a Json-rpc server and an interactive console.<\/span><\/p>\n<h4>Downloading Geth<\/h4>\n<p>There are several ways to download Geth. One is to visit\u00a0https:\/\/geth.ethereum.org\/downloads\/ and download the latest version suitable for your OS.<\/p>\n<p>Another option is to use brew for OSX users. Follow the instructions <a href=\"https:\/\/github.com\/ethereum\/go-ethereum\/wiki\/Installation-Instructions-for-Mac\" target=\"_blank\" rel=\"noopener\">here<\/a>. With brew, the steps are essentially:<\/p>\n<ul>\n<li>brew tap ethereum\/ethereum<\/li>\n<li>brew install ethereum<\/li>\n<\/ul>\n<p>What this does is install the geth client at \/usr\/local\/Cellar\/ethereum\/1.7.3\/bin<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-1792 size-large\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.25.26-PM-1024x398.png\" alt=\"\" width=\"940\" height=\"365\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.25.26-PM-1024x398.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.25.26-PM-300x117.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.25.26-PM-768x299.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.25.26-PM.png 1280w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/p>\n<p>Then you can go to your terminal and run<\/p>\n<p>&gt;&gt; geth<\/p>\n<p>When you run this command, geth will start downloading the entire blockchain onto your laptop. The location of the chaindata will be shown in the terminal window. Mine for example was:\u00a0database=\/Users\/cloudnthings\/Library\/Ethereum\/geth\/chaindata<\/p>\n<p>Once this is running, you should see your chaindata folder start increasing in size. To get the status of the synchronisation, open another terminal and connect to the geth client. This opens up a geth javascript console.<\/p>\n<p>&gt;&gt; geth attach<\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-1793 size-large\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.30.41-PM-1024x228.png\" alt=\"\" width=\"940\" height=\"209\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.30.41-PM-1024x228.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.30.41-PM-300x67.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.30.41-PM-768x171.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.30.41-PM.png 1390w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/p>\n<p>Once connected, run eth.syncing to get the current block and the highest block.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-medium wp-image-1794\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.36.21-PM-300x200.png\" alt=\"\" width=\"300\" height=\"200\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.36.21-PM-300x200.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-12.36.21-PM.png 390w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Note that this your CPU load is going to go through the roof as geth kicks into life as you download the entire blockchain.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1797\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-1.09.35-PM-300x36.png\" alt=\"\" width=\"300\" height=\"36\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-1.09.35-PM-300x36.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-1.09.35-PM-768x93.png 768w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-1.09.35-PM.png 976w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>To find out the number of peers you are connected to run:<\/p>\n<p>&gt;&gt; net.peerCount<\/p>\n<h4><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1798\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-1.22.07-PM.png\" alt=\"\" width=\"125\" height=\"57\" \/><\/h4>\n<p>If you have Mist or Ethereum Wallet, you can open it up and you should see the same download status.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1799 size-full\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-1.21.31-PM.png\" alt=\"\" width=\"593\" height=\"238\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-1.21.31-PM.png 593w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-1.21.31-PM-300x120.png 300w\" sizes=\"(max-width: 593px) 100vw, 593px\" \/><\/p>\n<h4>Testnet<\/h4>\n<p>So far we have been using main net or the live blockchain. For development purposes, the best option is to run geth in testnet mode like so:<\/p>\n<p>&gt;&gt; geth &#8211;testnet<\/p>\n<p>This will take less space and sync even faster.<\/p>\n<p>To go hyper speed, try:<\/p>\n<p>&gt;&gt; geth &#8211;testnet\u00a0<span class=\"s1\">&#8211;syncmode &#8220;fast&#8221;<\/span><\/p>\n<p>Note that sometimes you might run into errors such as &#8220;<span class=\"s1\">Synchronisation failed, dropping peer&#8221; or &#8220;<\/span><span class=\"s1\">Ancestor below allowance&#8221;.\u00a0 This will mainly be due to no peers being available so you&#8217;ll just have to be patience and wait. Here I had to wait 20 minutes.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1806 size-large\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-3.01.33-PM-1024x74.png\" alt=\"\" width=\"940\" height=\"68\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-3.01.33-PM-1024x74.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-3.01.33-PM-300x22.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-3.01.33-PM-768x56.png 768w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1807 size-large\" src=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-3.01.07-PM-1024x102.png\" alt=\"\" width=\"940\" height=\"94\" srcset=\"https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-3.01.07-PM-1024x102.png 1024w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-3.01.07-PM-300x30.png 300w, https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/Screen-Shot-2018-01-22-at-3.01.07-PM-768x76.png 768w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/p>\n<p>&gt; geth attach ipc:\/Users\/&lt;username&gt;\/Library\/Ethereum\/testnet\/geth.ipc<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Understanding how to download and interact with the Ethereum blockchain<\/p>\n","protected":false},"author":1,"featured_media":1808,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1789","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ethereum"],"featured_image_urls":{"full":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang.jpg",300,173,false],"thumbnail":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang-150x150.jpg",150,150,true],"medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang-300x173.jpg",300,173,true],"medium_large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang.jpg",300,173,false],"large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang.jpg",300,173,false],"1536x1536":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang.jpg",300,173,false],"2048x2048":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang.jpg",300,173,false],"chromenews-featured":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang.jpg",300,173,false],"chromenews-large":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang.jpg",300,173,false],"chromenews-medium":["https:\/\/www.talkcrypto.org\/blog\/wp-content\/uploads\/2018\/01\/golang.jpg",300,173,false]},"author_info":{"info":["seandotau"]},"category_info":"<a href=\"https:\/\/www.talkcrypto.org\/blog\/category\/ethereum\/\" rel=\"category tag\">Ethereum<\/a>","tag_info":"Ethereum","comment_count":"7","_links":{"self":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/1789","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=1789"}],"version-history":[{"count":6,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/1789\/revisions"}],"predecessor-version":[{"id":1816,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/posts\/1789\/revisions\/1816"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media\/1808"}],"wp:attachment":[{"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/media?parent=1789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/categories?post=1789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.talkcrypto.org\/blog\/wp-json\/wp\/v2\/tags?post=1789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}