v2 Contract SDK
  • Orbs Contract SDK
  • Getting Started
    • About smart contracts
    • Becoming a Go developer
    • Installing Gamma - local blockchain
    • Deploying your first contract
    • The Orbs Starter Kit
    • Downloading the Contract SDK
  • Orbs Contracts
    • Smart contracts
    • Layout of a contract file
    • Data types (Exported Functions)
    • State
    • Address
    • Events
    • Error handling
    • Calling other contracts
    • Calling Ethereum contract
    • API Reference
    • Limitations of Orbs Contracts
    • Creating a new contract
  • Gamma in Depth
    • Starting and stopping the server
    • Test keys and accounts
    • Deploying smart contracts
    • Sending transactions and queries
    • Checking sent transaction status
    • Reading Logs from Contracts
    • Working with multiple environments
    • Upgrading to latest versions
    • Gamma server under the hood
    • Deploying Gamma in the Cloud
      • Amazon Web Services
      • Google Cloud Platform
      • Azure
Powered by GitBook
On this page
  • Installing Go
  • Verifying the installation
  • The Go workspace
  • Choosing an editor
  • Learning Go
  1. Getting Started

Becoming a Go developer

Contracts running on Orbs are developed in the Go programming language. This page will help you set up a working Go environment on your machine.

PreviousAbout smart contractsNextInstalling Gamma - local blockchain

Last updated 6 years ago

Installing Go

The recommended way to install Go on Mac is with

brew install go

If you prefer a regular package installer instead, those are available . If you run into trouble, go over the official Go .

Verifying the installation

Verify Go is installed correctly by running in terminal

go version

Any version above 1.11 should suffice.

The Go workspace

Go creates a workspace on your machine where source files should be placed. This is a bit different from other programming languages which are less opinionated about the location of your source files.

Unless configured explicitly otherwise, your Go workspace is found at

~/go/src

The common convention is to place files in a directory structure that mirrors easily to Github. If your Github username is johnsnow and your repo name is mycontract you should place your files at

~/go/src/github.com/johnsnow/mycontract

For more information about workspaces, consult the official Go .

Choosing an editor

brew cask install atom
apm install go-plus

Learning Go

One of the main benefits of the Go programming language is its simplicity. It should not require more than a few days to gain a firm grasp of the syntax.

If you don't feel like learning the language first that's also fine. Most of the contract examples are simple enough to understand without any prior knowledge.

Working with an that has good Go support is highly recommended for code completion, syntax highlighting and debugging.

is an excellent free editor which has Go support through the plugin. You can install both by running in terminal

Another free alternative is , which Go out of the box. A commercial alternative is by JetBrains. For the complete list of editors consult the official Go .

The official documentation contains a fantastic - an interactive tutorial that teaches the basics of the language in an hour or so. Another way to dive quickly into the language is using this which contains all syntax in one page.

brew
here
installation instructions
documentation
IDE
Atom
go-plus
VSCode
supports
GoLand
documentation
Tour of Go
cheat sheet