algorand

package
v1.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2020 License: GPL-2.0, GPL-3.0 Imports: 9 Imported by: 3

README

Algorand

This package implements handlers which can be used to interact with the Algorand blockchain. The Algorand documentation is a good place to start and has instructions that work seamlessly. Once your node is up, you need to wait for it to finish syncing up to the current height and then you're free to experiment with the Go SDK

To start a private network, cd private/node to fetch algod.net and algod.token and link it with the SDK.

For getting a kmd access token, cd private and cat kmd-v0.5/kmd.token.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AlgodAddress is the address of the algod daemon
	AlgodAddress string
	// AlgodToken is the auth token needed to call algod's rpc functions
	AlgodToken string
	// KmdAddress is the address of the key management daemon
	KmdAddress string
	// KmdToken is the auth token needed to call the kmd's rpc functions
	KmdToken string
)
View Source
var AlgodClient algod.Client

AlgodClient is a package-level gloabal variable

View Source
var KmdClient kmd.Client

KmdClient is a package-level gloabal variable

Functions

func CreateNewWallet

func CreateNewWallet(name string, password string) (string, error)

CreateNewWallet creates a new wallet

func CreateNewWalletAndAddress

func CreateNewWalletAndAddress(name string, password string) (string, error)

CreateNewWalletAndAddress creates a new wallet and an address

func GenerateBackup

func GenerateBackup(walletName string, password string) (string, error)

GenerateBackup gets the seedphrase from the walletName for backup

func GenerateNewAddress

func GenerateNewAddress(walletID string, name string, password string) (string, error)

GenerateNewAddress generates a new address associated with the given wallet

func GetAlgo

func GetAlgo(walletName string, password string) (string, error)

GetAlgo seeds a given wallet with a specific number of algos similar to what friendbot does on stellar

func GetBlock

func GetBlock(blockNumber uint64) (models.Block, error)

GetBlock gets the details ofa given block from the algorand blockchain

func GetLatestBlock

func GetLatestBlock(status models.NodeStatus) (models.Block, error)

GetLatestBlock getst the latest block from the blockchain

func GetStatus

func GetStatus(Client algod.Client) (models.NodeStatus, error)

GetStatus gets the status of a given algod client

func Init

func Init() error

Init initializes the algod client and the kmd client

func InitAlgodClient

func InitAlgodClient() (algod.Client, error)

InitAlgodClient initializes a new algorand daemon client

func InitKmdClient

func InitKmdClient() (kmd.Client, error)

InitKmdClient initializes a new key management daemon client

func SendAlgo

func SendAlgo(walletName string, password string, amount uint64, fromAddr string, toAddr string) (string, error)

SendAlgo sends algos to another address from a source account

func SendAlgoToSelf

func SendAlgoToSelf(walletName string, password string, fromAddr string, amount uint64) (string, error)

SendAlgoToSelf sends algos to another address owned by the same user

func SetConsts

func SetConsts(address string, token string, kmdaddress string, kmdtoken string)

SetConsts sets algorand consts

Types

type Wallet

type Wallet struct {
	WalletName string
	WalletID   string
}

Wallet defines the algorand wallet strcuture

func GenNewWallet

func GenNewWallet(walletName string, password string) (Wallet, error)

GenNewWallet generates a new algorand wallet

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL