<!DOCTYPE html> <html lang="en-us"> <head> <meta charset="UTF-8"> <title>Ethereum</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" href="stylesheets/normalize.css" media="screen"> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" media="screen"> <link rel="stylesheet" type="text/css" href="stylesheets/github-light.css" media="screen"> <link rel="stylesheet" href="https:////cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/styles/default.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> </head> <body> <section class="page-header"> <h1 class="project-name">Ethereum</h1> <h2 class="project-tagline">Official golang implementation of the Ethereum protocol</h2> <a href="https://github.com/ethereum/go-ethereum" class="btn">View on GitHub</a> <a href="https://github.com/ethereum/go-ethereum/releases/latest" class="btn">Download</a> <a href="https://github.com/ethereum/go-ethereum/tarball/master" class="btn">Download source</a> </section> <section class="main-content"> <h1><a id="getting-startid" class="anchor" href="#getting-started" aria-hidden="true"><span class="octicon octicon-link"></span></a>Getting started</h1> <p> This is the official Ethereum documentation for the Go implementation. This document will help you get started and will guide you in familiarising with the Go API. </p> <h1><a id="getting-the-api" class="anchor" href="#getting-the-api" aria-hidden="true"><span class="octicon octicon-link"></span></a>Getting the package</h1> Use go's package manager to fetch the <code>go-ethereum</code> package: <pre><code>go get github.com/ethereum/go-ethereum</code></pre> Verify the installation with a simple <code>ethereum.go</code> example program: <pre><code class="go">package main import ( "fmt" "github.com/ethereum/go-ethereum/eth" ) func main() { fmt.Println("Hello ethereum:", eth.Version) }</code></pre> And verify the output: <pre><code class="sh">go run ethereum.go # Hello ethereum: 1.x.x</code></pre> </div> <h1><a id="creating-a-node" class="anchor" href="#creating-a-node" aria-hidden="true"><span class="octicon octicon-link"></span></a>Setting up a node</h1> <pre><code class="go">package main import ( "gitub.com/ethereum/go-ethereum/eth" ) func main() { // setup ethereum. the rest of the defaults will be picked for us // (port, host, ipc, etc). Second argument is the type of node; full/light err := eth.New(eth.Config{ Name: "My ethereum node", }, eth.Light) if err != nil { logger.Fatalln(err) } // let eth handle shutdowns eth.WaitForShutdown() }</code></pre> <footer class="site-footer"> <span class="site-footer-owner"><a href="https://github.com/ethereum/go-ethereum">Ethereum</a> is maintained by <a href="https://github.com/ethereum/go-ethereum/graphs/contributors"> the go ethereum team</a>.</span> <span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a> using the <a href="https://github.com/jasonlong/cayman-theme">Cayman theme</a> by <a href="https://twitter.com/jasonlong">Jason Long</a>.</span> </footer> </section> </body> </html>