Golana - Golang on Solana

Develop on the fastest chain with the easiest language.

main.go
Golana.toml
type IxInit struct {
// List all the accounts that are used
user Account `account:"mut, signer"`
udata Account `account:"mut, signer" data:"userData"`
// List all the instruction parameters
count uint64
key PublicKey
}

Getting Started

Introduction

Golana is another SDK for Solana, akin to Anchor. It allows you to write smart contracts written in Go for Solana.

Installation

Step-by-step guides to setting up your system and installing the SDK.

Programming with Golana

Learn how to write Solana program with Golana

Solana as an OS

Understand Solana by viewing it as an OS

Solana as a serverless platform

Understand Solana by viewing it as a serverless platform


What is Golana

From users' perspective

From users' perspective, Golana is simply another SDK for Solana, akin to Anchor. It allows you to build, test, and deploy smart contracts written in Go, eliminating the need to learn Rust for Solana development if you are already familiar with Go.

Internals

The relationship between Golana and Solana is similar to the relationship between Java and Windows.

With a VM (written in C/C++) that runs on Windows and supports Java bytecode, the Java SDK enables people to build Java programs that run on Windows. In the case of Golana, it functions as an ordinary Solana Program, while it allows developers to create smart contracts in Go by embedding a Goscript VM (written in Rust) that executes Goscript bytecode.

image

Tools

The loader (the Goscript VM that runs on-chain) is deployed on the blockchain, so you don't need to make any preparations to access it unless you want to run tests locally. However, you do need to install the Golana SDK, which contains tools that can generate templates, run test cases, build and deploy your Golana project.

Goscript vs Go

Goscript closely follows the official pre-1.18 Go specifications, so you should not notice any differences. However, the support for the standard library is rather limited, and goroutines are disabled due to Solana's constraints.