Why is Go used for blockchain implementations?

agolangf · · 612 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;ve been looking into blockchain recently and I found that both ethereum and hyperledger seem to be implemented in Go. I don&#39;t have any experience with Go outside of reading the wikipedia page. Could someone explain why Go seems to be the language of choice for blockchain? (If this isn&#39;t the right places I apologize.)</p> <hr/>**评论:**<br/><br/>f2f: <pre><p>go is a language that allows you to quickly implement solutions without getting bogged down in details.</p> <p>go is an easy language to program in. perhaps not the most powerful, but when you need to get the job done in the right domain (which is pretty large) you may as well use it rather than wait out on alternatives.</p> <p>the most significant cons of all the other languages that came out at the same time Go did (mostly Rust) is that they don&#39;t consider a minimalistic set of orthogonal abstractions to be sufficient. they&#39;re ever evolving, ever more powerful, and nobody writes anything of value in them. &#34;servo&#34; was supposed to be completed in 2012...</p></pre>ithrowitontheground: <pre><p>So it&#39;s chosen because it is nice to write in basically? This makes sense as these projects are open source so it probably helps to get them more contributors. And because there isn&#39;t existing work in the domain with a standard language they basically got to choose? </p></pre>f2f: <pre><p>it also makes sense for large companies where barrier to entry must be kept low (you can&#39;t always attract the best coders) and where maintainability must be high (you come back to this code in 1 year you should be able to figure out what it does pretty quickly).</p> <p>it helps that services built in go are solid, to the tune of not having to reboot one in between major revisions of the language...</p></pre>DualRearWheels: <pre><blockquote> <p>and where maintainability must be high (you come back to this code in 1 year you should be able to figure out what it does pretty quickly)</p> </blockquote> <p>This is very very important for projects that have long life. It also very helps that Go is simple and has relatively small number of quirks you have to remember/rediscover after coming back to it after a pause. Also Go doesn&#39;t brakes language specs with new minor versions (1.x works without a hitch on all upgrades last 2 years). This makes Go perfect language for project you will maintain for a significant future.</p> <p>Most comparably new languages fail miserably in this regard (I&#39;m looking at you D) while Rust have its dose of criticism too (they introduced big changes after 1.0 release and subtly broke specs).</p></pre>siwu: <pre><blockquote> <p>Development of Servo began in 2013. The very first commit on 8 February 2012 did not contain any source code.[11] The first rudimentary code commit occurred on 27 March 2012.[12]</p> <p>On 3 April 2013 Mozilla announced that they and Samsung collaborate on Servo.[13][14]</p> <p>As of the 1st of July 2016, a preview version is available for download. This is marked as 0.0.1 and is available for Mac and Linux.</p> </blockquote></pre>shovelpost: <pre><p><a href="https://talks.golang.org/2012/splash.article" rel="nofollow">Go at Google: Language Design in the Service of Software Engineering</a></p></pre>PaulCapestany: <pre><p>&#34;Go was born out of frustration with existing languages and environments for systems programming. Programming had become too difficult and the choice of languages was partly to blame. One had to choose either efficient compilation, efficient execution, or ease of programming; all three were not available in the same mainstream language. Programmers who could were choosing ease over safety and efficiency by moving to dynamically typed languages such as Python and JavaScript rather than C++ or, to a lesser extent, Java.</p> <p>Go is an attempt to combine the ease of programming of an interpreted, dynamically typed language with the efficiency and safety of a statically typed, compiled language. It also aims to be modern, with support for networked and multicore computing. Finally, working with Go is intended to be fast: it should take at most a few seconds to build a large executable on a single computer. To meet these goals required addressing a number of linguistic issues: an expressive but lightweight type system; concurrency and garbage collection; rigid dependency specification; and so on. These cannot be addressed well by libraries or tools; a new language was called for.&#34;</p> <p>Source: <a href="https://golang.org/doc/faq#creating_a_new_language" rel="nofollow">Go FAQ</a></p></pre>natefinch: <pre><p>It&#39;s easy to write in, and statically linked binaries with easy cross compilation means it runs basically anywhere with no worries about a VM or runtime on the target machine. i.e. it&#39;s easy for end users to run it themselves, even if they&#39;re not developers.</p> <p>You can do similar things in other compiled languages (and even in some interpreted languages, with the right tooling), but it&#39;s not as straight forward. With go, it&#39;s easy and it&#39;s the default. </p></pre>PaulCapestany: <pre><blockquote> <p>I&#39;ve been looking into blockchain recently and I found that both ethereum and hyperledger seem to be implemented in Go</p> </blockquote> <p>As an aside, if you&#39;re looking into &#34;blockchain&#34;, I&#39;d be curious to know what aspect of the technology interests you, because I&#39;d argue that both Ethereum and Hyperledger are not very good examples of the tech. </p> <p>I&#39;d suggest taking a look at the <a href="https://bitcoin.org/bitcoin.pdf" rel="nofollow">original Bitcoin whitepaper</a>, and would point you to the Go implementation of Bitcoin: <a href="https://bitcoin.org/bitcoin.pdf" rel="nofollow">btcd</a></p></pre>FantomLancer: <pre><p>Why is ethereum and hyperledger not good examples? They are vastly more advanced than the bitcoin paper, though first and ground breaking, it is somewhat outdated.</p></pre>Zehurias: <pre><p>FWIW, there&#39;s a Rust Ethereum client called <a href="https://ethcore.io/parity.html" rel="nofollow">Parity</a>, and it&#39;s way faster than the other implementations, including the Go client, geth.</p></pre>warmans: <pre><p>My guess would be that a lot of people want to learn Go and use stuff like this as a relatively straightforward well defined problem to solve using the language. Some of them probably turn into proper projects once the author decides s/he likes Go enough to continue.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

612 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传