Algorand's official implementation in Go.
Algorand is a permissionless, pure proof-of-stake blockchain that delivers decentralization, scalability, security, and transaction finality.
Our developer website has the most up to date information about using and installing the algorand platform.
Development is done using the Go Programming Language version 1.12.x, and this document assumes that you have a functioning environment setup. If you need assistance setting up an environment please visit the official Go documentation website.
We currently strive to support Debian based distributions with Ubuntu 18.04 being our official release target. Our core engineering team uses Linux and OSX, so both environments are well supported for development.
Initial environment setup:
git clone https://github.com/algorand/go-algorand
cd go-algorand
sh ./scripts/configure_dev.shAt this point you are ready to build go-algorand. We use make and have a number of targets to automate common tasks.
make install# unit tests
make test
# integration tests
make integration make fmt
make lint
make fix
make vetor alternatively
make sanityOnce the software is built you'll find binaries in ${GOPATH}/bin, and a data directory will be initialized at ~/.algorand. Start your node with ${GOPATH}/bin/goal node start -d ~/.algorand, use ${GOPATH}/bin/carpenter -d ~/.algorand to see activity. Refer to the developer website for how to use the different tools.
Please refer to our CONTRIBUTING document.
go-algorand is split into various subpackages.
The following packages provide core functionality to the algod and kmd daemons, as well as other tools and commands:
cryptocontains the cryptographic constructions we're using for hashing, signatures, and VRFs. There are also some Algorand-specific details here about spending keys, protocols keys, one-time-use signing keys, and how they relate to each other.configholds configuration parameters. These include parameters used locally by the node as well as parameters which must be agreed upon by the protocol.datadefines various types used throughout the codebase.basicsholds basic types such as MicroAlgos, account data, and addresses.accountdefines accounts, including "root" accounts (which can spend money) and "participation" accounts (which can participate in the agreement protocol).transactionsdefines transactions that accounts can issue against the Algorand state. These include standard payments and also participation key registration transactions.bookkeepingdefines blocks, which are batches of transactions atomically committed to Algorand.poolsimplements the transaction pool. The transaction pool holds transactions seen by a node in memory before they are proposed in a block.committeeimplements the credentials that authenticate a participating account's membership in the agreement protocol.
ledger(README) contains the Algorand Ledger state machine, which holds the sequence of blocks. The Ledger executes the state transitions that result from applying these blocks. It answers queries on blocks (e.g., what transactions were in the last committed block?) and on accounts (e.g., what is my balance?).protocoldeclares constants used to identify protocol versions, tags for routing network messages, and prefixes for domain separation of cryptographic inputs. It also implements the canonical encoder.networkcontains the code for participating in a mesh network based on websockets. Maintains connection to some number of peers, (optionally) accepts connections from peers, sends point to point and broadcast messages, and receives messages routing them to various handler code (e.g. agreement/gossip/network.go registers three handlers).rpcscontains the HTTP RPCs used byalgodprocesses to query one another.
agreement(README) contains the agreement service, which implements Algorand's Byzantine Agreement protocol. This protocol allows participating accounts to quickly confirm blocks in a fork-safe manner, provided that sufficient account stake is correctly executing the protocol.nodeintegrates the components above and handles initialization and shutdown. It provides queries into these components.
daemon defines the two daemons which provide Algorand clients with services:
daemon/algodholds thealgoddaemon, which implements a participating node.algodallows a node to participate in the agreement protocol, submit and confirm transactions, and view the state of the Algorand Ledger.daemon/algod/api(README) is the REST interface used for interactions with algod.
daemon/kmd(README) holds thekmddaemon. This daemon allows a node to sign transactions. Becausekmdis separate fromalgod,kmdallows a user to sign transactions on an air-gapped computer.
The following packages allow developers to interface with the Algorand system:
cmdholds the primary commands defining entry points into the system.cmd/catchupsrv(README) is a tool to assist with processing historic blocks on a new node.
libgoalexports a Go interface useful for developers of Algorand clients.debugholds secondary commands which assist developers during debugging.
The auction package implements the Algorand auctions.
The following packages contain tools to help Algorand developers deploy networks of their own:
nodecontroltoolsdockercommandandcontrol(README) is a tool to automate a network of algod instances.componentsnetdeploy
A number of packages provide utilities for the various components:
loggingis a wrapper aroundlogrus.utilcontains a variety of utilities, including a codec, a sqlite wrapper, a goroutine pool, a timer interface, node metrics, and more.
test contains end-to-end tests for the above components.
Please see the COPYING_FAQ for details about how to apply our license.
Copyright (C) 2019, Algorand Inc