+ +

Getting started

+ +

+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. +

+ +

Getting the package

+ +Use go's package manager to fetch the go-ethereum package: +
go get github.com/ethereum/go-ethereum
+ +Verify the installation with a simple ethereum.go example program: +
package main
+
+import (
+    "fmt"
+    "github.com/ethereum/go-ethereum/eth"
+)
+
+func main() {
+    fmt.Println("Hello ethereum:", eth.Version)
+}
+ +And verify the output: +
go run ethereum.go # Hello ethereum: 1.x.x
+ + +

Setting up a node

+ +
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()
+}
+ + + +